Class: Twilio::REST::Verify::V2::ServiceContext::EntityContext::FactorInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the FactorInstance

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

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 534

def initialize(version, payload , service_sid: nil, identity: nil, sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'account_sid' => payload['account_sid'],
        'service_sid' => payload['service_sid'],
        'entity_sid' => payload['entity_sid'],
        'identity' => payload['identity'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'friendly_name' => payload['friendly_name'],
        'status' => payload['status'],
        'factor_type' => payload['factor_type'],
        'config' => payload['config'],
        'metadata' => payload['metadata'],
        'url' => payload['url'],
    }

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

Instance Method Details

#account_sidString

Returns The unique SID identifier of the Account.

Returns:

  • (String)

    The unique SID identifier of the Account.



579
580
581
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 579

def 
    @properties['account_sid']
end

#configHash

Returns An object that contains configurations specific to a ‘factor_type`.

Returns:

  • (Hash)

    An object that contains configurations specific to a ‘factor_type`.



633
634
635
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 633

def config
    @properties['config']
end

#contextFactorContext

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

Returns:



564
565
566
567
568
569
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 564

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

#date_createdTime

Returns The date that this Factor was created, given in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



603
604
605
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 603

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date that this Factor was updated, given in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



609
610
611
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 609

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the FactorInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



652
653
654
655
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 652

def delete

    context.delete
end

#entity_sidString

Returns The unique SID identifier of the Entity.

Returns:

  • (String)

    The unique SID identifier of the Entity.



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

def entity_sid
    @properties['entity_sid']
end

#factor_typeFactorTypes

Returns:

  • (FactorTypes)


627
628
629
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 627

def factor_type
    @properties['factor_type']
end

#fetchFactorInstance

Fetch the FactorInstance

Returns:



660
661
662
663
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 660

def fetch

    context.fetch
end

#friendly_nameString

Returns A human readable description of this resource, up to 64 characters. For a push factor, this can be the device’s name.

Returns:

  • (String)

    A human readable description of this resource, up to 64 characters. For a push factor, this can be the device’s name.



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

def friendly_name
    @properties['friendly_name']
end

#identityString

Returns Customer unique identity for the Entity owner of the Factor. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user’s UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters.

Returns:

  • (String)

    Customer unique identity for the Entity owner of the Factor. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user’s UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters.



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

def identity
    @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#metadataHash

Returns Custom metadata associated with the factor. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. ‘"Android"`. Can be up to 1024 characters in length.

Returns:

  • (Hash)

    Custom metadata associated with the factor. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. ‘"Android"`. Can be up to 1024 characters in length.



639
640
641
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 639

def 
    @properties['metadata']
end

#service_sidString

Returns The unique SID identifier of the Service.

Returns:

  • (String)

    The unique SID identifier of the Service.



585
586
587
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 585

def service_sid
    @properties['service_sid']
end

#sidString

Returns A 34 character string that uniquely identifies this Factor.

Returns:

  • (String)

    A 34 character string that uniquely identifies this Factor.



573
574
575
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 573

def sid
    @properties['sid']
end

#statusFactorStatuses

Returns:

  • (FactorStatuses)


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

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



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

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

#update(auth_payload: :unset, friendly_name: :unset, config_notification_token: :unset, config_sdk_version: :unset, config_time_step: :unset, config_skew: :unset, config_code_length: :unset, config_alg: :unset, config_notification_platform: :unset) ⇒ FactorInstance

Update the FactorInstance

Parameters:

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

    The optional payload needed to verify the Factor for the first time. E.g. for a TOTP, the numeric code.

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

    The new friendly name of this Factor. It can be up to 64 characters.

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

    For APN, the device token. For FCM, the registration token. It is used to send the push notifications. Required when ‘factor_type` is `push`. If specified, this value must be between 32 and 255 characters long.

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

    The Verify Push SDK version used to configure the factor

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

    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

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

    The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive

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

    Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive

  • config_alg (TotpAlgorithms) (defaults to: :unset)
  • config_notification_platform (String) (defaults to: :unset)

    The transport technology used to generate the Notification Token. Can be ‘apn`, `fcm` or `none`. Required when `factor_type` is `push`.

Returns:



677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 677

def update(
  auth_payload: :unset, 
  friendly_name: :unset, 
  config_notification_token: :unset, 
  config_sdk_version: :unset, 
  config_time_step: :unset, 
  config_skew: :unset, 
  config_code_length: :unset, 
  config_alg: :unset, 
  config_notification_platform: :unset
)

    context.update(
        auth_payload: auth_payload, 
        friendly_name: friendly_name, 
        config_notification_token: config_notification_token, 
        config_sdk_version: config_sdk_version, 
        config_time_step: config_time_step, 
        config_skew: config_skew, 
        config_code_length: config_code_length, 
        config_alg: config_alg, 
        config_notification_platform: config_notification_platform, 
    )
end

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



645
646
647
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 645

def url
    @properties['url']
end