Class: Twilio::REST::Accounts::V1::SecondaryAuthTokenInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload) ⇒ SecondaryAuthTokenInstance

Initialize the SecondaryAuthTokenInstance

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 SecondaryAuthToken resource.

  • sid (String)

    The SID of the Call resource to fetch.



295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb', line 295

def initialize(version, payload )
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'secondary_auth_token' => payload['secondary_auth_token'],
        'url' => payload['url'],
    }

    # Context
    @instance_context = nil
    @params = {  }
end

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that the secondary Auth Token was created for.

Returns:



326
327
328
# File 'lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb', line 326

def 
    @properties['account_sid']
end

#contextSecondaryAuthTokenContext

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

Returns:



317
318
319
320
321
322
# File 'lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb', line 317

def context
    unless @instance_context
        @instance_context = SecondaryAuthTokenContext.new(@version )
    end
    @instance_context
end

#createSecondaryAuthTokenInstance

Create the SecondaryAuthTokenInstance

Returns:



357
358
359
360
# File 'lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb', line 357

def create

    context.create
end

#date_createdTime

Returns The date and time in UTC when the resource was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



332
333
334
# File 'lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb', line 332

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in UTC when the resource was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



338
339
340
# File 'lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb', line 338

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the SecondaryAuthTokenInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



365
366
367
368
# File 'lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb', line 365

def delete

    context.delete
end

#inspectObject

Provide a detailed, user friendly representation



379
380
381
382
# File 'lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb', line 379

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

#secondary_auth_tokenString

Returns The generated secondary Auth Token that can be used to authenticate future API requests.

Returns:

  • (String)

    The generated secondary Auth Token that can be used to authenticate future API requests.



344
345
346
# File 'lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb', line 344

def secondary_auth_token
    @properties['secondary_auth_token']
end

#to_sObject

Provide a user friendly representation



372
373
374
375
# File 'lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb', line 372

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

#urlString

Returns The URI for this resource, relative to https://accounts.twilio.com.

Returns:

  • (String)

    The URI for this resource, relative to https://accounts.twilio.com



350
351
352
# File 'lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb', line 350

def url
    @properties['url']
end