Class: Twilio::REST::IpMessaging::V2::ServiceContext::ChannelContext::WebhookContext
- Inherits:
-
Twilio::REST::InstanceContext
- Object
- Twilio::REST::InstanceContext
- Twilio::REST::IpMessaging::V2::ServiceContext::ChannelContext::WebhookContext
- Defined in:
- lib/twilio-ruby/rest/ip_messaging/v2/service/channel/webhook.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the WebhookInstance.
-
#fetch ⇒ WebhookInstance
Fetch the WebhookInstance.
-
#initialize(version, service_sid, channel_sid, sid) ⇒ WebhookContext
constructor
Initialize the WebhookContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(configuration_url: :unset, configuration_method: :unset, configuration_filters: :unset, configuration_triggers: :unset, configuration_flow_sid: :unset, configuration_retry_count: :unset) ⇒ WebhookInstance
Update the WebhookInstance.
Constructor Details
#initialize(version, service_sid, channel_sid, sid) ⇒ WebhookContext
Initialize the WebhookContext
186 187 188 189 190 191 192 193 194 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/channel/webhook.rb', line 186 def initialize(version, service_sid, channel_sid, sid) super(version) # Path Solution @solution = { service_sid: service_sid, channel_sid: channel_sid, sid: sid, } @uri = "/Services/#{@solution[:service_sid]}/Channels/#{@solution[:channel_sid]}/Webhooks/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the WebhookInstance
198 199 200 201 202 203 204 205 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/channel/webhook.rb', line 198 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ WebhookInstance
Fetch the WebhookInstance
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/channel/webhook.rb', line 210 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) WebhookInstance.new( @version, payload, service_sid: @solution[:service_sid], channel_sid: @solution[:channel_sid], sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
281 282 283 284 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/channel/webhook.rb', line 281 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.IpMessaging.V2.WebhookContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
274 275 276 277 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/channel/webhook.rb', line 274 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.IpMessaging.V2.WebhookContext #{context}>" end |
#update(configuration_url: :unset, configuration_method: :unset, configuration_filters: :unset, configuration_triggers: :unset, configuration_flow_sid: :unset, configuration_retry_count: :unset) ⇒ WebhookInstance
Update the WebhookInstance
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/channel/webhook.rb', line 237 def update( configuration_url: :unset, configuration_method: :unset, configuration_filters: :unset, configuration_triggers: :unset, configuration_flow_sid: :unset, configuration_retry_count: :unset ) data = Twilio::Values.of({ 'Configuration.Url' => configuration_url, 'Configuration.Method' => configuration_method, 'Configuration.Filters' => Twilio.serialize_list(configuration_filters) { |e| e }, 'Configuration.Triggers' => Twilio.serialize_list(configuration_triggers) { |e| e }, 'Configuration.FlowSid' => configuration_flow_sid, 'Configuration.RetryCount' => configuration_retry_count, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) WebhookInstance.new( @version, payload, service_sid: @solution[:service_sid], channel_sid: @solution[:channel_sid], sid: @solution[:sid], ) end |