Class: Twilio::REST::Conversations::V1::ConfigurationContext::WebhookContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Conversations::V1::ConfigurationContext::WebhookContext
- Defined in:
- lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb
Instance Method Summary collapse
-
#fetch ⇒ WebhookInstance
Fetch the WebhookInstance.
-
#fetch_with_metadata ⇒ WebhookInstance
Fetch the WebhookInstanceMetadata.
-
#initialize(version) ⇒ WebhookContext
constructor
Initialize the WebhookContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(method: :unset, filters: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, target: :unset) ⇒ WebhookInstance
Update the WebhookInstance.
-
#update_with_metadata(method: :unset, filters: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, target: :unset) ⇒ WebhookInstance
Update the WebhookInstanceMetadata.
Constructor Details
#initialize(version) ⇒ WebhookContext
Initialize the WebhookContext
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 51 def initialize(version) super(version) # Path Solution @solution = { } @uri = "/Configuration/Webhooks" end |
Instance Method Details
#fetch ⇒ WebhookInstance
Fetch the WebhookInstance
64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 64 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) WebhookInstance.new( @version, payload, ) end |
#fetch_with_metadata ⇒ WebhookInstance
Fetch the WebhookInstanceMetadata
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 82 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) webhook_instance = WebhookInstance.new( @version, response.body, ) WebhookInstanceMetadata.new( @version, webhook_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
193 194 195 196 |
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 193 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.WebhookContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
186 187 188 189 |
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 186 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.WebhookContext #{context}>" end |
#update(method: :unset, filters: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, target: :unset) ⇒ WebhookInstance
Update the WebhookInstance
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 111 def update( method: :unset, filters: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, target: :unset ) data = Twilio::Values.of({ 'Method' => method, 'Filters' => Twilio.serialize_list(filters) { |e| e }, 'PreWebhookUrl' => pre_webhook_url, 'PostWebhookUrl' => post_webhook_url, 'Target' => target, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) WebhookInstance.new( @version, payload, ) end |
#update_with_metadata(method: :unset, filters: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, target: :unset) ⇒ WebhookInstance
Update the WebhookInstanceMetadata
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 148 def ( method: :unset, filters: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, target: :unset ) data = Twilio::Values.of({ 'Method' => method, 'Filters' => Twilio.serialize_list(filters) { |e| e }, 'PreWebhookUrl' => pre_webhook_url, 'PostWebhookUrl' => post_webhook_url, 'Target' => target, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) webhook_instance = WebhookInstance.new( @version, response.body, ) WebhookInstanceMetadata.new( @version, webhook_instance, response.headers, response.status_code ) end |