Class: OmniAuth::Strategies::Mailchimp
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::Mailchimp
- Defined in:
- lib/omniauth/strategies/mailchimp.rb
Instance Method Summary collapse
Instance Method Details
#callback_url ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/omniauth/strategies/mailchimp.rb', line 44 def callback_url if .full_host .full_host + script_name + callback_path + query_string else super end end |
#raw_info ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/omniauth/strategies/mailchimp.rb', line 52 def raw_info @raw_info ||= begin endpoint = user_data["api_endpoint"] response = @access_token.get("#{endpoint}/3.0/").parsed if response["error"] case response["code"] when 109 fail!(:invalid_credentials, response["error"]) end else response end end end |
#request_phase ⇒ Object
16 17 18 19 20 |
# File 'lib/omniauth/strategies/mailchimp.rb', line 16 def request_phase req = Rack::Request.new(@env) .update(req.params) super end |
#user_data ⇒ Object
67 68 69 70 71 72 73 74 75 |
# File 'lib/omniauth/strategies/mailchimp.rb', line 67 def user_data @data ||= MultiJson.decode(@access_token.get("https://login.mailchimp.com/oauth2/metadata").body) rescue ::OAuth2::Error => e if e.response.status == 302 @data ||= MultiJson.decode(@access_token.get(e.response.headers['location'])) else raise e end end |