Class: Twilio::REST::Verify::V2::ServiceContext::VerificationList

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

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid: nil) ⇒ VerificationList

Initialize the VerificationList

Parameters:

  • version (Version)

    Version that contains the resource



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

def initialize(version, service_sid: nil)
    super(version)
    # Path Solution
    @solution = { service_sid: service_sid }
    @uri = "/Services/#{@solution[:service_sid]}/Verifications"
    
end

Instance Method Details

#create(to: nil, channel: nil, custom_friendly_name: :unset, custom_message: :unset, send_digits: :unset, locale: :unset, custom_code: :unset, amount: :unset, payee: :unset, rate_limits: :unset, channel_configuration: :unset, app_hash: :unset, template_sid: :unset, template_custom_substitutions: :unset, device_ip: :unset, risk_check: :unset) ⇒ VerificationInstance

Create the VerificationInstance

Parameters:

  • to (String) (defaults to: nil)

    The phone number or [email](www.twilio.com/docs/verify/email) to verify. Phone numbers must be in [E.164 format](www.twilio.com/docs/glossary/what-e164).

  • channel (String) (defaults to: nil)

    The verification method to use. One of: [‘email`](www.twilio.com/docs/verify/email), `sms`, `whatsapp`, `call`, `sna` or `auto`.

  • custom_friendly_name (String) (defaults to: :unset)

    A custom user defined friendly name that overwrites the existing one in the verification message

  • custom_message (String) (defaults to: :unset)

    The text of a custom message to use for the verification.

  • send_digits (String) (defaults to: :unset)

    The digits to send after a phone call is answered, for example, to dial an extension. For more information, see the Programmable Voice documentation of [sendDigits](www.twilio.com/docs/voice/twiml/number#attributes-sendDigits).

  • locale (String) (defaults to: :unset)

    Locale will automatically resolve based on phone number country code for SMS, WhatsApp, and call channel verifications. It will fallback to English or the template’s default translation if the selected translation is not available. This parameter will override the automatic locale resolution. [See supported languages and more information here](www.twilio.com/docs/verify/supported-languages).

  • custom_code (String) (defaults to: :unset)

    A pre-generated code to use for verification. The code can be between 4 and 10 characters, inclusive.

  • amount (String) (defaults to: :unset)

    The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.

  • payee (String) (defaults to: :unset)

    The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.

  • rate_limits (Object) (defaults to: :unset)

    The custom key-value pairs of Programmable Rate Limits. Keys correspond to ‘unique_name` fields defined when [creating your Rate Limit](www.twilio.com/docs/verify/api/service-rate-limits). Associated value pairs represent values in the request that you are rate limiting on. You may include multiple Rate Limit values in each request.

  • channel_configuration (Object) (defaults to: :unset)

    [‘email`](www.twilio.com/docs/verify/email) channel configuration in json format. The fields ’from’ and ‘from_name’ are optional but if included the ‘from’ field must have a valid email address.

  • app_hash (String) (defaults to: :unset)

    Your [App Hash](developers.google.com/identity/sms-retriever/verify#computing_your_apps_hash_string) to be appended at the end of your verification SMS body. Applies only to SMS. Example SMS body: ‘<#> Your AppName verification code is: 1234 He42w354ol9`.

  • template_sid (String) (defaults to: :unset)

    The message [template](www.twilio.com/docs/verify/api/templates). If provided, will override the default template for the Service. SMS and Voice channels only.

  • template_custom_substitutions (String) (defaults to: :unset)

    A stringified JSON object in which the keys are the template’s special variables and the values are the variables substitutions.

  • device_ip (String) (defaults to: :unset)

    Strongly encouraged if using the auto channel. The IP address of the client’s device. If provided, it has to be a valid IPv4 or IPv6 address.

  • risk_check (RiskCheck) (defaults to: :unset)

Returns:



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 53

def create(
    to: nil, 
    channel: nil, 
    custom_friendly_name: :unset, 
    custom_message: :unset, 
    send_digits: :unset, 
    locale: :unset, 
    custom_code: :unset, 
    amount: :unset, 
    payee: :unset, 
    rate_limits: :unset, 
    channel_configuration: :unset, 
    app_hash: :unset, 
    template_sid: :unset, 
    template_custom_substitutions: :unset, 
    device_ip: :unset, 
    risk_check: :unset
)

    data = Twilio::Values.of({
        'To' => to,
        'Channel' => channel,
        'CustomFriendlyName' => custom_friendly_name,
        'CustomMessage' => custom_message,
        'SendDigits' => send_digits,
        'Locale' => locale,
        'CustomCode' => custom_code,
        'Amount' => amount,
        'Payee' => payee,
        'RateLimits' => Twilio.serialize_object(rate_limits),
        'ChannelConfiguration' => Twilio.serialize_object(channel_configuration),
        'AppHash' => app_hash,
        'TemplateSid' => template_sid,
        'TemplateCustomSubstitutions' => template_custom_substitutions,
        'DeviceIp' => device_ip,
        'RiskCheck' => risk_check,
    })

    payload = @version.create('POST', @uri, data: data)
    VerificationInstance.new(
        @version,
        payload,
        service_sid: @solution[:service_sid],
    )
end

#to_sObject

Provide a user friendly representation



103
104
105
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 103

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