class Twilio::REST::Verify::V2::VerificationAttemptList

Public Class Methods

new(version) click to toggle source

Initialize the VerificationAttemptList @param [Version] version Version that contains the resource @return [VerificationAttemptList] VerificationAttemptList

Calls superclass method Twilio::REST::ListResource::new
   # File lib/twilio-ruby/rest/verify/v2/verification_attempt.rb
18 def initialize(version)
19   super(version)
20 
21   # Path Solution
22   @solution = {}
23   @uri = "/Attempts"
24 end

Public Instance Methods

each() { |x| ... } click to toggle source

When passed a block, yields VerificationAttemptInstance 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/verification_attempt.rb
87 def each
88   limits = @version.read_limits
89 
90   page = self.page(page_size: limits[:page_size], )
91 
92   @version.stream(page,
93                   limit: limits[:limit],
94                   page_limit: limits[:page_limit]).each {|x| yield x}
95 end
get_page(target_url) click to toggle source

Retrieve a single page of VerificationAttemptInstance records from the API. Request is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page of VerificationAttemptInstance

    # File lib/twilio-ruby/rest/verify/v2/verification_attempt.rb
130 def get_page(target_url)
131   response = @version.domain.request(
132       'GET',
133       target_url
134   )
135   VerificationAttemptPage.new(@version, response, @solution)
136 end
list(date_created_after: :unset, date_created_before: :unset, channel_data_to: :unset, limit: nil, page_size: nil) click to toggle source

Lists VerificationAttemptInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [Time] date_created_after Datetime filter used to query Verification

Attempts created after this datetime.

@param [Time] date_created_before Datetime filter used to query Verification

Attempts created before this datetime.

@param [String] channel_data_to Destination of a verification. Depending on the

type of channel, it could be a phone number in E.164 format or an email address.

@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/verification_attempt.rb
43 def list(date_created_after: :unset, date_created_before: :unset, channel_data_to: :unset, limit: nil, page_size: nil)
44   self.stream(
45       date_created_after: date_created_after,
46       date_created_before: date_created_before,
47       channel_data_to: channel_data_to,
48       limit: limit,
49       page_size: page_size
50   ).entries
51 end
page(date_created_after: :unset, date_created_before: :unset, channel_data_to: :unset, page_token: :unset, page_number: :unset, page_size: :unset) click to toggle source

Retrieve a single page of VerificationAttemptInstance records from the API. Request is executed immediately. @param [Time] date_created_after Datetime filter used to query Verification

Attempts created after this datetime.

@param [Time] date_created_before Datetime filter used to query Verification

Attempts created before this datetime.

@param [String] channel_data_to Destination of a verification. Depending on the

type of channel, it could be a phone number in E.164 format or an email address.

@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 VerificationAttemptInstance

    # File lib/twilio-ruby/rest/verify/v2/verification_attempt.rb
110 def page(date_created_after: :unset, date_created_before: :unset, channel_data_to: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
111   params = Twilio::Values.of({
112       'DateCreatedAfter' => Twilio.serialize_iso8601_datetime(date_created_after),
113       'DateCreatedBefore' => Twilio.serialize_iso8601_datetime(date_created_before),
114       'ChannelData.To' => channel_data_to,
115       'PageToken' => page_token,
116       'Page' => page_number,
117       'PageSize' => page_size,
118   })
119 
120   response = @version.page('GET', @uri, params: params)
121 
122   VerificationAttemptPage.new(@version, response, @solution)
123 end
stream(date_created_after: :unset, date_created_before: :unset, channel_data_to: :unset, limit: nil, page_size: nil) click to toggle source

Streams VerificationAttemptInstance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [Time] date_created_after Datetime filter used to query Verification

Attempts created after this datetime.

@param [Time] date_created_before Datetime filter used to query Verification

Attempts created before this datetime.

@param [String] channel_data_to Destination of a verification. Depending on the

type of channel, it could be a phone number in E.164 format or an email address.

@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/verification_attempt.rb
70 def stream(date_created_after: :unset, date_created_before: :unset, channel_data_to: :unset, limit: nil, page_size: nil)
71   limits = @version.read_limits(limit, page_size)
72 
73   page = self.page(
74       date_created_after: date_created_after,
75       date_created_before: date_created_before,
76       channel_data_to: channel_data_to,
77       page_size: limits[:page_size],
78   )
79 
80   @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
81 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/verify/v2/verification_attempt.rb
140 def to_s
141   '#<Twilio.Verify.V2.VerificationAttemptList>'
142 end