class Twilio::REST::Verify::V2::ServiceList

Public Class Methods

new(version) click to toggle source

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

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

Public Instance Methods

create(friendly_name: nil, code_length: :unset, lookup_enabled: :unset, skip_sms_to_landlines: :unset, dtmf_input_required: :unset, tts_name: :unset, psd2_enabled: :unset, do_not_share_warning_enabled: :unset, custom_code_enabled: :unset, push_include_date: :unset, push_apn_credential_sid: :unset, push_fcm_credential_sid: :unset, totp_issuer: :unset, totp_time_step: :unset, totp_code_length: :unset, totp_skew: :unset) click to toggle source

Create the ServiceInstance @param [String] friendly_name A descriptive string that you create to describe

the verification service. It can be up to 30 characters long. **This value
should not contain PII.**

@param [String] code_length The length of the verification code to generate.

Must be an integer value between 4 and 10, inclusive.

@param [Boolean] lookup_enabled Whether to perform a lookup with each

verification started and return info about the phone number.

@param [Boolean] skip_sms_to_landlines Whether to skip sending SMS verifications

to landlines. Requires `lookup_enabled`.

@param [Boolean] dtmf_input_required Whether to ask the user to press a number

before delivering the verify code in a phone call.

@param [String] tts_name The name of an alternative text-to-speech service to

use in phone calls. Applies only to TTS languages.

@param [Boolean] psd2_enabled Whether to pass PSD2 transaction parameters when

starting a verification.

@param [Boolean] do_not_share_warning_enabled Whether to add a security warning

at the end of an SMS verification body. Disabled by default and applies only to
SMS. Example SMS body: `Your AppName verification code is: 1234. Don’t share
this code with anyone; our employees will never ask for the code`

@param [Boolean] custom_code_enabled Whether to allow sending verifications with

a custom code instead of a randomly generated one. Not available for all
customers.

@param [Boolean] push_include_date Optional configuration for the Push factors.

If true, include the date in the Challenge's reponse. Otherwise, the date is
omitted from the response. See
{Challenge}[https://www.twilio.com/docs/verify/api/challenge] resource’s details
parameter for more info. Default: true

@param [String] push_apn_credential_sid Optional configuration for the Push

factors. Set the APN Credential for this service. This will allow to send push
notifications to iOS devices. See {Credential
Resource}[https://www.twilio.com/docs/notify/api/credential-resource]

@param [String] push_fcm_credential_sid Optional configuration for the Push

factors. Set the FCM Credential for this service. This will allow to send push
notifications to Android devices. See {Credential
Resource}[https://www.twilio.com/docs/notify/api/credential-resource]

@param [String] totp_issuer Optional configuration for the TOTP factors. Set

TOTP Issuer for this service. This will allow to configure the issuer of the
TOTP URI. Defaults to the service friendly name if not provided.

@param [String] totp_time_step Optional configuration for the TOTP factors.

Defines how often, in seconds, are TOTP codes generated. i.e, a new TOTP code is
generated every time_step seconds. Must be between 20 and 60 seconds, inclusive.
Defaults to 30 seconds

@param [String] totp_code_length Optional configuration for the TOTP factors.

Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive.
Defaults to 6

@param [String] totp_skew Optional configuration for the TOTP factors. The

number of time-steps, past and future, that are valid for validation of TOTP
codes. Must be between 0 and 2, inclusive. Defaults to 1

@return [ServiceInstance] Created ServiceInstance

    # File lib/twilio-ruby/rest/verify/v2/service.rb
 77 def create(friendly_name: nil, code_length: :unset, lookup_enabled: :unset, skip_sms_to_landlines: :unset, dtmf_input_required: :unset, tts_name: :unset, psd2_enabled: :unset, do_not_share_warning_enabled: :unset, custom_code_enabled: :unset, push_include_date: :unset, push_apn_credential_sid: :unset, push_fcm_credential_sid: :unset, totp_issuer: :unset, totp_time_step: :unset, totp_code_length: :unset, totp_skew: :unset)
 78   data = Twilio::Values.of({
 79       'FriendlyName' => friendly_name,
 80       'CodeLength' => code_length,
 81       'LookupEnabled' => lookup_enabled,
 82       'SkipSmsToLandlines' => skip_sms_to_landlines,
 83       'DtmfInputRequired' => dtmf_input_required,
 84       'TtsName' => tts_name,
 85       'Psd2Enabled' => psd2_enabled,
 86       'DoNotShareWarningEnabled' => do_not_share_warning_enabled,
 87       'CustomCodeEnabled' => custom_code_enabled,
 88       'Push.IncludeDate' => push_include_date,
 89       'Push.ApnCredentialSid' => push_apn_credential_sid,
 90       'Push.FcmCredentialSid' => push_fcm_credential_sid,
 91       'Totp.Issuer' => totp_issuer,
 92       'Totp.TimeStep' => totp_time_step,
 93       'Totp.CodeLength' => totp_code_length,
 94       'Totp.Skew' => totp_skew,
 95   })
 96 
 97   payload = @version.create('POST', @uri, data: data)
 98 
 99   ServiceInstance.new(@version, payload, )
100 end
each() { |x| ... } click to toggle source

When passed a block, yields ServiceInstance 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.rb
140 def each
141   limits = @version.read_limits
142 
143   page = self.page(page_size: limits[:page_size], )
144 
145   @version.stream(page,
146                   limit: limits[:limit],
147                   page_limit: limits[:page_limit]).each {|x| yield x}
148 end
get_page(target_url) click to toggle source

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

    # File lib/twilio-ruby/rest/verify/v2/service.rb
174 def get_page(target_url)
175   response = @version.domain.request(
176       'GET',
177       target_url
178   )
179   ServicePage.new(@version, response, @solution)
180 end
list(limit: nil, page_size: nil) click to toggle source

Lists ServiceInstance 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.rb
113 def list(limit: nil, page_size: nil)
114   self.stream(limit: limit, page_size: page_size).entries
115 end
page(page_token: :unset, page_number: :unset, page_size: :unset) click to toggle source

Retrieve a single page of ServiceInstance 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 ServiceInstance

    # File lib/twilio-ruby/rest/verify/v2/service.rb
157 def page(page_token: :unset, page_number: :unset, page_size: :unset)
158   params = Twilio::Values.of({
159       'PageToken' => page_token,
160       'Page' => page_number,
161       'PageSize' => page_size,
162   })
163 
164   response = @version.page('GET', @uri, params: params)
165 
166   ServicePage.new(@version, response, @solution)
167 end
stream(limit: nil, page_size: nil) click to toggle source

Streams ServiceInstance 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.rb
128 def stream(limit: nil, page_size: nil)
129   limits = @version.read_limits(limit, page_size)
130 
131   page = self.page(page_size: limits[:page_size], )
132 
133   @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
134 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/verify/v2/service.rb
184 def to_s
185   '#<Twilio.Verify.V2.ServiceList>'
186 end