Class: GoogleToken

Inherits:
ConsumerToken
  • Object
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

Instance Method Summary collapse

Class Method Details

.consumerObject



11
12
13
# File 'lib/oauth/models/consumers/services/google_token.rb', line 11

def self.consumer
  @consumer||=create_consumer
end

.create_consumer(options = {}) ⇒ Object



15
16
17
# File 'lib/oauth/models/consumers/services/google_token.rb', line 15

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



19
20
21
# File 'lib/oauth/models/consumers/services/google_token.rb', line 19

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

Instance Method Details

#portable_contactsObject



23
24
25
# File 'lib/oauth/models/consumers/services/google_token.rb', line 23

def portable_contacts
  @portable_contacts||= PortableContacts::Client.new "http://www-opensocial.googleusercontent.com/api/people", client
end