Module: Dropbox::API::OAuth

Defined in:
lib/dropbox-api/util/oauth.rb

Class Method Summary collapse

Class Method Details

.access_token(consumer, options = {}) ⇒ Object



19
20
21
# File 'lib/dropbox-api/util/oauth.rb', line 19

def access_token(consumer, options = {})
  ::OAuth::AccessToken.new(consumer, options[:token], options[:secret])
end

.consumer(endpoint) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/dropbox-api/util/oauth.rb', line 8

def consumer(endpoint)
  if !Dropbox::API::Config.app_key or !Dropbox::API::Config.app_secret
    raise Dropbox::API::Error::Config.new("app_key or app_secret not provided")
  end
  ::OAuth::Consumer.new(Dropbox::API::Config.app_key, Dropbox::API::Config.app_secret,
    :site => Dropbox::API::Config.endpoints[endpoint],
    :request_token_path => Dropbox::API::Config.prefix + "/oauth/request_token",
    :authorize_path     => Dropbox::API::Config.prefix + "/oauth/authorize",
    :access_token_path  => Dropbox::API::Config.prefix + "/oauth/access_token")
end