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

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

Public Class Methods

new(version, payload, service_sid: nil, identity: nil, sid: nil) click to toggle source

Initialize the FactorInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] service_sid The unique SID identifier of the Service. @param [String] identity 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.

@param [String] sid A 34 character string that uniquely identifies this Factor. @return [FactorInstance] FactorInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb
275 def initialize(version, payload, service_sid: nil, identity: nil, sid: nil)
276   super(version)
277 
278   # Marshaled Properties
279   @properties = {
280       'sid' => payload['sid'],
281       'account_sid' => payload['account_sid'],
282       'service_sid' => payload['service_sid'],
283       'entity_sid' => payload['entity_sid'],
284       'identity' => payload['identity'],
285       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
286       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
287       'friendly_name' => payload['friendly_name'],
288       'status' => payload['status'],
289       'factor_type' => payload['factor_type'],
290       'config' => payload['config'],
291       'url' => payload['url'],
292   }
293 
294   # Context
295   @instance_context = nil
296   @params = {'service_sid' => service_sid, 'identity' => identity, 'sid' => sid || @properties['sid'], }
297 end

Public Instance Methods

account_sid() click to toggle source

@return [String] Account Sid.

    # File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb
323 def account_sid
324   @properties['account_sid']
325 end
config() click to toggle source

@return [Hash] Configurations for a `factor_type`.

    # File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb
377 def config
378   @properties['config']
379 end
context() click to toggle source

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [FactorContext] FactorContext for this FactorInstance

    # File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb
303 def context
304   unless @instance_context
305     @instance_context = FactorContext.new(
306         @version,
307         @params['service_sid'],
308         @params['identity'],
309         @params['sid'],
310     )
311   end
312   @instance_context
313 end
date_created() click to toggle source

@return [Time] The date this Factor was created

    # File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb
347 def date_created
348   @properties['date_created']
349 end
date_updated() click to toggle source

@return [Time] The date this Factor was updated

    # File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb
353 def date_updated
354   @properties['date_updated']
355 end
delete() click to toggle source

Delete the FactorInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb
390 def delete
391   context.delete
392 end
entity_sid() click to toggle source

@return [String] Entity Sid.

    # File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb
335 def entity_sid
336   @properties['entity_sid']
337 end
factor_type() click to toggle source

@return [factor.FactorTypes] The Type of this Factor

    # File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb
371 def factor_type
372   @properties['factor_type']
373 end
fetch() click to toggle source

Fetch the FactorInstance @return [FactorInstance] Fetched FactorInstance

    # File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb
397 def fetch
398   context.fetch
399 end
friendly_name() click to toggle source

@return [String] A human readable description of this resource.

    # File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb
359 def friendly_name
360   @properties['friendly_name']
361 end
identity() click to toggle source

@return [String] Unique external identifier of the Entity

    # File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb
341 def identity
342   @properties['identity']
343 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb
445 def inspect
446   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
447   "<Twilio.Verify.V2.FactorInstance #{values}>"
448 end
service_sid() click to toggle source

@return [String] Service Sid.

    # File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb
329 def service_sid
330   @properties['service_sid']
331 end
sid() click to toggle source

@return [String] A string that uniquely identifies this Factor.

    # File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb
317 def sid
318   @properties['sid']
319 end
status() click to toggle source

@return [factor.FactorStatuses] The Status of this Factor

    # File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb
365 def status
366   @properties['status']
367 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb
438 def to_s
439   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
440   "<Twilio.Verify.V2.FactorInstance #{values}>"
441 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) click to toggle source

Update the FactorInstance @param [String] auth_payload The optional payload needed to verify the Factor

for the first time. E.g. for a TOTP, the numeric code.

@param [String] friendly_name The new friendly name of this Factor. It can be up

to 64 characters.

@param [String] config_notification_token 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.

@param [String] config_sdk_version The Verify Push SDK version used to configure

the factor

@param [String] config_time_step 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

@param [String] config_skew The number of time-steps, past and future, that are

valid for validation of TOTP codes. Must be between 0 and 2, inclusive

@param [String] config_code_length Number of digits for generated TOTP codes.

Must be between 3 and 8, inclusive

@param [factor.TotpAlgorithms] config_alg The algorithm used to derive the TOTP

codes. Can be `sha1`, `sha256` or `sha512`

@return [FactorInstance] Updated FactorInstance

    # File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb
423 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)
424   context.update(
425       auth_payload: auth_payload,
426       friendly_name: friendly_name,
427       config_notification_token: config_notification_token,
428       config_sdk_version: config_sdk_version,
429       config_time_step: config_time_step,
430       config_skew: config_skew,
431       config_code_length: config_code_length,
432       config_alg: config_alg,
433   )
434 end
url() click to toggle source

@return [String] The URL of this resource.

    # File lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb
383 def url
384   @properties['url']
385 end