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

  • service_sid (String) (defaults to: nil)

    The SID of the Service the resource is associated with.


22
23
24
25
26
27
28
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 22

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) ⇒ VerificationInstance

Create the VerificationInstance

Parameters:

  • to (String) (defaults to: nil)

    The phone number or email to verify. Phone numbers must be in E.164 format.

  • channel (String) (defaults to: nil)

    The verification method to use. Can be: `email`, `sms` or `call`.

  • 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.

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

    The locale to use for the verification SMS or call. Can be: `af`, `ar`, `ca`, `cs`, `da`, `de`, `el`, `en`, `en-GB`, `es`, `fi`, `fr`, `he`, `hi`, `hr`, `hu`, `id`, `it`, `ja`, `ko`, `ms`, `nb`, `nl`, `pl`, `pt`, `pr-BR`, `ro`, `ru`, `sv`, `th`, `tl`, `tr`, `vi`, `zh`, `zh-CN`, or `zh-HK.`

  • 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 (Hash) (defaults to: :unset)

    The custom key-value pairs of Programmable Rate Limits. Keys correspond to `unique_name` fields defined when creating your Rate Limit. 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 (Hash) (defaults to: :unset)

    `email` channel configuration in json format. Must include 'from' and 'from_name'.

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

    Your App Hash 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 SID of the custom template to be used.

Returns:


69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 69

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)
  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,
  })

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

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

#to_sObject

Provide a user friendly representation


93
94
95
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 93

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