Class: Twilio::REST::Verify::V2::ServiceInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/verify/v2/service.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ ServiceInstance

Initialize the ServiceInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

    The Twilio-provided string that uniquely identifies the Verification Service resource to fetch.



361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 361

def initialize(version, payload, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'account_sid' => payload['account_sid'],
      'friendly_name' => payload['friendly_name'],
      'code_length' => payload['code_length'].to_i,
      'lookup_enabled' => payload['lookup_enabled'],
      'psd2_enabled' => payload['psd2_enabled'],
      'skip_sms_to_landlines' => payload['skip_sms_to_landlines'],
      'dtmf_input_required' => payload['dtmf_input_required'],
      'tts_name' => payload['tts_name'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'url' => payload['url'],
      'links' => payload['links'],
  }

  # Context
  @instance_context = nil
  @params = {'sid' => sid || @properties['sid'], }
end

Instance Method Details

#account_sidString

Returns The SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource



405
406
407
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 405

def 
  @properties['account_sid']
end

#code_lengthString

Returns The length of the verification code.

Returns:

  • (String)

    The length of the verification code



417
418
419
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 417

def code_length
  @properties['code_length']
end

#contextServiceContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



390
391
392
393
394
395
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 390

def context
  unless @instance_context
    @instance_context = ServiceContext.new(@version, @params['sid'], )
  end
  @instance_context
end

#date_createdTime

Returns The RFC 2822 date and time in GMT when the resource was created.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT when the resource was created



453
454
455
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 453

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The RFC 2822 date and time in GMT when the resource was last updated.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT when the resource was last updated



459
460
461
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 459

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the ServiceInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



485
486
487
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 485

def delete
  context.delete
end

#dtmf_input_requiredBoolean

Returns Whether to ask the user to press a number before delivering the verify code in a phone call.

Returns:

  • (Boolean)

    Whether to ask the user to press a number before delivering the verify code in a phone call



441
442
443
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 441

def dtmf_input_required
  @properties['dtmf_input_required']
end

#fetchServiceInstance

Fetch a ServiceInstance

Returns:



478
479
480
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 478

def fetch
  context.fetch
end

#friendly_nameString

Returns The string that you assigned to describe the verification service.

Returns:

  • (String)

    The string that you assigned to describe the verification service



411
412
413
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 411

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



556
557
558
559
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 556

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Verify.V2.ServiceInstance #{values}>"
end

Returns The URLs of related resources.

Returns:

  • (String)

    The URLs of related resources



471
472
473
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 471

def links
  @properties['links']
end

#lookup_enabledBoolean

Returns Whether to perform a lookup with each verification.

Returns:

  • (Boolean)

    Whether to perform a lookup with each verification



423
424
425
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 423

def lookup_enabled
  @properties['lookup_enabled']
end

#messaging_configurationsmessaging_configurations

Access the messaging_configurations

Returns:



543
544
545
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 543

def messaging_configurations
  context.messaging_configurations
end

#psd2_enabledBoolean

Returns Whether to pass PSD2 transaction parameters when starting a verification.

Returns:

  • (Boolean)

    Whether to pass PSD2 transaction parameters when starting a verification



429
430
431
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 429

def psd2_enabled
  @properties['psd2_enabled']
end

#rate_limitsrate_limits

Access the rate_limits

Returns:



536
537
538
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 536

def rate_limits
  context.rate_limits
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource



399
400
401
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 399

def sid
  @properties['sid']
end

#skip_sms_to_landlinesBoolean

Returns Whether to skip sending SMS verifications to landlines.

Returns:

  • (Boolean)

    Whether to skip sending SMS verifications to landlines



435
436
437
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 435

def skip_sms_to_landlines
  @properties['skip_sms_to_landlines']
end

#to_sObject

Provide a user friendly representation



549
550
551
552
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 549

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Verify.V2.ServiceInstance #{values}>"
end

#tts_nameString

Returns The name of an alternative text-to-speech service to use in phone calls.

Returns:

  • (String)

    The name of an alternative text-to-speech service to use in phone calls



447
448
449
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 447

def tts_name
  @properties['tts_name']
end

#update(friendly_name: :unset, code_length: :unset, lookup_enabled: :unset, skip_sms_to_landlines: :unset, dtmf_input_required: :unset, tts_name: :unset, psd2_enabled: :unset) ⇒ ServiceInstance

Update the ServiceInstance

Parameters:

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

    A descriptive string that you create to describe the verification service. It can be up to 64 characters long. **This value should not contain PII.**

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

    The length of the verification code to generate. Must be an integer value between 4 and 10, inclusive.

  • lookup_enabled (Boolean) (defaults to: :unset)

    Whether to perform a lookup with each verification started and return info about the phone number.

  • skip_sms_to_landlines (Boolean) (defaults to: :unset)

    Whether to skip sending SMS verifications to landlines. Requires ‘lookup_enabled`.

  • dtmf_input_required (Boolean) (defaults to: :unset)

    Whether to ask the user to press a number before delivering the verify code in a phone call.

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

    The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages.

  • psd2_enabled (Boolean) (defaults to: :unset)

    Whether to pass PSD2 transaction parameters when starting a verification.

Returns:



507
508
509
510
511
512
513
514
515
516
517
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 507

def update(friendly_name: :unset, code_length: :unset, lookup_enabled: :unset, skip_sms_to_landlines: :unset, dtmf_input_required: :unset, tts_name: :unset, psd2_enabled: :unset)
  context.update(
      friendly_name: friendly_name,
      code_length: code_length,
      lookup_enabled: lookup_enabled,
      skip_sms_to_landlines: skip_sms_to_landlines,
      dtmf_input_required: dtmf_input_required,
      tts_name: tts_name,
      psd2_enabled: psd2_enabled,
  )
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource



465
466
467
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 465

def url
  @properties['url']
end

#verification_checksverification_checks

Access the verification_checks

Returns:



529
530
531
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 529

def verification_checks
  context.verification_checks
end

#verificationsverifications

Access the verifications

Returns:



522
523
524
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 522

def verifications
  context.verifications
end