Class: Behance::Client
- Inherits:
-
Object
- Object
- Behance::Client
- Includes:
- Collections, CreativesToFollow, Fields, Project, User, Wips
- Defined in:
- lib/behance/user.rb,
lib/behance/wips.rb,
lib/behance/client.rb,
lib/behance/fields.rb,
lib/behance/project.rb,
lib/behance/collections.rb,
lib/behance/creatives_to_follow.rb
Defined Under Namespace
Modules: Collections, CreativesToFollow, Fields, Project, User, Wips
Constant Summary collapse
- API_URL =
"http://www.behance.net/v2/"
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#connection ⇒ Object
Returns the value of attribute connection.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
Public: Initialize a client for API requests.
-
#request(path, options = {}) ⇒ Object
Public: Makes a http request to the API.
Methods included from CreativesToFollow
Methods included from Fields
Methods included from Collections
#collection, #collection_projects, #collections
Methods included from Wips
#wip, #wip_revision, #wip_revision_comments, #wips
Methods included from User
#user, #user_appreciations, #user_collections, #user_followers, #user_following, #user_projects, #user_stats, #user_wips, #user_work_experience, #users
Methods included from Project
#project, #project_comments, #projects
Constructor Details
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
24 25 26 |
# File 'lib/behance/client.rb', line 24 def access_token @access_token end |
#connection ⇒ Object
Returns the value of attribute connection.
24 25 26 |
# File 'lib/behance/client.rb', line 24 def connection @connection end |
Instance Method Details
#request(path, options = {}) ⇒ Object
Public: Makes a http request to the API.
path - A String that represents the endpoint path. options - Hash of parameters to pass along.
Examples
request("users/1")
request("projects", page: 2)
Returns a response body from the API.
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/behance/client.rb', line 55 def request(path, ={}) response = @connection.get do |req| req.url path req.params[:api_key] = @access_token .each do |key, val| req.params[key] = val end end response.body end |