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.



262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb', line 262

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_sid ⇒ String

Returns The SID of the Account that the secondary Auth Token was created for.

Returns:

  • (String) —

    The SID of the Account that the secondary Auth Token was created for.



293
294
295
# File 'lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb', line 293

def 
    @properties['account_sid']
end

#context ⇒ SecondaryAuthTokenContext

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

Returns:



284
285
286
287
288
289
# File 'lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb', line 284

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

#create(suppress_email_notification: :unset) ⇒ SecondaryAuthTokenInstance

Create the SecondaryAuthTokenInstance

Parameters:

  • suppress_email_notification (Boolean) (defaults to: :unset) —

    Whether to suppress the email notification that Twilio sends to the owners and administrators of the account about this Auth Token change. Defaults to false, so Twilio sends the email. Set to true when rotating Auth Tokens across many subaccounts.

Returns:



325
326
327
328
329
330
331
332
# File 'lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb', line 325

def create(
  suppress_email_notification: :unset
)

    context.create(
        suppress_email_notification: suppress_email_notification, 
    )
end

#date_created ⇒ Time

Returns The date and time in UTC when the resource was created specified in ISO 8601 format.

Returns:

  • (Time) —

    The date and time in UTC when the resource was created specified in ISO 8601 format.



299
300
301
# File 'lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb', line 299

def date_created
    @properties['date_created']
end

#date_updated ⇒ Time

Returns The date and time in UTC when the resource was last updated specified in ISO 8601 format.

Returns:

  • (Time) —

    The date and time in UTC when the resource was last updated specified in ISO 8601 format.



305
306
307
# File 'lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb', line 305

def date_updated
    @properties['date_updated']
end

#delete(suppress_email_notification: :unset) ⇒ Boolean

Delete the SecondaryAuthTokenInstance

Parameters:

  • suppress_email_notification (Boolean) (defaults to: :unset) —

    Whether to suppress the email notification that Twilio sends to the owners and administrators of the account about this Auth Token change. Defaults to false, so Twilio sends the email. Set to true when rotating Auth Tokens across many subaccounts.

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



338
339
340
341
342
343
344
345
# File 'lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb', line 338

def delete(
  suppress_email_notification: :unset
)

    context.delete(
        suppress_email_notification: suppress_email_notification, 
    )
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



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

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

#secondary_auth_token ⇒ String

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.



311
312
313
# File 'lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb', line 311

def secondary_auth_token
    @properties['secondary_auth_token']
end

#to_s ⇒ Object

Provide a user friendly representation



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

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

#url ⇒ String

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



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

def url
    @properties['url']
end