Class: Twilio::REST::Api::V2010::AccountContext::TokenList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/token.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid: nil) ⇒ TokenList

Initialize the TokenList

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String) (defaults to: nil)

    The SID of the Account that created the Token resource.


22
23
24
25
26
27
28
# File 'lib/twilio-ruby/rest/api/v2010/account/token.rb', line 22

def initialize(version, account_sid: nil)
  super(version)

  # Path Solution
  @solution = {account_sid: }
  @uri = "/Accounts/#{@solution[:account_sid]}/Tokens.json"
end

Instance Method Details

#create(ttl: :unset) ⇒ TokenInstance

Create the TokenInstance

Parameters:

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

    The duration in seconds for which the generated credentials are valid. The default value is 86400 (24 hours).

Returns:


35
36
37
38
39
40
41
# File 'lib/twilio-ruby/rest/api/v2010/account/token.rb', line 35

def create(ttl: :unset)
  data = Twilio::Values.of({'Ttl' => ttl, })

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

  TokenInstance.new(@version, payload, account_sid: @solution[:account_sid], )
end

#to_sObject

Provide a user friendly representation


45
46
47
# File 'lib/twilio-ruby/rest/api/v2010/account/token.rb', line 45

def to_s
  '#<Twilio.Api.V2010.TokenList>'
end