Class: IntuitOAuth::Client
- Inherits:
-
Object
- Object
- IntuitOAuth::Client
- Defined in:
- lib/intuit-oauth/client.rb
Instance Attribute Summary collapse
-
#auth_endpoint ⇒ Object
readonly
Returns the value of attribute auth_endpoint.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#issuer_uri ⇒ Object
readonly
Returns the value of attribute issuer_uri.
-
#jwks_uri ⇒ Object
readonly
Returns the value of attribute jwks_uri.
-
#realm_id ⇒ Object
Returns the value of attribute realm_id.
-
#redirect_uri ⇒ Object
readonly
Returns the value of attribute redirect_uri.
-
#revoke_endpoint ⇒ Object
readonly
Returns the value of attribute revoke_endpoint.
-
#secret ⇒ Object
readonly
Returns the value of attribute secret.
-
#state_token ⇒ Object
Returns the value of attribute state_token.
-
#token_endpoint ⇒ Object
readonly
Returns the value of attribute token_endpoint.
-
#user_info_url ⇒ Object
readonly
Returns the value of attribute user_info_url.
Instance Method Summary collapse
- #code ⇒ Object
- #get_discovery_doc(environment) ⇒ Object
-
#initialize(client_id, client_secret, redirect_uri, environment) ⇒ Client
constructor
A new instance of Client.
- #migration ⇒ Object
- #openid ⇒ Object
- #token ⇒ Object
Constructor Details
#initialize(client_id, client_secret, redirect_uri, environment) ⇒ Client
Returns a new instance of Client.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/intuit-oauth/client.rb', line 29 def initialize(client_id, client_secret, redirect_uri, environment) @id = client_id @secret = client_secret @redirect_uri = redirect_uri @environment = environment # Discovery Doc containes endpoints required for OAuth fow @discovery_doc = get_discovery_doc(@environment) @auth_endpoint = @discovery_doc['authorization_endpoint'] @token_endpoint = @discovery_doc['token_endpoint'] @revoke_endpoint = @discovery_doc['revocation_endpoint'] @issuer_uri = @discovery_doc['issuer'] @jwks_uri = @discovery_doc['jwks_uri'] @user_info_url = @discovery_doc['userinfo_endpoint'] # optionally set realm_id @realm_id = '' @state_token = '' end |
Instance Attribute Details
#auth_endpoint ⇒ Object (readonly)
Returns the value of attribute auth_endpoint.
25 26 27 |
# File 'lib/intuit-oauth/client.rb', line 25 def auth_endpoint @auth_endpoint end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
25 26 27 |
# File 'lib/intuit-oauth/client.rb', line 25 def environment @environment end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
25 26 27 |
# File 'lib/intuit-oauth/client.rb', line 25 def id @id end |
#issuer_uri ⇒ Object (readonly)
Returns the value of attribute issuer_uri.
25 26 27 |
# File 'lib/intuit-oauth/client.rb', line 25 def issuer_uri @issuer_uri end |
#jwks_uri ⇒ Object (readonly)
Returns the value of attribute jwks_uri.
25 26 27 |
# File 'lib/intuit-oauth/client.rb', line 25 def jwks_uri @jwks_uri end |
#realm_id ⇒ Object
Returns the value of attribute realm_id.
25 26 27 |
# File 'lib/intuit-oauth/client.rb', line 25 def realm_id @realm_id end |
#redirect_uri ⇒ Object (readonly)
Returns the value of attribute redirect_uri.
25 26 27 |
# File 'lib/intuit-oauth/client.rb', line 25 def redirect_uri @redirect_uri end |
#revoke_endpoint ⇒ Object (readonly)
Returns the value of attribute revoke_endpoint.
25 26 27 |
# File 'lib/intuit-oauth/client.rb', line 25 def revoke_endpoint @revoke_endpoint end |
#secret ⇒ Object (readonly)
Returns the value of attribute secret.
25 26 27 |
# File 'lib/intuit-oauth/client.rb', line 25 def secret @secret end |
#state_token ⇒ Object
Returns the value of attribute state_token.
25 26 27 |
# File 'lib/intuit-oauth/client.rb', line 25 def state_token @state_token end |
#token_endpoint ⇒ Object (readonly)
Returns the value of attribute token_endpoint.
25 26 27 |
# File 'lib/intuit-oauth/client.rb', line 25 def token_endpoint @token_endpoint end |
#user_info_url ⇒ Object (readonly)
Returns the value of attribute user_info_url.
25 26 27 |
# File 'lib/intuit-oauth/client.rb', line 25 def user_info_url @user_info_url end |
Instance Method Details
#code ⇒ Object
58 59 60 |
# File 'lib/intuit-oauth/client.rb', line 58 def code IntuitOAuth::Flow::AuthCode.new(self) end |
#get_discovery_doc(environment) ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/intuit-oauth/client.rb', line 49 def get_discovery_doc(environment) if ['production', 'prod'].include? environment.downcase url = IntuitOAuth::Config::DISCOVERY_URL_PROD else url = IntuitOAuth::Config::DISCOVERY_URL_SANDBOX end IntuitOAuth::Transport.request('GET', url) end |
#migration ⇒ Object
70 71 72 |
# File 'lib/intuit-oauth/client.rb', line 70 def migration IntuitOAuth::Migration::Migrate.new(self) end |
#openid ⇒ Object
66 67 68 |
# File 'lib/intuit-oauth/client.rb', line 66 def openid IntuitOAuth::Flow::OpenID.new(self) end |
#token ⇒ Object
62 63 64 |
# File 'lib/intuit-oauth/client.rb', line 62 def token IntuitOAuth::Flow::Token.new(self) end |