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
230 231 232 233 234 235 236 237 238 239 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb', line 230 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
243 244 245 246 247 248 249 250 251 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb', line 243 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
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb', line 256 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
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb', line 275 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
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb', line 296 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
398 399 400 401 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb', line 398 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Serverless.V1.VariableContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
391 392 393 394 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb', line 391 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
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb', line 325 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
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb', line 356 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 |