Module: Behance::Client::User

Included in:
Behance::Client
Defined in:
lib/behance/user.rb

Instance Method Summary collapse

Instance Method Details

#user(user) ⇒ Object

Public: Get basic information about a user.

user - can be an ID (Integer) or username (String).

Examples

@client.user(1)
@client.user("foo")

Returns a single user object.



45
46
47
# File 'lib/behance/user.rb', line 45

def user(user)
  request("users/#{user}")["user"]
end

#user_appreciations(user, options = {}) ⇒ Object

Public: Get a list of user’s recently appreciated projects.

user - can be an ID (Integer) or username (String). options - The Hash with options that the API would expect:

:page - The page number of the results, always starting
        with 1.

Examples

@client.user_appreciations(1)
@client.user_appreciations("foo", page: 2)

Returns an array of user’s recently appreciated projects in JSON format.



109
110
111
# File 'lib/behance/user.rb', line 109

def user_appreciations(user, options={})
  request("users/#{user}/appreciations", options)["appreciations"]
end

#user_collections(user, options = {}) ⇒ Object

Public: Get a list of a user’s collections.

user - can be an ID (Integer) or username (String). 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.

Examples

@client.user_collections(1)
@client.user_collections("foo")

Returns an array of user’s public collections in JSON format.



129
130
131
# File 'lib/behance/user.rb', line 129

def user_collections(user, options={})
  request("users/#{user}/collections", options)["collections"]
end

#user_followers(user, options = {}) ⇒ Object

Public: Get a list of creatives who follow the user.

user - can be an ID (Integer) or username (String). options - The Hash with options that the API would expect:

:page       - The page number of the results, always starting
              with 1.
:sort       - The order the results are returned in.
              Possible values: created_date (default),
              appreciations, views, comments, followed, alpha.
:sort_order - The direction in which the results are returned.
              Possible values: asc, desc.
:per_page   - The number of results per page. (Max: 20)

Examples

@client.user_followers(1)
@client.user_followers(1, page: 2)
@client.user_followers("foo", sort: "alpha", page: 3)

Returns an array of creatives who follow the user in JSON format.



167
168
169
# File 'lib/behance/user.rb', line 167

def user_followers(user, options={})
  request("users/#{user}/followers", options)["followers"]
end

#user_following(user, options = {}) ⇒ Object

Public: Get a list of creatives followed by the user.

user - can be an ID (Integer) or username (String). options - The Hash with options that the API would expect:

:page       - The page number of the results, always starting
              with 1.
:sort       - The order the results are returned in.
              Possible values: created_date (default),
              appreciations, views, comments, followed, alpha.
:sort_order - The direction in which the results are returned.
              Possible values: asc, desc.
:per_page   - The number of results per page. (Max: 20)

Examples

@client.user_following(1)
@client.user_following(1, page: 2)
@client.user_following("foo", sort: "alpha", page: 3)

Returns an array of creatives followed by the user in JSON format.



191
192
193
# File 'lib/behance/user.rb', line 191

def user_following(user, options={})
  request("users/#{user}/following", options)["following"]
end

#user_projects(user, options = {}) ⇒ Object

Public: Get the projects published by a user.

user - Can be an ID (Integer) or username (String) options - The Hash with options that the API would expect:

:sort - The order the results are returned in.
        Possible values: featured_date (default),
        appreciations, views, comments, published_date.
:time - Limits the search by time.
        Possible values: all (default), today, week, month.
:page - The page number of the results, always starting
        with 1.

Examples

@client.user_projects(1)
@client.user_projects("foo")
@client.user_projects("foo", page: 2, sort: "views")

Returns an array of projects in JSON format.



68
69
70
# File 'lib/behance/user.rb', line 68

def user_projects(user, options={})
  request("users/#{user}/projects", options)["projects"]
end

#user_stats(user) ⇒ Object

Public: Get user’s statistics (all-time and today).

user - can be an ID (Integer) or username (String).

Examples

@client.user_stats(1)
@client.user_stats("foo")

Returns “today” and “all_time” stats objects.



143
144
145
# File 'lib/behance/user.rb', line 143

def user_stats(user)
  request("users/#{user}/stats")["stats"]
end

#user_wips(user, options = {}) ⇒ Object

Public: Get the works-in-progress published by a user.

user - can be an ID (Integer) or username (String). options - The Hash with options that the API would expect:

:sort - The order the results are returned in.
        Possible values: featured_date (default),
        appreciations, views, comments, published_date.
:time - Limits the search by time.
        Possible values: all (default), today, week, month.
:page - The page number of the results, always starting
        with 1.

Examples

@client.user_wips(1)
@client.user_wips(1, page: 2)
@client.user_wips("foo", sort: "comments", page: 3)

Returns an array of work-in-progress in JSON format.



91
92
93
# File 'lib/behance/user.rb', line 91

def user_wips(user, options={})
  request("users/#{user}/wips", options)["wips"]
end

#user_work_experience(user) ⇒ Object

Public: A list of the user’s professional experience

user - can be an ID (Integer) or username (String).

Examples

@client.user_work_experience(1)
@client.user_work_experience("foo")

Returns an array od user’s professions experience.



205
206
207
# File 'lib/behance/user.rb', line 205

def user_work_experience(user)
  request("users/#{user}/work_experience")["work_experience"]
end

#users(options = {}) ⇒ Object

Public: Search for users.

options - The Hash with options that the API would expect:

:q       - Free text query string.
:field   - Limits the search by creative field.
           Accepts a URL-encoded field name from the list of
           defined creative fields.
:country - Limits the search by a 2-letter FIPS country code.
:state   - Limits the search by state or province name.
:city    - Limits the search by city name.
: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.
:tags    - Limits the search by tags.
           Accepts one tag name or a pipe-separated list of
           tag names.

Examples

@client.users
@client.users(q: "Juan", state: "California", tags: "freelance")

Returns an array of users in JSON format.



31
32
33
# File 'lib/behance/user.rb', line 31

def users(options={})
  request("users", options)["users"]
end