class Twilio::REST::Verify::V2::ServiceContext
Public Class Methods
Initialize the ServiceContext
@param [Version] version Version
that contains the resource @param [String] sid The Twilio-provided string that uniquely identifies the
Verification Service resource to fetch.
@return [ServiceContext] ServiceContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/verify/v2/service.rb 225 def initialize(version, sid) 226 super(version) 227 228 # Path Solution 229 @solution = {sid: sid, } 230 @uri = "/Services/#{@solution[:sid]}" 231 232 # Dependents 233 @verifications = nil 234 @verification_checks = nil 235 @rate_limits = nil 236 @messaging_configurations = nil 237 @entities = nil 238 @webhooks = nil 239 @access_tokens = nil 240 end
Public Instance Methods
Access the access_tokens
@return [AccessTokenList] @return [AccessTokenContext]
# File lib/twilio-ruby/rest/verify/v2/service.rb 438 def access_tokens 439 unless @access_tokens 440 @access_tokens = AccessTokenList.new(@version, service_sid: @solution[:sid], ) 441 end 442 443 @access_tokens 444 end
Delete the ServiceInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/verify/v2/service.rb 254 def delete 255 @version.delete('DELETE', @uri) 256 end
Access the entities @return [EntityList] @return [EntityContext] if identity was passed.
# File lib/twilio-ruby/rest/verify/v2/service.rb 402 def entities(identity=:unset) 403 raise ArgumentError, 'identity cannot be nil' if identity.nil? 404 405 if identity != :unset 406 return EntityContext.new(@version, @solution[:sid], identity, ) 407 end 408 409 unless @entities 410 @entities = EntityList.new(@version, service_sid: @solution[:sid], ) 411 end 412 413 @entities 414 end
Fetch the ServiceInstance
@return [ServiceInstance] Fetched ServiceInstance
# File lib/twilio-ruby/rest/verify/v2/service.rb 245 def fetch 246 payload = @version.fetch('GET', @uri) 247 248 ServiceInstance.new(@version, payload, sid: @solution[:sid], ) 249 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/verify/v2/service.rb 455 def inspect 456 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 457 "#<Twilio.Verify.V2.ServiceContext #{context}>" 458 end
Access the messaging_configurations
@return [MessagingConfigurationList] @return [MessagingConfigurationContext] if country was passed.
# File lib/twilio-ruby/rest/verify/v2/service.rb 384 def messaging_configurations(country=:unset) 385 raise ArgumentError, 'country cannot be nil' if country.nil? 386 387 if country != :unset 388 return MessagingConfigurationContext.new(@version, @solution[:sid], country, ) 389 end 390 391 unless @messaging_configurations 392 @messaging_configurations = MessagingConfigurationList.new(@version, service_sid: @solution[:sid], ) 393 end 394 395 @messaging_configurations 396 end
Access the rate_limits
@return [RateLimitList] @return [RateLimitContext] if sid was passed.
# File lib/twilio-ruby/rest/verify/v2/service.rb 366 def rate_limits(sid=:unset) 367 raise ArgumentError, 'sid cannot be nil' if sid.nil? 368 369 if sid != :unset 370 return RateLimitContext.new(@version, @solution[:sid], sid, ) 371 end 372 373 unless @rate_limits 374 @rate_limits = RateLimitList.new(@version, service_sid: @solution[:sid], ) 375 end 376 377 @rate_limits 378 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/verify/v2/service.rb 448 def to_s 449 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 450 "#<Twilio.Verify.V2.ServiceContext #{context}>" 451 end
Update the ServiceInstance
@param [String] friendly_name 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.**
@param [String] code_length The length of the verification code to generate.
Must be an integer value between 4 and 10, inclusive.
@param [Boolean] lookup_enabled Whether to perform a lookup with each
verification started and return info about the phone number.
@param [Boolean] skip_sms_to_landlines Whether to skip sending SMS verifications
to landlines. Requires `lookup_enabled`.
@param [Boolean] dtmf_input_required Whether to ask the user to press a number
before delivering the verify code in a phone call.
@param [String] tts_name The name of an alternative text-to-speech service to
use in phone calls. Applies only to TTS languages.
@param [Boolean] psd2_enabled Whether to pass PSD2 transaction parameters when
starting a verification.
@param [Boolean] do_not_share_warning_enabled Whether to add a privacy warning
at the end of an SMS. **Disabled by default and applies only for SMS.**
@param [Boolean] custom_code_enabled Whether to allow sending verifications with
a custom code instead of a randomly generated one. Not available for all customers.
@param [Boolean] push_include_date 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}[https://www.twilio.com/docs/verify/api/challenge] resource’s details parameter for more info. Default: true
@param [String] push_apn_credential_sid 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}[https://www.twilio.com/docs/notify/api/credential-resource]
@param [String] push_fcm_credential_sid 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}[https://www.twilio.com/docs/notify/api/credential-resource]
@param [String] totp_issuer Optional configuration for the TOTP factors. Set
TOTP Issuer for this service. This will allow to configure the issuer of the TOTP URI.
@param [String] totp_time_step 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
@param [String] totp_code_length Optional configuration for the TOTP factors.
Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. Defaults to 6
@param [String] totp_skew 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
@return [ServiceInstance] Updated ServiceInstance
# File lib/twilio-ruby/rest/verify/v2/service.rb 307 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) 308 data = Twilio::Values.of({ 309 'FriendlyName' => friendly_name, 310 'CodeLength' => code_length, 311 'LookupEnabled' => lookup_enabled, 312 'SkipSmsToLandlines' => skip_sms_to_landlines, 313 'DtmfInputRequired' => dtmf_input_required, 314 'TtsName' => tts_name, 315 'Psd2Enabled' => psd2_enabled, 316 'DoNotShareWarningEnabled' => do_not_share_warning_enabled, 317 'CustomCodeEnabled' => custom_code_enabled, 318 'Push.IncludeDate' => push_include_date, 319 'Push.ApnCredentialSid' => push_apn_credential_sid, 320 'Push.FcmCredentialSid' => push_fcm_credential_sid, 321 'Totp.Issuer' => totp_issuer, 322 'Totp.TimeStep' => totp_time_step, 323 'Totp.CodeLength' => totp_code_length, 324 'Totp.Skew' => totp_skew, 325 }) 326 327 payload = @version.update('POST', @uri, data: data) 328 329 ServiceInstance.new(@version, payload, sid: @solution[:sid], ) 330 end
Access the verification_checks
@return [VerificationCheckList] @return [VerificationCheckContext]
# File lib/twilio-ruby/rest/verify/v2/service.rb 354 def verification_checks 355 unless @verification_checks 356 @verification_checks = VerificationCheckList.new(@version, service_sid: @solution[:sid], ) 357 end 358 359 @verification_checks 360 end
Access the verifications @return [VerificationList] @return [VerificationContext] if sid was passed.
# File lib/twilio-ruby/rest/verify/v2/service.rb 336 def verifications(sid=:unset) 337 raise ArgumentError, 'sid cannot be nil' if sid.nil? 338 339 if sid != :unset 340 return VerificationContext.new(@version, @solution[:sid], sid, ) 341 end 342 343 unless @verifications 344 @verifications = VerificationList.new(@version, service_sid: @solution[:sid], ) 345 end 346 347 @verifications 348 end
Access the webhooks @return [WebhookList] @return [WebhookContext] if sid was passed.
# File lib/twilio-ruby/rest/verify/v2/service.rb 420 def webhooks(sid=:unset) 421 raise ArgumentError, 'sid cannot be nil' if sid.nil? 422 423 if sid != :unset 424 return WebhookContext.new(@version, @solution[:sid], sid, ) 425 end 426 427 unless @webhooks 428 @webhooks = WebhookList.new(@version, service_sid: @solution[:sid], ) 429 end 430 431 @webhooks 432 end