Class: Twilio::REST::Verify::V2::ServiceContext::EntityInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the EntityInstance



312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 312

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

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

Instance Method Details

#account_sidString



357
358
359
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 357

def 
    @properties['account_sid']
end

#challengeschallenges

Access the challenges



424
425
426
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 424

def challenges
    context.challenges
end

#contextEntityContext

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



336
337
338
339
340
341
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 336

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

#date_createdTime



369
370
371
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 369

def date_created
    @properties['date_created']
end

#date_updatedTime



375
376
377
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 375

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the EntityInstance



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

def delete

    context.delete
end

#factorsfactors

Access the factors



417
418
419
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 417

def factors
    context.factors
end

#fetchEntityInstance

Fetch the EntityInstance



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

def fetch

    context.fetch
end

#identityString



351
352
353
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 351

def identity
    @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



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

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


387
388
389
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 387

def links
    @properties['links']
end

#new_factorsnew_factors

Access the new_factors



410
411
412
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 410

def new_factors
    context.new_factors
end

#service_sidString



363
364
365
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 363

def service_sid
    @properties['service_sid']
end

#sidString



345
346
347
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 345

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



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

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

#urlString



381
382
383
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 381

def url
    @properties['url']
end