Class: Twilio::REST::Iam::V1::ApiKeyInstance
- Inherits:
-
Twilio::REST::InstanceResource
- Object
- Twilio::REST::InstanceResource
- Twilio::REST::Iam::V1::ApiKeyInstance
- Defined in:
- lib/twilio-ruby/rest/iam/v1/api_key.rb
Instance Method Summary collapse
-
#context ⇒ ApiKeyContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#date_created ⇒ Time
The date and time in GMT that the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
-
#date_updated ⇒ Time
The date and time in GMT that the resource was last updated specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
-
#delete ⇒ Boolean
Delete the ApiKeyInstance.
-
#fetch ⇒ ApiKeyInstance
Fetch the ApiKeyInstance.
-
#friendly_name ⇒ String
The string that you assigned to describe the resource.
-
#initialize(version, payload, sid: nil) ⇒ ApiKeyInstance
constructor
Initialize the ApiKeyInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#policy ⇒ Hash
The
Policyobject is a collection that specifies the allowed Twilio permissions for the restricted key. -
#sid ⇒ String
The unique string that we created to identify the Key resource.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, policy: :unset) ⇒ ApiKeyInstance
Update the ApiKeyInstance.
Constructor Details
#initialize(version, payload, sid: nil) ⇒ ApiKeyInstance
Initialize the ApiKeyInstance
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 362 def initialize(version, payload , sid: nil) super(version) # Marshaled Properties @properties = { 'sid' => payload['sid'], 'friendly_name' => payload['friendly_name'], 'date_created' => Twilio.deserialize_rfc2822(payload['date_created']), 'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']), 'policy' => payload['policy'], } # Context @instance_context = nil @params = { 'sid' => sid || @properties['sid'] , } end |
Instance Method Details
#context ⇒ ApiKeyContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
384 385 386 387 388 389 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 384 def context unless @instance_context @instance_context = ApiKeyContext.new(@version , @params['sid']) end @instance_context end |
#date_created ⇒ Time
Returns The date and time in GMT that the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
405 406 407 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 405 def date_created @properties['date_created'] end |
#date_updated ⇒ Time
Returns The date and time in GMT that the resource was last updated specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
411 412 413 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 411 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Delete the ApiKeyInstance
424 425 426 427 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 424 def delete context.delete end |
#fetch ⇒ ApiKeyInstance
Fetch the ApiKeyInstance
432 433 434 435 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 432 def fetch context.fetch end |
#friendly_name ⇒ String
Returns The string that you assigned to describe the resource.
399 400 401 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 399 def friendly_name @properties['friendly_name'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
462 463 464 465 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 462 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Iam.V1.ApiKeyInstance #{values}>" end |
#policy ⇒ Hash
Returns The Policy object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys).
417 418 419 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 417 def policy @properties['policy'] end |
#sid ⇒ String
Returns The unique string that we created to identify the Key resource.
393 394 395 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 393 def sid @properties['sid'] end |
#to_s ⇒ Object
Provide a user friendly representation
455 456 457 458 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 455 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Iam.V1.ApiKeyInstance #{values}>" end |
#update(friendly_name: :unset, policy: :unset) ⇒ ApiKeyInstance
Update the ApiKeyInstance
442 443 444 445 446 447 448 449 450 451 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 442 def update( friendly_name: :unset, policy: :unset ) context.update( friendly_name: friendly_name, policy: policy, ) end |