Class: Twilio::REST::Verify::V2::ServiceContext::AccessTokenInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, service_sid: nil, sid: nil) ⇒ AccessTokenInstance

Initialize the AccessTokenInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this AccessToken resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 347

def initialize(version, payload , service_sid: nil, sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'account_sid' => payload['account_sid'],
        'service_sid' => payload['service_sid'],
        'entity_identity' => payload['entity_identity'],
        'factor_type' => payload['factor_type'],
        'factor_friendly_name' => payload['factor_friendly_name'],
        'token' => payload['token'],
        'url' => payload['url'],
        'ttl' => payload['ttl'] == nil ? payload['ttl'] : payload['ttl'].to_i,
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
    }

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

Instance Method Details

#account_sidString

Returns The unique SID identifier of the Account.

Returns:

  • (String)

    The unique SID identifier of the Account.



389
390
391
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 389

def 
    @properties['account_sid']
end

#contextAccessTokenContext

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

Returns:



374
375
376
377
378
379
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 374

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

#date_createdTime

Returns The date that this access token was created, given in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



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

def date_created
    @properties['date_created']
end

#entity_identityString

Returns The unique external identifier for the Entity of the Service.

Returns:

  • (String)

    The unique external identifier for the Entity of the Service.



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

def entity_identity
    @properties['entity_identity']
end

#factor_friendly_nameString

Returns A human readable description of this factor, up to 64 characters. For a push factor, this can be the device’s name.

Returns:

  • (String)

    A human readable description of this factor, up to 64 characters. For a push factor, this can be the device’s name.



413
414
415
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 413

def factor_friendly_name
    @properties['factor_friendly_name']
end

#factor_typeFactorTypes

Returns:

  • (FactorTypes)


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

def factor_type
    @properties['factor_type']
end

#fetchAccessTokenInstance

Fetch the AccessTokenInstance

Returns:



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

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#service_sidString

Returns The unique SID identifier of the Verify Service.

Returns:

  • (String)

    The unique SID identifier of the Verify Service.



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

def service_sid
    @properties['service_sid']
end

#sidString

Returns A 34 character string that uniquely identifies this Access Token.

Returns:

  • (String)

    A 34 character string that uniquely identifies this Access Token.



383
384
385
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 383

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



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

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

#tokenString

Returns The access token generated for enrollment, this is an encrypted json web token.

Returns:

  • (String)

    The access token generated for enrollment, this is an encrypted json web token.



419
420
421
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 419

def token
    @properties['token']
end

#ttlString

Returns How long, in seconds, the access token is valid. Max: 5 minutes.

Returns:

  • (String)

    How long, in seconds, the access token is valid. Max: 5 minutes



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

def ttl
    @properties['ttl']
end

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



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

def url
    @properties['url']
end