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

  • account_sid (String)

    The SID of the Account that created this Service resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1008

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'] == nil ? payload['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'],
        'default_template_sid' => payload['default_template_sid'],
        'whatsapp' => payload['whatsapp'],
        'passkeys' => payload['passkeys'],
        'verify_event_subscription_enabled' => payload['verify_event_subscription_enabled'],
        '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:



1321
1322
1323
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1321

def access_tokens
    context.access_tokens
end

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Service resource.

Returns:



1061
1062
1063
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1061

def 
    @properties['account_sid']
end

#approve_challengeapprove_challenge

Access the approve_challenge

Returns:



1307
1308
1309
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1307

def approve_challenge
    context.approve_challenge
end

#code_lengthString

Returns The length of the verification code to generate.

Returns:

  • (String)

    The length of the verification code to generate.



1073
1074
1075
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1073

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:



1046
1047
1048
1049
1050
1051
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1046

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 instead of a randomly generated one.

Returns:

  • (Boolean)

    Whether to allow sending verifications with a custom code instead of a randomly generated one.



1115
1116
1117
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1115

def custom_code_enabled
    @properties['custom_code_enabled']
end

#date_createdTime

Returns The date and time in GMT when the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



1157
1158
1159
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1157

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT when the resource was last updated specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



1163
1164
1165
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1163

def date_updated
    @properties['date_updated']
end

#default_template_sidString

Returns:

  • (String)


1133
1134
1135
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1133

def default_template_sid
    @properties['default_template_sid']
end

#deleteBoolean

Delete the ServiceInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



1182
1183
1184
1185
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1182

def delete

    context.delete
end

#do_not_share_warning_enabledBoolean

Returns 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`.

Returns:

  • (Boolean)

    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`



1109
1110
1111
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1109

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.



1097
1098
1099
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1097

def dtmf_input_required
    @properties['dtmf_input_required']
end

#entitiesentities

Access the entities

Returns:



1349
1350
1351
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1349

def entities
    context.entities
end

#fetchServiceInstance

Fetch the ServiceInstance

Returns:



1190
1191
1192
1193
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1190

def fetch

    context.fetch
end

#friendly_nameString

Returns The name that appears in the body of your verification messages. It can be up to 30 characters long and can include letters, numbers, spaces, dashes, underscores. Phone numbers, special characters or links are NOT allowed. It cannot contain more than 4 (consecutive or non-consecutive) digits. **This value should not contain PII.**.

Returns:

  • (String)

    The name that appears in the body of your verification messages. It can be up to 30 characters long and can include letters, numbers, spaces, dashes, underscores. Phone numbers, special characters or links are NOT allowed. It cannot contain more than 4 (consecutive or non-consecutive) digits. **This value should not contain PII.**



1067
1068
1069
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1067

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



1369
1370
1371
1372
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1369

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

Returns The URLs of related resources.

Returns:

  • (Hash)

    The URLs of related resources.



1175
1176
1177
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1175

def links
    @properties['links']
end

#lookup_enabledBoolean

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

Returns:

  • (Boolean)

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



1079
1080
1081
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1079

def lookup_enabled
    @properties['lookup_enabled']
end

#messaging_configurationsmessaging_configurations

Access the messaging_configurations

Returns:



1335
1336
1337
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1335

def messaging_configurations
    context.messaging_configurations
end

#new_challengenew_challenge

Access the new_challenge

Returns:



1342
1343
1344
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1342

def new_challenge
    context.new_challenge
end

#new_factorsnew_factors

Access the new_factors

Returns:



1300
1301
1302
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1300

def new_factors
    context.new_factors
end

#new_verify_factorsnew_verify_factors

Access the new_verify_factors

Returns:



1293
1294
1295
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1293

def new_verify_factors
    context.new_verify_factors
end

#passkeysHash

Returns:

  • (Hash)


1145
1146
1147
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1145

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



1085
1086
1087
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1085

def psd2_enabled
    @properties['psd2_enabled']
end

#pushHash

Returns Configurations for the Push factors (channel) created under this Service.

Returns:

  • (Hash)

    Configurations for the Push factors (channel) created under this Service.



1121
1122
1123
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1121

def push
    @properties['push']
end

#rate_limitsrate_limits

Access the rate_limits

Returns:



1356
1357
1358
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1356

def rate_limits
    context.rate_limits
end

#sidString

Returns The unique string that we created to identify the Service resource.

Returns:

  • (String)

    The unique string that we created to identify the Service resource.



1055
1056
1057
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1055

def sid
    @properties['sid']
end

#skip_sms_to_landlinesBoolean

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

Returns:

  • (Boolean)

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



1091
1092
1093
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1091

def skip_sms_to_landlines
    @properties['skip_sms_to_landlines']
