Class: OmniContacts::Importer::Yahoo

Inherits:
Middleware::OAuth1 show all
Defined in:
lib/omnicontacts/importer/yahoo.rb

Constant Summary

Constants included from Authorization::OAuth1

Authorization::OAuth1::OAUTH_VERSION

Constants included from HTTPUtils

HTTPUtils::SSL_PORT

Instance Attribute Summary collapse

Attributes inherited from Middleware::OAuth1

#callback_path, #consumer_key, #consumer_secret

Attributes inherited from Middleware::BaseOAuth

#ssl_ca_file

Instance Method Summary collapse

Methods inherited from Middleware::OAuth1

#callback, #fetch_contacts, #redirect_to_authorization_site, #request_authorization_from_user, #token_secret_prop_name

Methods included from Authorization::OAuth1

#authorization_url, #fetch_access_token, #fetch_authorization_token, #oauth_signature

Methods included from HTTPUtils

encode, host_url_from_rack_env, query_string_to_map, scheme, to_query_string

Methods inherited from Middleware::BaseOAuth

#call, #class_name

Constructor Details

#initialize(*args) ⇒ Yahoo

Returns a new instance of Yahoo.



10
11
12
13
14
15
16
17
# File 'lib/omnicontacts/importer/yahoo.rb', line 10

def initialize *args
  super *args
  @auth_host = "api.login.yahoo.com"
  @auth_token_path = "/oauth/v2/get_request_token"
  @auth_path = "/oauth/v2/request_auth"
  @access_token_path = "/oauth/v2/get_token"
  @contacts_host = "social.yahooapis.com"
end

Instance Attribute Details

#access_token_pathObject (readonly)

Returns the value of attribute access_token_path.



8
9
10
# File 'lib/omnicontacts/importer/yahoo.rb', line 8

def access_token_path
  @access_token_path
end

#auth_hostObject (readonly)

Returns the value of attribute auth_host.



8
9
10
# File 'lib/omnicontacts/importer/yahoo.rb', line 8

def auth_host
  @auth_host
end

#auth_pathObject (readonly)

Returns the value of attribute auth_path.



8
9
10
# File 'lib/omnicontacts/importer/yahoo.rb', line 8

def auth_path
  @auth_path
end

#auth_token_pathObject (readonly)

Returns the value of attribute auth_token_path.



8
9
10
# File 'lib/omnicontacts/importer/yahoo.rb', line 8

def auth_token_path
  @auth_token_path
end

Instance Method Details

#fetch_contacts_from_token_and_verifier(auth_token, auth_token_secret, auth_verifier) ⇒ Object



19
20
21
22
23
24
# File 'lib/omnicontacts/importer/yahoo.rb', line 19

def fetch_contacts_from_token_and_verifier auth_token, auth_token_secret, auth_verifier
  (access_token, access_token_secret, guid) = fetch_access_token(auth_token, auth_token_secret, auth_verifier, ["xoauth_yahoo_guid"])
  contacts_path = "/v1/user/#{guid}/contacts"
  contacts_response = http_get(@contacts_host, contacts_path, contacts_req_params(access_token, access_token_secret, contacts_path))
  contacts_from_response contacts_response
end