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

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

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid: nil) ⇒ AccessTokenList

Initialize the AccessTokenList

Parameters:

  • version (Version)

    Version that contains the resource



28
29
30
31
32
33
34
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 28

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 (FactorTypes) (defaults to: nil)
  • 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# 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,
    })

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

#to_sObject

Provide a user friendly representation



74
75
76
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 74

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