Class: GoogleToken

Inherits:
ConsumerToken show all
Defined in:
lib/oauth/models/consumers/services/google_token.rb

Constant Summary collapse

GOOGLE_SETTINGS =
{
  :site=>"https://www.google.com",
  :request_token_path => "/accounts/OAuthGetRequestToken",
  :authorize_path => "/accounts/OAuthAuthorizeToken",
  :access_token_path => "/accounts/OAuthGetAccessToken",
}

Class Method Summary collapse

Methods inherited from ConsumerToken

find_or_create_from_access_token

Methods included from Oauth::Models::Consumers::Token

included

Class Method Details

.consumerObject



9
10
11
# File 'lib/oauth/models/consumers/services/google_token.rb', line 9

def self.consumer
  @consumer||=create_consumer
end

.create_consumer(options = {}) ⇒ Object



13
14
15
# File 'lib/oauth/models/consumers/services/google_token.rb', line 13

def self.create_consumer(options={})
  OAuth::Consumer.new credentials[:key],credentials[:secret],GOOGLE_SETTINGS.merge(options)
end

.get_request_token(callback_url, scope = nil) ⇒ Object



17
18
19
# File 'lib/oauth/models/consumers/services/google_token.rb', line 17

def self.get_request_token(callback_url, scope=nil)
  consumer.get_request_token({:oauth_callback=>callback_url}, :scope=>scope||credentials[:scope]||"http://www-opensocial.googleusercontent.com/api/people")
end