Class: Twilio::REST::Authy::V1::ServiceContext::EntityContext::FactorInstance

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

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

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

  • service_sid (String) (defaults to: nil)

    The unique SID identifier of the Service.

  • identity (String) (defaults to: nil)

    Customer unique identity for the Entity owner of the Factor

  • sid (String) (defaults to: nil)

    A 34 character string that uniquely identifies this Factor.



313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 313

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'],
      'type' => payload['type'],
      'url' => payload['url'],
      'links' => payload['links'],
  }

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

Instance Method Details

#account_sidString

Returns Account Sid.

Returns:

  • (String)

    Account Sid.



361
362
363
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 361

def 
  @properties['account_sid']
end

#challengeschallenges

Access the challenges

Returns:



451
452
453
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 451

def challenges
  context.challenges
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:



341
342
343
344
345
346
347
348
349
350
351
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 341

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 this Factor was created.

Returns:

  • (Time)

    The date this Factor was created



385
386
387
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 385

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date this Factor was updated.

Returns:

  • (Time)

    The date this Factor was updated



391
392
393
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 391

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the FactorInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



428
429
430
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 428

def delete
  context.delete
end

#entity_sidString

Returns Entity Sid.

Returns:

  • (String)

    Entity Sid.



373
374
375
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 373

def entity_sid
  @properties['entity_sid']
end

#fetchFactorInstance

Fetch a FactorInstance

Returns:



435
436
437
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 435

def fetch
  context.fetch
end

#friendly_nameString

Returns A human readable description of this resource.

Returns:

  • (String)

    A human readable description of this resource.



397
398
399
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 397

def friendly_name
  @properties['friendly_name']
end

#identityString

Returns Unique identity of the Entity.

Returns:

  • (String)

    Unique identity of the Entity



379
380
381
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 379

def identity
  @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



464
465
466
467
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 464

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

Returns Nested resource URLs.

Returns:

  • (String)

    Nested resource URLs.



421
422
423
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 421

def links
  @properties['links']
end

#service_sidString

Returns Service Sid.

Returns:

  • (String)

    Service Sid.



367
368
369
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 367

def service_sid
  @properties['service_sid']
end

#sidString

Returns A string that uniquely identifies this Factor.

Returns:

  • (String)

    A string that uniquely identifies this Factor.



355
356
357
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 355

def sid
  @properties['sid']
end

#statusfactor.FactorStatus

Returns The Status of this Factor.

Returns:

  • (factor.FactorStatus)

    The Status of this Factor



403
404
405
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 403

def status
  @properties['status']
end

#to_sObject

Provide a user friendly representation



457
458
459
460
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 457

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

#typeString

Returns The Type of this Factor.

Returns:

  • (String)

    The Type of this Factor



409
410
411
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 409

def type
  @properties['type']
end

#update(auth_payload: :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.

Returns:



444
445
446
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 444

def update(auth_payload: :unset)
  context.update(auth_payload: auth_payload, )
end

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



415
416
417
# File 'lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb', line 415

def url
  @properties['url']
end