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



296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 296

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



341
342
343
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 341

def 
    @properties['account_sid']
end

#challengeschallenges

Access the challenges



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

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



320
321
322
323
324
325
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 320

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

#date_createdTime



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

def date_created
    @properties['date_created']
end

#date_updatedTime



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

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the EntityInstance



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

def delete

    context.delete
end

#factorsfactors

Access the factors



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

def factors
    context.factors
end

#fetchEntityInstance

Fetch the EntityInstance



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

def fetch

    context.fetch
end

#identityString



335
336
337
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 335

def identity
    @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



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

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


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

def links
    @properties['links']
end

#new_factorsnew_factors

Access the new_factors



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

def new_factors
    context.new_factors
end

#service_sidString



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

def service_sid
    @properties['service_sid']
end

#sidString



329
330
331
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 329

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



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

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

#urlString



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

def url
    @properties['url']
end