Class: Twilio::REST::Api::V2010::AccountContext::UsageList::TriggerContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Api::V2010::AccountContext::UsageList::TriggerContext
- Defined in:
- lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the TriggerInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the TriggerInstanceMetadata.
-
#fetch ⇒ TriggerInstance
Fetch the TriggerInstance.
-
#fetch_with_metadata ⇒ TriggerInstance
Fetch the TriggerInstanceMetadata.
-
#initialize(version, account_sid, sid) ⇒ TriggerContext
constructor
Initialize the TriggerContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(callback_method: :unset, callback_url: :unset, friendly_name: :unset) ⇒ TriggerInstance
Update the TriggerInstance.
-
#update_with_metadata(callback_method: :unset, callback_url: :unset, friendly_name: :unset) ⇒ TriggerInstance
Update the TriggerInstanceMetadata.
Constructor Details
#initialize(version, account_sid, sid) ⇒ TriggerContext
Initialize the TriggerContext
281 282 283 284 285 286 287 288 289 290 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 281 def initialize(version, account_sid, sid) super(version) # Path Solution @solution = { account_sid: account_sid, sid: sid, } @uri = "/Accounts/#{@solution[:account_sid]}/Usage/Triggers/#{@solution[:sid]}.json" end |
Instance Method Details
#delete ⇒ Boolean
Delete the TriggerInstance
294 295 296 297 298 299 300 301 302 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 294 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 TriggerInstanceMetadata
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 307 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) trigger_instance = TriggerInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) TriggerInstanceMetadata.new(@version, trigger_instance, response.headers, response.status_code) end |
#fetch ⇒ TriggerInstance
Fetch the TriggerInstance
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 326 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) TriggerInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ TriggerInstance
Fetch the TriggerInstanceMetadata
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 346 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) trigger_instance = TriggerInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) TriggerInstanceMetadata.new( @version, trigger_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
451 452 453 454 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 451 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.TriggerContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
444 445 446 447 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 444 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.TriggerContext #{context}>" end |
#update(callback_method: :unset, callback_url: :unset, friendly_name: :unset) ⇒ TriggerInstance
Update the TriggerInstance
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 375 def update( callback_method: :unset, callback_url: :unset, friendly_name: :unset ) data = Twilio::Values.of({ 'CallbackMethod' => callback_method, 'CallbackUrl' => callback_url, 'FriendlyName' => friendly_name, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) TriggerInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) end |
#update_with_metadata(callback_method: :unset, callback_url: :unset, friendly_name: :unset) ⇒ TriggerInstance
Update the TriggerInstanceMetadata
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 408 def ( callback_method: :unset, callback_url: :unset, friendly_name: :unset ) data = Twilio::Values.of({ 'CallbackMethod' => callback_method, 'CallbackUrl' => callback_url, 'FriendlyName' => friendly_name, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) trigger_instance = TriggerInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) TriggerInstanceMetadata.new( @version, trigger_instance, response.headers, response.status_code ) end |