Class: Twilio::REST::Iam::V1::ApiKeyContext
- Inherits:
-
Twilio::REST::InstanceContext
- Object
- Twilio::REST::InstanceContext
- Twilio::REST::Iam::V1::ApiKeyContext
- Defined in:
- lib/twilio-ruby/rest/iam/v1/api_key.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the ApiKeyInstance.
-
#fetch ⇒ ApiKeyInstance
Fetch the ApiKeyInstance.
-
#initialize(version, sid) ⇒ ApiKeyContext
constructor
Initialize the ApiKeyContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, policy: :unset) ⇒ ApiKeyInstance
Update the ApiKeyInstance.
Constructor Details
#initialize(version, sid) ⇒ ApiKeyContext
Initialize the ApiKeyContext
49 50 51 52 53 54 55 56 57 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 49 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Keys/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the ApiKeyInstance
61 62 63 64 65 66 67 68 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 61 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ ApiKeyInstance
Fetch the ApiKeyInstance
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 73 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) ApiKeyInstance.new( @version, payload, sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
128 129 130 131 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 128 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Iam.V1.ApiKeyContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
121 122 123 124 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 121 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Iam.V1.ApiKeyContext #{context}>" end |
#update(friendly_name: :unset, policy: :unset) ⇒ ApiKeyInstance
Update the ApiKeyInstance
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 94 def update( friendly_name: :unset, policy: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'Policy' => Twilio.serialize_object(policy), }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) ApiKeyInstance.new( @version, payload, sid: @solution[:sid], ) end |