Class: Twilio::REST::ClientCredentialProvider
- Inherits:
 - 
      CredentialProvider
      
        
- Object
 - CredentialProvider
 - Twilio::REST::ClientCredentialProvider
 
 
- Defined in:
 - lib/twilio-ruby/credential/client_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)  ⇒ ClientCredentialProvider 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of ClientCredentialProvider.
 - #to_auth_strategy ⇒ Object
 
Constructor Details
#initialize(client_id, client_secret, orgs_token = nil) ⇒ ClientCredentialProvider
Returns a new instance of ClientCredentialProvider.
      10 11 12 13 14 15 16 17 18 19  | 
    
      # File 'lib/twilio-ruby/credential/client_credential_provider.rb', line 10 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.
      8 9 10  | 
    
      # File 'lib/twilio-ruby/credential/client_credential_provider.rb', line 8 def auth_strategy @auth_strategy end  | 
  
#client_id ⇒ Object
Returns the value of attribute client_id.
      8 9 10  | 
    
      # File 'lib/twilio-ruby/credential/client_credential_provider.rb', line 8 def client_id @client_id end  | 
  
#client_secret ⇒ Object
Returns the value of attribute client_secret.
      8 9 10  | 
    
      # File 'lib/twilio-ruby/credential/client_credential_provider.rb', line 8 def client_secret @client_secret end  | 
  
#grant_type ⇒ Object
Returns the value of attribute grant_type.
      8 9 10  | 
    
      # File 'lib/twilio-ruby/credential/client_credential_provider.rb', line 8 def grant_type @grant_type end  | 
  
#orgs_token ⇒ Object
Returns the value of attribute orgs_token.
      8 9 10  | 
    
      # File 'lib/twilio-ruby/credential/client_credential_provider.rb', line 8 def orgs_token @orgs_token end  | 
  
Instance Method Details
#to_auth_strategy ⇒ Object
      21 22 23 24 25  | 
    
      # File 'lib/twilio-ruby/credential/client_credential_provider.rb', line 21 def to_auth_strategy @orgs_token = ClientTokenManager.new(@grant_type, @client_id, @client_secret) if @orgs_token.nil? @auth_strategy = TokenAuthStrategy.new(@orgs_token) if @auth_strategy.nil? @auth_strategy end  |