Class: Twilio::REST::OrgTokenManager
- Inherits:
-
Object
- Object
- Twilio::REST::OrgTokenManager
- Defined in:
- lib/twilio-ruby/http/org_token_manager.rb
Instance Attribute Summary collapse
-
#audience ⇒ Object
Returns the value of attribute audience.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#code ⇒ Object
Returns the value of attribute code.
-
#grant_type ⇒ Object
Returns the value of attribute grant_type.
-
#redirect_uri ⇒ Object
Returns the value of attribute redirect_uri.
-
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
-
#scope ⇒ Object
Returns the value of attribute scope.
Instance Method Summary collapse
- #fetch_access_token ⇒ Object
-
#initialize(grant_type, client_id, client_secret, code = nil, redirect_uri = nil, audience = nil, refresh_token = nil, scope = nil) ⇒ OrgTokenManager
constructor
A new instance of OrgTokenManager.
Constructor Details
#initialize(grant_type, client_id, client_secret, code = nil, redirect_uri = nil, audience = nil, refresh_token = nil, scope = nil) ⇒ OrgTokenManager
Returns a new instance of OrgTokenManager.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/twilio-ruby/http/org_token_manager.rb', line 6 def initialize(grant_type, client_id, client_secret, code = nil, redirect_uri = nil, audience = nil, refresh_token = nil, scope = nil) raise ArgumentError, 'client_id and client_secret are required' if client_id.nil? || client_secret.nil? @grant_type = grant_type @client_id = client_id @client_secret = client_secret @code = code @redirect_uri = redirect_uri @audience = audience @refresh_token = refresh_token @scope = scope end |
Instance Attribute Details
#audience ⇒ Object
Returns the value of attribute audience.
4 5 6 |
# File 'lib/twilio-ruby/http/org_token_manager.rb', line 4 def audience @audience end |
#client_id ⇒ Object
Returns the value of attribute client_id.
4 5 6 |
# File 'lib/twilio-ruby/http/org_token_manager.rb', line 4 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
4 5 6 |
# File 'lib/twilio-ruby/http/org_token_manager.rb', line 4 def client_secret @client_secret end |
#code ⇒ Object
Returns the value of attribute code.
4 5 6 |
# File 'lib/twilio-ruby/http/org_token_manager.rb', line 4 def code @code end |
#grant_type ⇒ Object
Returns the value of attribute grant_type.
4 5 6 |
# File 'lib/twilio-ruby/http/org_token_manager.rb', line 4 def grant_type @grant_type end |
#redirect_uri ⇒ Object
Returns the value of attribute redirect_uri.
4 5 6 |
# File 'lib/twilio-ruby/http/org_token_manager.rb', line 4 def redirect_uri @redirect_uri end |
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
4 5 6 |
# File 'lib/twilio-ruby/http/org_token_manager.rb', line 4 def refresh_token @refresh_token end |
#scope ⇒ Object
Returns the value of attribute scope.
4 5 6 |
# File 'lib/twilio-ruby/http/org_token_manager.rb', line 4 def scope @scope end |
Instance Method Details
#fetch_access_token ⇒ Object
20 21 22 23 24 25 |
# File 'lib/twilio-ruby/http/org_token_manager.rb', line 20 def fetch_access_token client = Twilio::REST::Client.new token_instance = client.preview_iam.v1.token.create(grant_type: @grant_type, client_id: @client_id, client_secret: @client_secret) token_instance.access_token end |