Class: Twilio::REST::Verify::V2::ServiceContext::VerificationInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, service_sid: nil, sid: nil) ⇒ VerificationInstance

Initialize the VerificationInstance

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 Verification resource.

  • sid (String) (defaults to: nil) —

    The SID of the Call resource to fetch.



438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 438

def initialize(version, payload , service_sid: nil, sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'service_sid' => payload['service_sid'],
        'account_sid' => payload['account_sid'],
        'to' => payload['to'],
        'channel' => payload['channel'],
        'status' => payload['status'],
        'valid' => payload['valid'],
        'lookup' => payload['lookup'],
        'amount' => payload['amount'],
        'payee' => payload['payee'],
        'send_code_attempts' => payload['send_code_attempts'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'sna' => payload['sna'],
        'url' => payload['url'],
    }

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

Instance Method Details

#account_sid ⇒ String

Returns The SID of the Account that created the Verification resource.

Returns:

  • (String) —

    The SID of the Account that created the Verification resource.



491
492
493
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 491

def 
    @properties['account_sid']
end

#amount ⇒ String

Returns The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.

Returns:

  • (String) —

    The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.



527
528
529
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 527

def amount
    @properties['amount']
end

#channel ⇒ Channel

Returns:

  • (Channel)


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

def channel
    @properties['channel']
end

#context ⇒ VerificationContext

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

Returns:



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

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

#date_created ⇒ Time

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

Returns:

  • (Time) —

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



545
546
547
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 545

def date_created
    @properties['date_created']
end

#date_updated ⇒ Time

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

Returns:

  • (Time) —

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



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

def date_updated
    @properties['date_updated']
end

#fetch ⇒ VerificationInstance

Fetch the VerificationInstance

Returns:



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

def fetch

    context.fetch
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



597
598
599
600
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 597

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

#lookup ⇒ Hash

Returns Information about the phone number being verified.

Returns:

  • (Hash) —

    Information about the phone number being verified.



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

def lookup
    @properties['lookup']
end

#payee ⇒ String

Returns The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.

Returns:

  • (String) —

    The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.



533
534
535
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 533

def payee
    @properties['payee']
end

#send_code_attempts ⇒ Array<Hash>

Returns An array of verification attempt objects containing the channel attempted and the channel-specific transaction SID.

Returns:

  • (Array<Hash>) —

    An array of verification attempt objects containing the channel attempted and the channel-specific transaction SID.



539
540
541
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 539

def send_code_attempts
    @properties['send_code_attempts']
end

#service_sid ⇒ String

Returns The SID of the Service the resource is associated with.

Returns:

  • (String) —

    The SID of the Service the resource is associated with.



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

def service_sid
    @properties['service_sid']
end

#sid ⇒ String

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

Returns:

  • (String) —

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



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

def sid
    @properties['sid']
end

#sna ⇒ Hash

Returns The set of fields used for a silent network auth (sna) verification. Contains a single field with the URL to be invoked to verify the phone number.

Returns:

  • (Hash) —

    The set of fields used for a silent network auth (sna) verification. Contains a single field with the URL to be invoked to verify the phone number.



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

def sna
    @properties['sna']
end

#status ⇒ String

Returns The status of the verification. Can be: pending, approved, canceled, max_attempts_reached, deleted, failed or expired.

Returns:

  • (String) —

    The status of the verification. Can be: pending, approved, canceled, max_attempts_reached, deleted, failed or expired.



509
510
511
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 509

def status
    @properties['status']
end

#to ⇒ String

Returns The phone number or email being verified. Phone numbers must be in E.164 format.

Returns:

  • (String) —

    The phone number or email being verified. Phone numbers must be in E.164 format.



497
498
499
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 497

def to
    @properties['to']
end

#to_s ⇒ Object

Provide a user friendly representation



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

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

#update(status: nil) ⇒ VerificationInstance

Update the VerificationInstance

Parameters:

  • status (Status) (defaults to: nil)

Returns:



579
580
581
582
583
584
585
586
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 579

def update(
  status: nil
)

    context.update(
        status: status, 
    )
end

#url ⇒ String

Returns The absolute URL of the Verification resource.

Returns:

  • (String) —

    The absolute URL of the Verification resource.



563
564
565
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 563

def url
    @properties['url']
end

#valid ⇒ Boolean

Returns Use "status" instead. Legacy property indicating whether the verification was successful.

Returns:

  • (Boolean) —

    Use "status" instead. Legacy property indicating whether the verification was successful.



515
516
517
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 515

def valid
    @properties['valid']
end