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

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



329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 329

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'],
      '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



378
379
380
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 378

def 
  @properties['account_sid']
end

#challengeschallenges

Access the challenges



477
478
479
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 477

def challenges
  context.challenges
end

#configHash



432
433
434
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 432

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



358
359
360
361
362
363
364
365
366
367
368
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 358

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

#date_createdTime



402
403
404
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 402

def date_created
  @properties['date_created']
end

#date_updatedTime



408
409
410
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 408

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the FactorInstance



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

def delete
  context.delete
end

#entity_sidString



390
391
392
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 390

def entity_sid
  @properties['entity_sid']
end

#factor_typefactor.FactorTypes



426
427
428
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 426

def factor_type
  @properties['factor_type']
end

#fetchFactorInstance

Fetch a FactorInstance



458
459
460
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 458

def fetch
  context.fetch
end

#friendly_nameString



414
415
416
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 414

def friendly_name
  @properties['friendly_name']
end

#identityString



396
397
398
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 396

def identity
  @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



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

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


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

def links
  @properties['links']
end

#service_sidString



384
385
386
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 384

def service_sid
  @properties['service_sid']
end

#sidString



372
373
374
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 372

def sid
  @properties['sid']
end

#statusfactor.FactorStatuses



420
421
422
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 420

def status
  @properties['status']
end

#to_sObject

Provide a user friendly representation



483
484
485
486
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 483

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: :unset) ⇒ FactorInstance

Update the FactorInstance



470
471
472
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 470

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

#urlString



438
439
440
# File 'lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb', line 438

def url
  @properties['url']
end