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.
-
#delete_with_metadata ⇒ Boolean
Delete the ApiKeyInstanceMetadata.
-
#fetch ⇒ ApiKeyInstance
Fetch the ApiKeyInstance.
-
#fetch_with_metadata ⇒ ApiKeyInstance
Fetch the ApiKeyInstanceMetadata.
-
#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.
-
#update_with_metadata(friendly_name: :unset, policy: :unset) ⇒ ApiKeyInstance
Update the ApiKeyInstanceMetadata.
Constructor Details
#initialize(version, sid) ⇒ ApiKeyContext
Initialize the ApiKeyContext
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 50 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Keys/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the ApiKeyInstance
63 64 65 66 67 68 69 70 71 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 63 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#delete_with_metadata ⇒ Boolean
Delete the ApiKeyInstanceMetadata
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 76 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) apiKey_instance = ApiKeyInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) ApiKeyInstanceMetadata.new(@version, apiKey_instance, response.headers, response.status_code) end |
#fetch ⇒ ApiKeyInstance
Fetch the ApiKeyInstance
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 95 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 |
#fetch_with_metadata ⇒ ApiKeyInstance
Fetch the ApiKeyInstanceMetadata
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 114 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) api_key_instance = ApiKeyInstance.new( @version, response.body, sid: @solution[:sid], ) ApiKeyInstanceMetadata.new( @version, api_key_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
210 211 212 213 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 210 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Iam.V1.ApiKeyContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
203 204 205 206 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 203 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
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 141 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 |
#update_with_metadata(friendly_name: :unset, policy: :unset) ⇒ ApiKeyInstance
Update the ApiKeyInstanceMetadata
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/twilio-ruby/rest/iam/v1/api_key.rb', line 170 def ( 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', }) response = @version.('POST', @uri, data: data, headers: headers) api_key_instance = ApiKeyInstance.new( @version, response.body, sid: @solution[:sid], ) ApiKeyInstanceMetadata.new( @version, api_key_instance, response.headers, response.status_code ) end |