Class: Twilio::REST::Verify::V2::ServiceContext::AccessTokenList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/verify/v2/service/access_token.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid: nil) ⇒ AccessTokenList

Initialize the AccessTokenList

Parameters:

  • version (Version)

    Version that contains the resource

  • service_sid (String) (defaults to: nil)

    The unique SID identifier of the Verify Service.


22
23
24
25
26
27
28
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 22

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

  # Path Solution
  @solution = {service_sid: service_sid}
  @uri = "/Services/#{@solution[:service_sid]}/AccessTokens"
end

Instance Method Details

#create(identity: nil, factor_type: nil, factor_friendly_name: :unset, ttl: :unset) ⇒ AccessTokenInstance

Create the AccessTokenInstance

Parameters:

  • identity (String) (defaults to: nil)

    The unique external identifier for the Entity of the Service. This identifier should be immutable, not PII, and generated by your external system, such as your user's UUID, GUID, or SID.

  • factor_type (access_token.FactorTypes) (defaults to: nil)

    The Type of this Factor. Eg. `push`

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

    The friendly name of the factor that is going to be created with this access token

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

    How long, in seconds, the access token is valid. Can be an integer between 60 and 300. Default is 60.

Returns:


42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 42

def create(identity: nil, factor_type: nil, factor_friendly_name: :unset, ttl: :unset)
  data = Twilio::Values.of({
      'Identity' => identity,
      'FactorType' => factor_type,
      'FactorFriendlyName' => factor_friendly_name,
      'Ttl' => ttl,
  })

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

  AccessTokenInstance.new(@version, payload, service_sid: @solution[:service_sid], )
end

#to_sObject

Provide a user friendly representation


57
58
59
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 57

def to_s
  '#<Twilio.Verify.V2.AccessTokenList>'
end