Class: YahooToken

Inherits:
ConsumerToken
  • Object
show all
Defined in:
lib/muck_oauth/services/yahoo_token.rb

Overview

This was taken from an older version of the oauth-plugin gem.

Defined Under Namespace

Classes: SocialAPI, YahooRequestToken

Constant Summary collapse

YAHOO_SETTINGS =
{
  :site => "https://api.login.yahoo.com",
  :request_token_url => "/oauth/v2/get_request_token",
  :authorize_url => "/oauth/v2/request_auth",
  :access_token_url => "/oauth/v2/get_token"
}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.consumerObject


10
11
12
# File 'lib/muck_oauth/services/yahoo_token.rb', line 10

def self.consumer
  @consumer ||= create_consumer
end

.create_consumer(options = {}) ⇒ Object


14
15
16
# File 'lib/muck_oauth/services/yahoo_token.rb', line 14

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

.get_request_token(callback_url, scope = nil) ⇒ Object


22
23
24
# File 'lib/muck_oauth/services/yahoo_token.rb', line 22

def self.get_request_token(callback_url, scope = nil)
  YahooRequestToken.new consumer.get_request_token({:oauth_callback => callback_url}, :scope => scope || credentials[:scope])
end

.social_apis_consumerObject


18
19
20
# File 'lib/muck_oauth/services/yahoo_token.rb', line 18

def self.social_apis_consumer
  @social_api_consumer ||= create_consumer :site => "http://social.yahooapis.com/v1"
end

Instance Method Details

#social_apiObject


44
45
46
# File 'lib/muck_oauth/services/yahoo_token.rb', line 44

def social_api
  @social_api ||= SocialAPI.new(OAuth::AccessToken.new( self.class.social_apis_consumer, token, secret))
end