Class: OmniContacts::Importer::Yahoo
- Inherits:
-
Middleware::OAuth1
- Object
- Middleware::BaseOAuth
- Middleware::OAuth1
- OmniContacts::Importer::Yahoo
- Includes:
- ParseUtils
- Defined in:
- lib/omnicontacts/importer/yahoo.rb
Constant Summary
Constants included from Authorization::OAuth1
Authorization::OAuth1::OAUTH_VERSION
Constants included from HTTPUtils
Instance Attribute Summary collapse
-
#access_token_path ⇒ Object
readonly
Returns the value of attribute access_token_path.
-
#auth_host ⇒ Object
readonly
Returns the value of attribute auth_host.
-
#auth_path ⇒ Object
readonly
Returns the value of attribute auth_path.
-
#auth_token_path ⇒ Object
readonly
Returns the value of attribute auth_token_path.
Attributes inherited from Middleware::OAuth1
#callback_path, #consumer_key, #consumer_secret
Attributes inherited from Middleware::BaseOAuth
Instance Method Summary collapse
- #fetch_contacts_from_token_and_verifier(auth_token, auth_token_secret, auth_verifier) ⇒ Object
- #fetch_current_user(access_token, access_token_secret, guid) ⇒ Object
-
#initialize(*args) ⇒ Yahoo
constructor
A new instance of Yahoo.
Methods included from ParseUtils
#birthday_format, #email_to_name, #full_name, #image_url_from_email, #normalize_name
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
Constructor Details
#initialize(*args) ⇒ Yahoo
Returns a new instance of Yahoo.
12 13 14 15 16 17 18 19 |
# File 'lib/omnicontacts/importer/yahoo.rb', line 12 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_path ⇒ Object (readonly)
Returns the value of attribute access_token_path.
10 11 12 |
# File 'lib/omnicontacts/importer/yahoo.rb', line 10 def access_token_path @access_token_path end |
#auth_host ⇒ Object (readonly)
Returns the value of attribute auth_host.
10 11 12 |
# File 'lib/omnicontacts/importer/yahoo.rb', line 10 def auth_host @auth_host end |
#auth_path ⇒ Object (readonly)
Returns the value of attribute auth_path.
10 11 12 |
# File 'lib/omnicontacts/importer/yahoo.rb', line 10 def auth_path @auth_path end |
#auth_token_path ⇒ Object (readonly)
Returns the value of attribute auth_token_path.
10 11 12 |
# File 'lib/omnicontacts/importer/yahoo.rb', line 10 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
21 22 23 24 25 26 27 |
# File 'lib/omnicontacts/importer/yahoo.rb', line 21 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']) fetch_current_user(access_token, access_token_secret, guid) contacts_path = "/v1/user/#{guid}/contacts" contacts_response = https_get(@contacts_host, contacts_path, contacts_req_params(access_token, access_token_secret, contacts_path)) contacts_from_response contacts_response end |
#fetch_current_user(access_token, access_token_secret, guid) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/omnicontacts/importer/yahoo.rb', line 29 def fetch_current_user access_token, access_token_secret, guid self_path = "/v1/user/#{guid}/profile" self_response = https_get(@contacts_host, self_path, contacts_req_params(access_token, access_token_secret, self_path)) user = current_user self_response set_current_user user end |