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 SID of the [Account](www.twilio.com/docs/iam/api/account) that the trigger monitors.
-
#api_version ⇒ String
The API version used to create the resource.
-
#callback_method ⇒ String
The HTTP method we use to call
callback_url. -
#callback_url ⇒ String
The URL we call using the
callback_methodwhen 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 and time in GMT that the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
-
#date_fired ⇒ Time
The date and time in GMT that the trigger was last fired specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
-
#date_updated ⇒ Time
The date and time in GMT that the resource was last updated specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
-
#delete ⇒ Boolean
Delete the TriggerInstance.
-
#fetch ⇒ TriggerInstance
Fetch the TriggerInstance.
-
#friendly_name ⇒ String
The string that you assigned to describe the trigger.
-
#initialize(version, payload, account_sid: nil, sid: nil) ⇒ TriggerInstance
constructor
Initialize the TriggerInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
- #recurring ⇒ Recurring
-
#sid ⇒ String
The unique string that that we created to identify the UsageTrigger resource.
-
#to_s ⇒ Object
Provide a user friendly representation.
- #trigger_by ⇒ TriggerField
-
#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 of the resource, relative to
https://api.twilio.com. -
#usage_category ⇒ String
The usage category the trigger watches.
-
#usage_record_uri ⇒ String
The URI of the [UsageRecord](www.twilio.com/docs/usage/api/usage-record) resource this trigger watches, relative to
https://api.twilio.com.
Constructor Details
#initialize(version, payload, account_sid: nil, sid: nil) ⇒ TriggerInstance
Initialize the TriggerInstance
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 603 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
Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that the trigger monitors.
645 646 647 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 645 def account_sid @properties['account_sid'] end |
#api_version ⇒ String
Returns The API version used to create the resource.
651 652 653 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 651 def api_version @properties['api_version'] end |
#callback_method ⇒ String
Returns The HTTP method we use to call callback_url. Can be: GET or POST.
657 658 659 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 657 def callback_method @properties['callback_method'] end |
#callback_url ⇒ String
Returns The URL we call using the callback_method when the trigger fires.
663 664 665 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 663 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
636 637 638 639 640 641 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 636 def context unless @instance_context @instance_context = TriggerContext.new(@version , @params['account_sid'], @params['sid']) end @instance_context end |
#current_value ⇒ String
Returns The current value of the field the trigger is watching.
669 670 671 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 669 def current_value @properties['current_value'] end |
#date_created ⇒ Time
Returns The date and time in GMT that the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
675 676 677 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 675 def date_created @properties['date_created'] end |
#date_fired ⇒ Time
Returns The date and time in GMT that the trigger was last fired specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
681 682 683 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 681 def date_fired @properties['date_fired'] end |
#date_updated ⇒ Time
Returns The date and time in GMT that the resource was last updated specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
687 688 689 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 687 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Delete the TriggerInstance
742 743 744 745 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 742 def delete context.delete end |
#fetch ⇒ TriggerInstance
Fetch the TriggerInstance
750 751 752 753 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 750 def fetch context.fetch end |
#friendly_name ⇒ String
Returns The string that you assigned to describe the trigger.
693 694 695 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 693 def friendly_name @properties['friendly_name'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
783 784 785 786 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 783 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Api.V2010.TriggerInstance #{values}>" end |
#recurring ⇒ Recurring
699 700 701 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 699 def recurring @properties['recurring'] end |
#sid ⇒ String
Returns The unique string that that we created to identify the UsageTrigger resource.
705 706 707 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 705 def sid @properties['sid'] end |
#to_s ⇒ Object
Provide a user friendly representation
776 777 778 779 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 776 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Api.V2010.TriggerInstance #{values}>" end |
#trigger_by ⇒ TriggerField
711 712 713 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 711 def trigger_by @properties['trigger_by'] end |
#trigger_value ⇒ String
Returns The value at which the trigger will fire. Must be a positive, numeric value.
717 718 719 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 717 def trigger_value @properties['trigger_value'] end |
#update(callback_method: :unset, callback_url: :unset, friendly_name: :unset) ⇒ TriggerInstance
Update the TriggerInstance
761 762 763 764 765 766 767 768 769 770 771 772 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 761 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
Returns The URI of the resource, relative to https://api.twilio.com.
723 724 725 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 723 def uri @properties['uri'] end |
#usage_category ⇒ String
Returns The usage category the trigger watches. Must be one of the supported [usage categories](www.twilio.com/docs/usage/api/usage-record#usage-categories).
729 730 731 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 729 def usage_category @properties['usage_category'] end |
#usage_record_uri ⇒ String
Returns The URI of the [UsageRecord](www.twilio.com/docs/usage/api/usage-record) resource this trigger watches, relative to https://api.twilio.com.
735 736 737 |
# File 'lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb', line 735 def usage_record_uri @properties['usage_record_uri'] end |