class Twilio::REST::Verify::V2::ServiceContext::EntityContext::FactorList
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Public Class Methods
Initialize the FactorList
@param [Version] version Version
that contains the resource @param [String] service_sid The unique SID identifier of the Service. @param [String] identity Customer unique identity for the Entity owner of the
Factor. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters.
@return [FactorList] FactorList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb 27 def initialize(version, service_sid: nil, identity: nil) 28 super(version) 29 30 # Path Solution 31 @solution = {service_sid: service_sid, identity: identity} 32 @uri = "/Services/#{@solution[:service_sid]}/Entities/#{@solution[:identity]}/Factors" 33 end
Public Instance Methods
When passed a block, yields FactorInstance
records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
# File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb 73 def each 74 limits = @version.read_limits 75 76 page = self.page(page_size: limits[:page_size], ) 77 78 @version.stream(page, 79 limit: limits[:limit], 80 page_limit: limits[:page_limit]).each {|x| yield x} 81 end
Retrieve a single page of FactorInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of FactorInstance
# File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb 107 def get_page(target_url) 108 response = @version.domain.request( 109 'GET', 110 target_url 111 ) 112 FactorPage.new(@version, response, @solution) 113 end
Lists FactorInstance
records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [Integer] limit Upper limit for the number of records to return. stream()
guarantees to never return more than limit. Default is no limit
@param [Integer] page_size Number of records to fetch per request, when
not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000)
@return [Array] Array of up to limit results
# File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb 46 def list(limit: nil, page_size: nil) 47 self.stream(limit: limit, page_size: page_size).entries 48 end
Retrieve a single page of FactorInstance
records from the API. Request
is executed immediately. @param [String] page_token PageToken provided by the API @param [Integer] page_number Page
Number, this value is simply for client state @param [Integer] page_size Number of records to return, defaults to 50 @return [Page] Page
of FactorInstance
# File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb 90 def page(page_token: :unset, page_number: :unset, page_size: :unset) 91 params = Twilio::Values.of({ 92 'PageToken' => page_token, 93 'Page' => page_number, 94 'PageSize' => page_size, 95 }) 96 97 response = @version.page('GET', @uri, params: params) 98 99 FactorPage.new(@version, response, @solution) 100 end
Streams FactorInstance
records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [Integer] limit Upper limit for the number of records to return. stream()
guarantees to never return more than limit. Default is no limit.
@param [Integer] page_size Number of records to fetch per request, when
not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000)
@return [Enumerable] Enumerable that will yield up to limit results
# File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb 61 def stream(limit: nil, page_size: nil) 62 limits = @version.read_limits(limit, page_size) 63 64 page = self.page(page_size: limits[:page_size], ) 65 66 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 67 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb 117 def to_s 118 '#<Twilio.Verify.V2.FactorList>' 119 end