Class: Twilio::REST::OrgsCredentialProvider
- Inherits:
-
CredentialProvider
- Object
- CredentialProvider
- Twilio::REST::OrgsCredentialProvider
- Defined in:
- lib/twilio-ruby/credential/orgs_credential_provider.rb
Instance Attribute Summary collapse
-
#auth_strategy ⇒ Object
Returns the value of attribute auth_strategy.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#grant_type ⇒ Object
Returns the value of attribute grant_type.
-
#orgs_token ⇒ Object
Returns the value of attribute orgs_token.
Attributes inherited from CredentialProvider
Instance Method Summary collapse
-
#initialize(client_id, client_secret, orgs_token = nil) ⇒ OrgsCredentialProvider
constructor
A new instance of OrgsCredentialProvider.
- #to_auth_strategy ⇒ Object
Constructor Details
#initialize(client_id, client_secret, orgs_token = nil) ⇒ OrgsCredentialProvider
Returns a new instance of OrgsCredentialProvider.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/twilio-ruby/credential/orgs_credential_provider.rb', line 12 def initialize(client_id, client_secret, orgs_token = nil) super(AuthType::ORGS_TOKEN) raise ArgumentError, 'client_id and client_secret are required' if client_id.nil? || client_secret.nil? @grant_type = 'client_credentials' @client_id = client_id @client_secret = client_secret @orgs_token = orgs_token @auth_strategy = nil end |
Instance Attribute Details
#auth_strategy ⇒ Object
Returns the value of attribute auth_strategy.
10 11 12 |
# File 'lib/twilio-ruby/credential/orgs_credential_provider.rb', line 10 def auth_strategy @auth_strategy end |
#client_id ⇒ Object
Returns the value of attribute client_id.
10 11 12 |
# File 'lib/twilio-ruby/credential/orgs_credential_provider.rb', line 10 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
10 11 12 |
# File 'lib/twilio-ruby/credential/orgs_credential_provider.rb', line 10 def client_secret @client_secret end |
#grant_type ⇒ Object
Returns the value of attribute grant_type.
10 11 12 |
# File 'lib/twilio-ruby/credential/orgs_credential_provider.rb', line 10 def grant_type @grant_type end |
#orgs_token ⇒ Object
Returns the value of attribute orgs_token.
10 11 12 |
# File 'lib/twilio-ruby/credential/orgs_credential_provider.rb', line 10 def orgs_token @orgs_token end |
Instance Method Details
#to_auth_strategy ⇒ Object
23 24 25 26 27 |
# File 'lib/twilio-ruby/credential/orgs_credential_provider.rb', line 23 def to_auth_strategy @orgs_token = OrgTokenManager.new(@grant_type, @client_id, @client_secret) if @orgs_token.nil? @auth_strategy = TokenAuthStrategy.new(@orgs_token) if @auth_strategy.nil? @auth_strategy end |