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 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) ⇒ EntityInstance

Initialize the EntityInstance

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 of the Service



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

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

#access_tokensaccess_tokens

Access the access_tokens

Returns:



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

def access_tokens
  context.access_tokens
end

#account_sidString

Returns Account Sid.

Returns:

  • (String)

    Account Sid.



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

def 
  @properties['account_sid']
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

Returns:



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

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

#date_createdTime

Returns The date this Entity was created.

Returns:

  • (Time)

    The date this Entity was created



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

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date this Entity was updated.

Returns:

  • (Time)

    The date this Entity was updated



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

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the EntityInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise



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

def delete
  context.delete
end

#factorsfactors

Access the factors

Returns:



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

def factors
  context.factors
end

#fetchEntityInstance

Fetch a EntityInstance

Returns:



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

def fetch
  context.fetch
end

#identityString

Returns Unique identity of the Entity.

Returns:

  • (String)

    Unique identity of the Entity



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

def identity
  @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



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

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

Returns Nested resource URLs.

Returns:

  • (String)

    Nested resource URLs.



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

def links
  @properties['links']
end

#service_sidString

Returns Service Sid.

Returns:

  • (String)

    Service Sid.



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

def service_sid
  @properties['service_sid']
end

#sidString

Returns A string that uniquely identifies this Entity.

Returns:

  • (String)

    A string that uniquely identifies this Entity.



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

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



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

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

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



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

def url
  @properties['url']
end