Module: Cloudpt::API::OAuth

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

Class Method Summary collapse

Class Method Details

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



19
20
21
# File 'lib/cloudpt-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/cloudpt-api/util/oauth.rb', line 8

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