Class: Twilio::REST::Oauth::V1::TokenList

Inherits:
ListResource show all
Defined in:
lib/twilio-ruby/rest/oauth/v1/token.rb

Instance Method Summary collapse

Constructor Details

#initialize(version) ⇒ TokenList

Initialize the TokenList

Parameters:

  • version (Version)

    Version that contains the resource



18
19
20
21
22
23
24
# File 'lib/twilio-ruby/rest/oauth/v1/token.rb', line 18

def initialize(version)
  super(version)

  # Path Solution
  @solution = {}
  @uri = "/token"
end

Instance Method Details

#create(grant_type: nil, client_sid: nil, client_secret: :unset, code: :unset, code_verifier: :unset, device_code: :unset, refresh_token: :unset, device_id: :unset) ⇒ TokenInstance

Create the TokenInstance

Parameters:

  • grant_type (String) (defaults to: nil)

    Grant type is a credential representing resource owner’s authorization which can be used by client to obtain access token.

  • client_sid (String) (defaults to: nil)

    A 34 character string that uniquely identifies this OAuth App.

  • client_secret (String) (defaults to: :unset)

    The credential for confidential OAuth App.

  • code (String) (defaults to: :unset)

    JWT token related to the authorization code grant type.

  • code_verifier (String) (defaults to: :unset)

    A code which is generation cryptographically.

  • device_code (String) (defaults to: :unset)

    JWT token related to the device code grant type.

  • refresh_token (String) (defaults to: :unset)

    JWT token related to the refresh token grant type.

  • device_id (String) (defaults to: :unset)

    The Id of the device associated with the token (refresh token).

Returns:



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/twilio-ruby/rest/oauth/v1/token.rb', line 40

def create(grant_type: nil, client_sid: nil, client_secret: :unset, code: :unset, code_verifier: :unset, device_code: :unset, refresh_token: :unset, device_id: :unset)
  data = Twilio::Values.of({
      'GrantType' => grant_type,
      'ClientSid' => client_sid,
      'ClientSecret' => client_secret,
      'Code' => code,
      'CodeVerifier' => code_verifier,
      'DeviceCode' => device_code,
      'RefreshToken' => refresh_token,
      'DeviceId' => device_id,
  })

  payload = @version.create('POST', @uri, data: data)

  TokenInstance.new(@version, payload, )
end

#to_sObject

Provide a user friendly representation



59
60
61
# File 'lib/twilio-ruby/rest/oauth/v1/token.rb', line 59

def to_s
  '#<Twilio.Oauth.V1.TokenList>'
end