1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
# Collections Endpoints.
module Behance
class Client
module Collections
# Public: Search for collections.
#
# options - The Hash with options that the API would expect:
# :q - Free text query string.
# :time - Limits the search by time.
# Possible values: all (default), today, week, month.
# :page - The page number of the results, always starting
# with 1.
# :sort - The order the results are returned in.
# Possible values: comments (default), views,
# last_item_added_date.
#
# Examples
#
# @client.collections
# @client.collections(q: "candy", time: "month")
#
# Returns an array of colelctions in JSON format.
def collections(options={})
request("collections", options)["collections"]
end
# Public: Get basic information about a collection.
#
# collection - it has to be an ID (Integer).
#
# Examples
#
# @client.collection(1)
#
# Returns a single collection object.
def collection(collection)
request("collections/#{collection}")["collection"]
end
# Public: Get projects from a collection.
#
# collection - it has to be an ID (Integer).
# options - The Hash with options that the API would expect:
# :time - Limits the search by time.
# Possible values: all (default), today, week,
# month.
# :page - The page number of the results, always starting
# with 1.
# :sort - The order the results are returned in.
# Possible values: featured_date (default),
# appreciations, views, comments, published_date,
# followed.
# :per_page - The number of results per page. (Max: 20)
#
# Examples
#
# @client.collections_projects(1)
# @client.collections_projects(1, page: 2)
#
# Returns an array of projects from a collection in JSON format.
def collection_projects(collection, options={})
request("collections/#{collection}/projects", options)["projects"]
end
end
end
end
|