Class: Twilio::REST::Serverless::V1::ServiceContext::EnvironmentContext::VariableContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Serverless::V1::ServiceContext::EnvironmentContext::VariableContext
- Defined in:
- lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the VariableInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the VariableInstanceMetadata.
-
#fetch ⇒ VariableInstance
Fetch the VariableInstance.
-
#fetch_with_metadata ⇒ VariableInstance
Fetch the VariableInstanceMetadata.
-
#initialize(version, service_sid, environment_sid, sid) ⇒ VariableContext
constructor
Initialize the VariableContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(key: :unset, value: :unset) ⇒ VariableInstance
Update the VariableInstance.
-
#update_with_metadata(key: :unset, value: :unset) ⇒ VariableInstance
Update the VariableInstanceMetadata.
Constructor Details
#initialize(version, service_sid, environment_sid, sid) ⇒ VariableContext
Initialize the VariableContext
238 239 240 241 242 243 244 245 246 247 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb', line 238 def initialize(version, service_sid, environment_sid, sid) super(version) # Path Solution @solution = { service_sid: service_sid, environment_sid: environment_sid, sid: sid, } @uri = "/Services/#{@solution[:service_sid]}/Environments/#{@solution[:environment_sid]}/Variables/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the VariableInstance
251 252 253 254 255 256 257 258 259 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb', line 251 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 VariableInstanceMetadata
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb', line 264 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) variable_instance = VariableInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) VariableInstanceMetadata.new(@version, variable_instance, response.headers, response.status_code) end |
#fetch ⇒ VariableInstance
Fetch the VariableInstance
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb', line 283 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) VariableInstance.new( @version, payload, service_sid: @solution[:service_sid], environment_sid: @solution[:environment_sid], sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ VariableInstance
Fetch the VariableInstanceMetadata
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb', line 304 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) variable_instance = VariableInstance.new( @version, response.body, service_sid: @solution[:service_sid], environment_sid: @solution[:environment_sid], sid: @solution[:sid], ) VariableInstanceMetadata.new( @version, variable_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
406 407 408 409 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb', line 406 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Serverless.V1.VariableContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
399 400 401 402 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb', line 399 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Serverless.V1.VariableContext #{context}>" end |
#update(key: :unset, value: :unset) ⇒ VariableInstance
Update the VariableInstance
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb', line 333 def update( key: :unset, value: :unset ) data = Twilio::Values.of({ 'Key' => key, 'Value' => value, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) VariableInstance.new( @version, payload, service_sid: @solution[:service_sid], environment_sid: @solution[:environment_sid], sid: @solution[:sid], ) end |
#update_with_metadata(key: :unset, value: :unset) ⇒ VariableInstance
Update the VariableInstanceMetadata
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb', line 364 def ( key: :unset, value: :unset ) data = Twilio::Values.of({ 'Key' => key, 'Value' => value, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) variable_instance = VariableInstance.new( @version, response.body, service_sid: @solution[:service_sid], environment_sid: @solution[:environment_sid], sid: @solution[:sid], ) VariableInstanceMetadata.new( @version, variable_instance, response.headers, response.status_code ) end |