Class: Dropbox::API::Connection
- Inherits:
-
Object
- Object
- Dropbox::API::Connection
- Includes:
- Requests
- Defined in:
- lib/dropbox-api/connection.rb,
lib/dropbox-api/connection/requests.rb
Defined Under Namespace
Modules: Requests
Instance Attribute Summary collapse
-
#consumers ⇒ Object
Returns the value of attribute consumers.
-
#tokens ⇒ Object
Returns the value of attribute tokens.
Instance Method Summary collapse
- #consumer(endpoint = :main) ⇒ Object
-
#initialize(options = {}) ⇒ Connection
constructor
A new instance of Connection.
- #token(endpoint = :main) ⇒ Object
Methods included from Requests
#get, #get_raw, #post, #put, #request
Constructor Details
#initialize(options = {}) ⇒ Connection
Returns a new instance of Connection.
13 14 15 16 17 18 19 20 21 |
# File 'lib/dropbox-api/connection.rb', line 13 def initialize( = {}) @options = @consumers = {} @tokens = {} Dropbox::API::Config.endpoints.each do |endpoint, url| @consumers[endpoint] = Dropbox::API::OAuth.consumer(endpoint) @tokens[endpoint] = Dropbox::API::OAuth.access_token(@consumers[endpoint], ) end end |
Instance Attribute Details
#consumers ⇒ Object
Returns the value of attribute consumers.
10 11 12 |
# File 'lib/dropbox-api/connection.rb', line 10 def consumers @consumers end |
#tokens ⇒ Object
Returns the value of attribute tokens.
11 12 13 |
# File 'lib/dropbox-api/connection.rb', line 11 def tokens @tokens end |
Instance Method Details
#consumer(endpoint = :main) ⇒ Object
23 24 25 |
# File 'lib/dropbox-api/connection.rb', line 23 def consumer(endpoint = :main) @consumers[endpoint] end |
#token(endpoint = :main) ⇒ Object
27 28 29 |
# File 'lib/dropbox-api/connection.rb', line 27 def token(endpoint = :main) @tokens[endpoint] end |