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

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

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid: nil, identity: 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 Service.

  • identity (String) (defaults to: nil)

    Customer unique identity for the Entity of the Service. This could be anything the customer wants, an email, a phone number, a Twitter handle, a site username, etc.



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

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

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

Instance Method Details

#create(factor_type: nil) ⇒ AccessTokenInstance

Retrieve a single page of AccessTokenInstance records from the API. Request is executed immediately.

Parameters:

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

    The Type of this Factor. eg. push

Returns:



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

def create(factor_type: nil)
  data = Twilio::Values.of({'FactorType' => factor_type, })

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

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

#to_sObject

Provide a user friendly representation



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

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