Class: Twilio::REST::Webhooks::V1::RuleInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Webhooks::V1::RuleInstance
- Defined in:
- lib/twilio-ruby/rest/webhooks/v1/rule.rb
Instance Method Summary collapse
-
#context ⇒ RuleContext
Generate an instance context for the instance, the context is capable of performing various actions.
- #created_at ⇒ Time
-
#delete(idempotency_key: :unset) ⇒ Boolean
Delete the RuleInstance.
-
#description ⇒ String
Optional description of the Rule's purpose and usage.
-
#fetch ⇒ RuleInstance
Fetch the RuleInstance.
-
#friendly_name ⇒ String
Human-readable name for identification.
-
#id ⇒ String
Unique Rule identifier (TypeID/TTID format).
-
#initialize(version, payload, rule_id: nil) ⇒ RuleInstance
constructor
Initialize the RuleInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
- #match_type ⇒ String
-
#operation ⇒ Operation
Operation tracking object — poll statusUrl for completion.
-
#patch(idempotency_key: :unset, patch_rule: nil) ⇒ RuleInstance
Patch the RuleInstance.
-
#prefix ⇒ String
URL prefix to match.
-
#rule ⇒ Rule
State of the Rule resource at the time the operation was accepted (omitted for DELETE).
-
#settings ⇒ Array<SettingReference>
Settings to apply with traffic distribution (percentages must sum to 100).
-
#to_s ⇒ Object
Provide a user friendly representation.
- #updated_at ⇒ Time
-
#value ⇒ String
Exact URL to match.
Constructor Details
#initialize(version, payload, rule_id: nil) ⇒ RuleInstance
Initialize the RuleInstance
661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 661 def initialize(version, payload , rule_id: nil) apiV1Version = ApiV1Version.new version.domain, version super(apiV1Version) # Marshaled Properties @properties = { 'operation' => payload['operation'], 'rule' => payload['rule'], 'id' => payload['id'], 'friendly_name' => payload['friendly_name'], 'description' => payload['description'], 'match_type' => payload['match_type'], 'settings' => payload['settings'], 'created_at' => Twilio.deserialize_iso8601_datetime(payload['created_at']), 'updated_at' => Twilio.deserialize_iso8601_datetime(payload['updated_at']), 'prefix' => payload['prefix'], 'value' => payload['value'], } # Context @instance_context = nil @params = { 'rule_id' => rule_id || @properties['rule_id'] , } end |
Instance Method Details
#context ⇒ RuleContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
690 691 692 693 694 695 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 690 def context unless @instance_context @instance_context = RuleContext.new(@version , @params['rule_id']) end @instance_context end |
#created_at ⇒ Time
741 742 743 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 741 def created_at @properties['created_at'] end |
#delete(idempotency_key: :unset) ⇒ Boolean
Delete the RuleInstance
767 768 769 770 771 772 773 774 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 767 def delete( idempotency_key: :unset ) context.delete( idempotency_key: idempotency_key, ) end |
#description ⇒ String
Returns Optional description of the Rule's purpose and usage.
723 724 725 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 723 def description @properties['description'] end |
#fetch ⇒ RuleInstance
Fetch the RuleInstance
779 780 781 782 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 779 def fetch context.fetch end |
#friendly_name ⇒ String
Returns Human-readable name for identification.
717 718 719 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 717 def friendly_name @properties['friendly_name'] end |
#id ⇒ String
Returns Unique Rule identifier (TypeID/TTID format).
711 712 713 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 711 def id @properties['id'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
809 810 811 812 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 809 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Webhooks.V1.RuleInstance #{values}>" end |
#match_type ⇒ String
729 730 731 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 729 def match_type @properties['match_type'] end |
#operation ⇒ Operation
Returns Operation tracking object — poll statusUrl for completion.
699 700 701 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 699 def operation @properties['operation'] end |
#patch(idempotency_key: :unset, patch_rule: nil) ⇒ RuleInstance
Patch the RuleInstance
789 790 791 792 793 794 795 796 797 798 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 789 def patch( idempotency_key: :unset, patch_rule: nil ) context.patch( idempotency_key: idempotency_key, patch_rule: patch_rule, ) end |
#prefix ⇒ String
Returns URL prefix to match. Must be unique - only one rule per prefix allowed. Example: 'https://api.example.com/webhooks/'.
753 754 755 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 753 def prefix @properties['prefix'] end |
#rule ⇒ Rule
Returns State of the Rule resource at the time the operation was accepted (omitted for DELETE).
705 706 707 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 705 def rule @properties['rule'] end |
#settings ⇒ Array<SettingReference>
Returns Settings to apply with traffic distribution (percentages must sum to 100).
735 736 737 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 735 def settings @properties['settings'] end |
#to_s ⇒ Object
Provide a user friendly representation
802 803 804 805 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 802 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Webhooks.V1.RuleInstance #{values}>" end |
#updated_at ⇒ Time
747 748 749 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 747 def updated_at @properties['updated_at'] end |
#value ⇒ String
Returns Exact URL to match. Must be unique - only one rule per value allowed. Example: 'https://api.example.com/webhooks/voice/incoming'.
759 760 761 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 759 def value @properties['value'] end |