Class: OmniAuth::Strategies::Intuit
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::Intuit
- Defined in:
- lib/omniauth/strategies/intuit.rb
Constant Summary collapse
- USER_INFO_ENDPOINT =
"/v1/openid_connect/userinfo"
- BASE_SCOPES =
"openid email profile"
- VALID_SCOPES =
%w[openid profile email phone addess com.intuit.quickbooks.accounting com.intuit.quickbooks.payment].freeze
- USER_BASE_URLS =
{ production: "https://accounts.platform.intuit.com", sandbox: "https://sandbox-accounts.platform.intuit.com", }
Instance Method Summary collapse
- #prune!(hash) ⇒ Object
- #raw_info ⇒ Object
- #user_endpoint_url(mode) ⇒ Object
- #valid_mode ⇒ Object
- #verified_email ⇒ Object
Instance Method Details
#prune!(hash) ⇒ Object
58 59 60 61 62 63 |
# File 'lib/omniauth/strategies/intuit.rb', line 58 def prune!(hash) hash.delete_if do |_, value| prune!(value) if value.is_a?(Hash) value.nil? || (value.respond_to?(:empty?) && value.empty?) end end |
#raw_info ⇒ Object
40 41 42 |
# File 'lib/omniauth/strategies/intuit.rb', line 40 def raw_info @raw_info ||= access_token.get(user_endpoint_url(.mode)).parsed end |
#user_endpoint_url(mode) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/omniauth/strategies/intuit.rb', line 44 def user_endpoint_url(mode) user_info_endpoint = nil if valid_mode && .mode == :production user_info_endpoint = USER_BASE_URLS[:production] + USER_INFO_ENDPOINT else user_info_endpoint = USER_BASE_URLS[:sandbox] + USER_INFO_ENDPOINT end user_info_endpoint end |
#valid_mode ⇒ Object
36 37 38 |
# File 'lib/omniauth/strategies/intuit.rb', line 36 def valid_mode USER_BASE_URLS.has_key? .mode end |
#verified_email ⇒ Object
54 55 56 |
# File 'lib/omniauth/strategies/intuit.rb', line 54 def verified_email raw_info["emailVerified"] ? raw_info["email"] : nil end |