Class: GoogleContacts::Auth

Inherits:
Object
  • Object
show all
Defined in:
lib/google_contacts/auth.rb

Constant Summary collapse

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

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.callback_urlObject

Returns the value of attribute callback_url.



13
14
15
# File 'lib/google_contacts/auth.rb', line 13

def callback_url
  @callback_url
end

.consumer_keyObject

Returns the value of attribute consumer_key.



11
12
13
# File 'lib/google_contacts/auth.rb', line 11

def consumer_key
  @consumer_key
end

.consumer_secretObject

Returns the value of attribute consumer_secret.



12
13
14
# File 'lib/google_contacts/auth.rb', line 12

def consumer_secret
  @consumer_secret
end

Class Method Details

.consumerObject



16
17
18
# File 'lib/google_contacts/auth.rb', line 16

def self.consumer
  ::OAuth::Consumer.new(consumer_key, consumer_secret, GOOGLE_OAUTH)
end

Instance Method Details

#request_token(options) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/google_contacts/auth.rb', line 20

def request_token(options)
  self.class.consumer.get_request_token({
    :oauth_callback => options[:callback]
  }, {
    :scope => 'http://www.google.com/m8/feeds/'
  })
end