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

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

Overview

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

Instance Method Summary collapse

Constructor Details

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

Initialize the EntityInstance



276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 276

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, 'identity' => identity || @properties['identity'], }
end

Instance Method Details

#account_sidString



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

def 
  @properties['account_sid']
end

#challengeschallenges

Access the challenges



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

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



300
301
302
303
304
305
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 300

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

#date_createdTime



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

def date_created
  @properties['date_created']
end

#date_updatedTime



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

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the EntityInstance



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

def delete
  context.delete
end

#factorsfactors

Access the factors



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

def factors
  context.factors
end

#fetchEntityInstance

Fetch the EntityInstance



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

def fetch
  context.fetch
end

#identityString



315
316
317
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 315

def identity
  @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



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

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


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

def links
  @properties['links']
end

#service_sidString



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

def service_sid
  @properties['service_sid']
end

#sidString



309
310
311
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 309

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



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

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

#urlString



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

def url
  @properties['url']
end