end

#to_sObject

Provide a user friendly representation



1362
1363
1364
1365
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1362

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

#totpHash

Returns Configurations for the TOTP factors (channel) created under this Service.

Returns:

  • (Hash)

    Configurations for the TOTP factors (channel) created under this Service.



1127
1128
1129
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1127

def totp
    @properties['totp']
end

#tts_nameString

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

Returns:

  • (String)

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



1103
1104
1105
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1103

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, default_template_sid: :unset, whatsapp_msg_service_sid: :unset, whatsapp_from: :unset, passkeys_relying_party_id: :unset, passkeys_relying_party_name: :unset, passkeys_relying_party_origins: :unset, passkeys_authenticator_attachment: :unset, passkeys_discoverable_credentials: :unset, passkeys_user_verification: :unset, verify_event_subscription_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 32 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.

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

    Optional configuration for the Push factors. If true, include the date in the Challenge’s response. Otherwise, the date is omitted from the response. See [Challenge](www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. Deprecated do not use this parameter.

  • 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](www.twilio.com/docs/notify/api/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](www.twilio.com/docs/notify/api/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

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

    The default message [template](www.twilio.com/docs/verify/api/templates). Will be used for all SMS verifications unless explicitly overriden. SMS channel only.

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

    The SID of the [Messaging Service](www.twilio.com/docs/messaging/services) to associate with the Verification Service.

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

    The WhatsApp number to use as the sender of the verification messages. This number must be associated with the WhatsApp Message Service.

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

    The Relying Party ID for Passkeys. This is the domain of your application, e.g. ‘example.com`. It is used to identify your application when creating Passkeys.

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

    The Relying Party Name for Passkeys. This is the name of your application, e.g. ‘Example App`. It is used to identify your application when creating Passkeys.

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

    The Relying Party Origins for Passkeys. This is the origin of your application, e.g. ‘login.example.com,www.example.com`. It is used to identify your application when creating Passkeys, it can have multiple origins split by `,`.

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

    The Authenticator Attachment for Passkeys. This is the type of authenticator that will be used to create Passkeys. It can be empty or it can have the values ‘platform`, `cross-platform` or `any`.

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

    Indicates whether credentials must be discoverable by the authenticator. It can be empty or it can have the values ‘required`, `preferred` or `discouraged`.

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

    The User Verification for Passkeys. This is the type of user verification that will be used to create Passkeys. It can be empty or it can have the values ‘required`, `preferred` or `discouraged`.

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

    Whether to allow verifications from the service to reach the stream-events sinks if configured

Returns:



1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1224

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, 
  default_template_sid: :unset, 
  whatsapp_msg_service_sid: :unset, 
  whatsapp_from: :unset, 
  passkeys_relying_party_id: :unset, 
  passkeys_relying_party_name: :unset, 
  passkeys_relying_party_origins: :unset, 
  passkeys_authenticator_attachment: :unset, 
  passkeys_discoverable_credentials: :unset, 
  passkeys_user_verification: :unset, 
  verify_event_subscription_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, 
        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, 
        default_template_sid: default_template_sid, 
        whatsapp_msg_service_sid: whatsapp_msg_service_sid, 
        whatsapp_from: whatsapp_from, 
        passkeys_relying_party_id: passkeys_relying_party_id, 
        passkeys_relying_party_name: passkeys_relying_party_name, 
        passkeys_relying_party_origins: passkeys_relying_party_origins, 
        passkeys_authenticator_attachment: passkeys_authenticator_attachment, 
        passkeys_discoverable_credentials: passkeys_discoverable_credentials, 
        passkeys_user_verification: passkeys_user_verification, 
        verify_event_subscription_enabled: verify_event_subscription_enabled, 
    )
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource.



1169
1170
1171
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1169

def url
    @properties['url']
end

#verification_checksverification_checks

Access the verification_checks

Returns:



1286
1287
1288
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1286

def verification_checks
    context.verification_checks
end

#verificationsverifications

Access the verifications

Returns:



1314
1315
1316
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1314

def verifications
    context.verifications
end

#verify_event_subscription_enabledBoolean

Returns Whether to allow verifications from the service to reach the stream-events sinks if configured.

Returns:

  • (Boolean)

    Whether to allow verifications from the service to reach the stream-events sinks if configured



1151
1152
1153
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1151

def verify_event_subscription_enabled
    @properties['verify_event_subscription_enabled']
end

#webhookswebhooks

Access the webhooks

Returns:



1328
1329
1330
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1328

def webhooks
    context.webhooks
end

#whatsappHash

Returns:

  • (Hash)


1139
1140
1141
# File 'lib/twilio-ruby/rest/verify/v2/service.rb', line 1139

def whatsapp
    @properties['whatsapp']
end