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

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

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid: nil, identity: nil) ⇒ NewFactorList

Initialize the NewFactorList

Parameters:

  • version (Version)

    Version that contains the resource

  • service_sid (String) (defaults to: nil)

    The unique SID identifier of the Service.

  • identity (String) (defaults to: nil)

    The unique external identifier for the Entity of the Service. This identifier should be immutable, not PII, and generated by your external system, such as your user’s UUID, GUID, or SID. This value must be between 8 and 64 characters long.



27
28
29
30
31
32
33
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb', line 27

def initialize(version, service_sid: nil, identity: nil)
  super(version)

  # Path Solution
  @solution = {service_sid: service_sid, identity: identity}
  @uri = "/Services/#{@solution[:service_sid]}/Entities/#{@solution[:identity]}/Factors"
end

Instance Method Details

#create(friendly_name: nil, factor_type: nil, binding_alg: :unset, binding_public_key: :unset, config_app_id: :unset, config_notification_platform: :unset, config_notification_token: :unset, config_sdk_version: :unset, binding_secret: :unset, config_time_step: :unset, config_skew: :unset, config_code_length: :unset, config_alg: :unset) ⇒ NewFactorInstance

Create the NewFactorInstance

Parameters:

  • friendly_name (String) (defaults to: nil)

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

  • factor_type (new_factor.FactorTypes) (defaults to: nil)

    The Type of this Factor. Currently ‘push` and `totp` are supported. For `totp` to work, you need to contact Twilio sales first to have the Verify TOTP feature enabled for your Twilio account.

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

    The algorithm used when ‘factor_type` is `push`. Algorithm supported: `ES256`

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

    The Ecdsa public key in PKIX, ASN.1 DER format encoded in Base64

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

    The ID that uniquely identifies your app in the Google or Apple store, such as ‘com.example.myapp`. Required when `factor_type` is `push`. If specified, it can be up to 100 characters long.

  • config_notification_platform (new_factor.NotificationPlatforms) (defaults to: :unset)

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

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

    For APN, the device token. For FCM the registration token. It 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

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

    The shared secret for TOTP factors encoded in Base32

  • 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. The default value is defined at the service level in the property totp.time_step. If not configured defaults to 30 seconds

  • 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. The default value is defined at the service level in the property totp.skew. If not configured defaults to 1

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

    Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. The default value is defined at the service level in the property totp.code_length. If not configured defaults to 6

  • config_alg (new_factor.TotpAlgorithms) (defaults to: :unset)

    The algorithm used to derive the TOTP codes. Can be ‘sha1`, `sha256` or `sha512`. Defaults to `sha1`

Returns:



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb', line 75

def create(friendly_name: nil, factor_type: nil, binding_alg: :unset, binding_public_key: :unset, config_app_id: :unset, config_notification_platform: :unset, config_notification_token: :unset, config_sdk_version: :unset, binding_secret: :unset, config_time_step: :unset, config_skew: :unset, config_code_length: :unset, config_alg: :unset)
  data = Twilio::Values.of({
      'FriendlyName' => friendly_name,
      'FactorType' => factor_type,
      'Binding.Alg' => binding_alg,
      'Binding.PublicKey' => binding_public_key,
      'Config.AppId' => config_app_id,
      'Config.NotificationPlatform' => config_notification_platform,
      'Config.NotificationToken' => config_notification_token,
      'Config.SdkVersion' => config_sdk_version,
      'Binding.Secret' => binding_secret,
      'Config.TimeStep' => config_time_step,
      'Config.Skew' => config_skew,
      'Config.CodeLength' => config_code_length,
      'Config.Alg' => config_alg,
  })

  payload = @version.create('POST', @uri, data: data)

  NewFactorInstance.new(
      @version,
      payload,
      service_sid: @solution[:service_sid],
      identity: @solution[:identity],
  )
end

#to_sObject

Provide a user friendly representation



104
105
106
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb', line 104

def to_s
  '#<Twilio.Verify.V2.NewFactorList>'
end