Class: Twilio::REST::Iam::V1::TokenList

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

Instance Method Summary collapse

Constructor Details

#initialize(version) ⇒ TokenList

Initialize the TokenList

Parameters:

  • Version that contains the resource



26
27
28
29
30
31
32
# File 'lib/twilio-ruby/rest/iam/v1/token.rb', line 26

def initialize(version)
    super(version)
    # Path Solution
    @solution = {  }
    @uri = "/token"
    
end

Instance Method Details

#create(grant_type: nil, client_id: nil, client_secret: :unset, code: :unset, redirect_uri: :unset, audience: :unset, refresh_token: :unset, scope: :unset) ⇒ TokenInstance

Create the TokenInstance

Parameters:

  • (defaults to: nil)

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

  • (defaults to: nil)

    A 34 character string that uniquely identifies this OAuth App.

  • (defaults to: :unset)

    The credential for confidential OAuth App.

  • (defaults to: :unset)

    JWT token related to the authorization code grant type.

  • (defaults to: :unset)

    The redirect uri

  • (defaults to: :unset)

    The targeted audience uri

  • (defaults to: :unset)

    JWT token related to refresh access token.

  • (defaults to: :unset)

    The scope of token

Returns:

  • Created TokenInstance



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/twilio-ruby/rest/iam/v1/token.rb', line 44

def create(
    grant_type: nil, 
    client_id: nil, 
    client_secret: :unset, 
    code: :unset, 
    redirect_uri: :unset, 
    audience: :unset, 
    refresh_token: :unset, 
    scope: :unset
)

    data = Twilio::Values.of({
        '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,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.create('POST', @uri, data: data, headers: headers)
    TokenInstance.new(
        @version,
        payload,
    )
end

#to_sObject

Provide a user friendly representation



83
84
85
# File 'lib/twilio-ruby/rest/iam/v1/token.rb', line 83

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