Class: Twilio::REST::Api::V2010::AccountContext::UsageList::TriggerInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Api::V2010::AccountContext::UsageList::TriggerInstance
- Defined in:
- lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb
Instance Method Summary collapse
-
#account_sid ⇒ String
The account this trigger monitors.
-
#api_version ⇒ String
The api_version.
-
#callback_method ⇒ String
HTTP method to use with callback_url.
-
#callback_url ⇒ String
URL Twilio will request when the trigger fires.
-
#context ⇒ TriggerContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#current_value ⇒ String
The current value of the field the trigger is watching.
-
#date_created ⇒ Time
The date this resource was created.
-
#date_fired ⇒ Time
The date the trigger was last fired.
-
#date_updated ⇒ Time
The date this resource was last updated.
-
#delete ⇒ Boolean
Deletes the TriggerInstance.
-
#fetch ⇒ TriggerInstance
Fetch a TriggerInstance.
-
#friendly_name ⇒ String
A user-specified, human-readable name for the trigger.
-
#initialize(version, payload, account_sid: nil, sid: nil) ⇒ TriggerInstance
constructor
Initialize the TriggerInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#recurring ⇒ trigger.Recurring
How this trigger recurs.
-
#sid ⇒ String
The trigger’s unique Sid.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#trigger_by ⇒ trigger.TriggerField
The field in the UsageRecord that fires the trigger.
-
#trigger_value ⇒ String
The value at which the trigger will fire.
-
#update(callback_method: :unset, callback_url: :unset, friendly_name: :unset) ⇒ TriggerInstance
Update the TriggerInstance.
-
#uri ⇒ String
The URI for this resource.
-
#usage_category ⇒ trigger.UsageCategory
The usage category the trigger watches.
-
#usage_record_uri ⇒ String
The URI of the UsageRecord this trigger is watching.
Constructor Details
#initialize(version, payload, account_sid: nil, sid: nil) ⇒ TriggerInstance
Initialize the TriggerInstance
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 317 def initialize(version, payload, account_sid: nil, sid: nil) super(version) # Marshaled Properties @properties = { 'account_sid' => payload['account_sid'], 'api_version' => payload['api_version'], 'callback_method' => payload['callback_method'], 'callback_url' => payload['callback_url'], 'current_value' => payload['current_value'], 'date_created' => Twilio.deserialize_rfc2822(payload['date_created']), 'date_fired' => Twilio.deserialize_rfc2822(payload['date_fired']), 'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']), 'friendly_name' => payload['friendly_name'], 'recurring' => payload['recurring'], 'sid' => payload['sid'], 'trigger_by' => payload['trigger_by'], 'trigger_value' => payload['trigger_value'], 'uri' => payload['uri'], 'usage_category' => payload['usage_category'], 'usage_record_uri' => payload['usage_record_uri'], } # Context @instance_context = nil @params = {'account_sid' => account_sid, 'sid' => sid || @properties['sid'], } end |
Instance Method Details
#account_sid ⇒ String
358 359 360 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 358 def account_sid @properties['account_sid'] end |
#api_version ⇒ String
364 365 366 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 364 def api_version @properties['api_version'] end |
#callback_method ⇒ String
370 371 372 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 370 def callback_method @properties['callback_method'] end |
#callback_url ⇒ String
376 377 378 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 376 def callback_url @properties['callback_url'] end |
#context ⇒ TriggerContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
349 350 351 352 353 354 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 349 def context unless @instance_context @instance_context = TriggerContext.new(@version, @params['account_sid'], @params['sid'], ) end @instance_context end |
#current_value ⇒ String
382 383 384 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 382 def current_value @properties['current_value'] end |
#date_created ⇒ Time
388 389 390 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 388 def date_created @properties['date_created'] end |
#date_fired ⇒ Time
394 395 396 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 394 def date_fired @properties['date_fired'] end |
#date_updated ⇒ Time
400 401 402 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 400 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Deletes the TriggerInstance
479 480 481 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 479 def delete context.delete end |
#fetch ⇒ TriggerInstance
Fetch a TriggerInstance
455 456 457 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 455 def fetch context.fetch end |
#friendly_name ⇒ String
406 407 408 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 406 def friendly_name @properties['friendly_name'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
492 493 494 495 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 492 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Api.V2010.TriggerInstance #{values}>" end |
#recurring ⇒ trigger.Recurring
412 413 414 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 412 def recurring @properties['recurring'] end |
#sid ⇒ String
418 419 420 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 418 def sid @properties['sid'] end |
#to_s ⇒ Object
Provide a user friendly representation
485 486 487 488 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 485 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Api.V2010.TriggerInstance #{values}>" end |
#trigger_by ⇒ trigger.TriggerField
424 425 426 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 424 def trigger_by @properties['trigger_by'] end |
#trigger_value ⇒ String
430 431 432 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 430 def trigger_value @properties['trigger_value'] end |
#update(callback_method: :unset, callback_url: :unset, friendly_name: :unset) ⇒ TriggerInstance
Update the TriggerInstance
468 469 470 471 472 473 474 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 468 def update(callback_method: :unset, callback_url: :unset, friendly_name: :unset) context.update( callback_method: callback_method, callback_url: callback_url, friendly_name: friendly_name, ) end |
#uri ⇒ String
436 437 438 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 436 def uri @properties['uri'] end |
#usage_category ⇒ trigger.UsageCategory
442 443 444 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 442 def usage_category @properties['usage_category'] end |
#usage_record_uri ⇒ String
448 449 450 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 448 def usage_record_uri @properties['usage_record_uri'] end |