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

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

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.


469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 469

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'],
      'do_not_share_warning_enabled' => payload['do_not_share_warning_enabled'],
      'custom_code_enabled' => payload['custom_code_enabled'],
      'push' => payload['push'],
      'totp' => payload['totp'],
      '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

#access_tokensaccess_tokens

Access the access_tokens

Returns:


740
741
742
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 740

def access_tokens
  context.access_tokens
end

#account_sidString

Returns The SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource


517
518
519
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 517

def 
  @properties['account_sid']
end

#code_lengthString

Returns The length of the verification code.

Returns:

  • (String)

    The length of the verification code


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

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:


502
503
504
505
506
507
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 502

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

#custom_code_enabledBoolean

Returns Whether to allow sending verifications with a custom code.

Returns:

  • (Boolean)

    Whether to allow sending verifications with a custom code.


571
572
573
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 571

def custom_code_enabled
  @properties['custom_code_enabled']
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


589
590
591
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 589

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


595
596
597
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 595

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the ServiceInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


621
622
623
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 621

def delete
  context.delete
end

#do_not_share_warning_enabledBoolean

Returns Whether to add a security warning at the end of an SMS.

Returns:

  • (Boolean)

    Whether to add a security warning at the end of an SMS.


565
566
567
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 565

def do_not_share_warning_enabled
  @properties['do_not_share_warning_enabled']
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


553
554
555
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 553

def dtmf_input_required
  @properties['dtmf_input_required']
end

#entitiesentities

Access the entities

Returns:


726
727
728
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 726

def entities
  context.entities
end

#fetchServiceInstance

Fetch the ServiceInstance

Returns:


614
615
616
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 614

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


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

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation


753
754
755
756
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 753

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


607
608
609
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 607

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


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

def lookup_enabled
  @properties['lookup_enabled']
end

#messaging_configurationsmessaging_configurations

Access the messaging_configurations

Returns:


719
720
721
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 719

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


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

def psd2_enabled
  @properties['psd2_enabled']
end

#pushHash

Returns The service level configuration of factor push type.

Returns:

  • (Hash)

    The service level configuration of factor push type.


577
578
579
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 577

def push
  @properties['push']
end

#rate_limitsrate_limits

Access the rate_limits

Returns:


712
713
714
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 712

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


511
512
513
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 511

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


547
548
549
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 547

def skip_sms_to_landlines
  @properties['skip_sms_to_landlines']
end

#to_sObject

Provide a user friendly representation


746
747
748
749
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 746

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

#totpHash

Returns The service level configuration of factor TOTP type.

Returns:

  • (Hash)

    The service level configuration of factor TOTP type.


583
584
585
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 583

def totp
  @properties['totp']
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


559
560
561
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 559

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, 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) ⇒ 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 30 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.

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

    Whether to add a privacy warning at the end of an SMS. **Disabled by default and applies only for SMS.**

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

    Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers.

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

    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 resource’s details parameter for more info. Default: true

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

    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

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

    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

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

    Optional configuration for the TOTP factors. Set TOTP Issuer for this service. This will allow to configure the issuer of the TOTP URI.

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

    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

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

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

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

    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

Returns:


674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 674

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, 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)
  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,
      do_not_share_warning_enabled: do_not_share_warning_enabled,
      custom_code_enabled: custom_code_enabled,
      push_include_date: push_include_date,
      push_apn_credential_sid: push_apn_credential_sid,
      push_fcm_credential_sid: push_fcm_credential_sid,
      totp_issuer: totp_issuer,
      totp_time_step: totp_time_step,
      totp_code_length: totp_code_length,
      totp_skew: totp_skew,
  )
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource


601
602
603
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 601

def url
  @properties['url']
end

#verification_checksverification_checks

Access the verification_checks

Returns:


705
706
707
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 705

def verification_checks
  context.verification_checks
end

#verificationsverifications

Access the verifications

Returns:


698
699
700
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 698

def verifications
  context.verifications
end

#webhookswebhooks

Access the webhooks

Returns:


733
734
735
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 733

def webhooks
  context.webhooks
end