Class: Twilio::REST::Verify::V2::ServiceContext::WebhookContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Verify::V2::ServiceContext::WebhookContext
- Defined in:
- lib/twilio-ruby/rest/verify/v2/service/webhook.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the WebhookInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the WebhookInstanceMetadata.
-
#fetch ⇒ WebhookInstance
Fetch the WebhookInstance.
-
#fetch_with_metadata ⇒ WebhookInstance
Fetch the WebhookInstanceMetadata.
-
#initialize(version, service_sid, sid) ⇒ WebhookContext
constructor
Initialize the WebhookContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset, version: :unset) ⇒ WebhookInstance
Update the WebhookInstance.
-
#update_with_metadata(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset, version: :unset) ⇒ WebhookInstance
Update the WebhookInstanceMetadata.
Constructor Details
#initialize(version, service_sid, sid) ⇒ WebhookContext
Initialize the WebhookContext
244 245 246 247 248 249 250 251 252 253 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 244 def initialize(version, service_sid, sid) super(version) # Path Solution @solution = { service_sid: service_sid, sid: sid, } @uri = "/Services/#{@solution[:service_sid]}/Webhooks/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the WebhookInstance
257 258 259 260 261 262 263 264 265 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 257 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#delete_with_metadata ⇒ Boolean
Delete the WebhookInstanceMetadata
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 270 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) webhook_instance = WebhookInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) WebhookInstanceMetadata.new(@version, webhook_instance, response.headers, response.status_code) end |
#fetch ⇒ WebhookInstance
Fetch the WebhookInstance
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 289 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], sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ WebhookInstance
Fetch the WebhookInstanceMetadata
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 309 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, service_sid: @solution[:service_sid], sid: @solution[:sid], ) WebhookInstanceMetadata.new( @version, webhook_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
426 427 428 429 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 426 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Verify.V2.WebhookContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
419 420 421 422 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 419 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Verify.V2.WebhookContext #{context}>" end |
#update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset, version: :unset) ⇒ WebhookInstance
Update the WebhookInstance
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 340 def update( friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset, version: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'EventTypes' => Twilio.serialize_list(event_types) { |e| e }, 'WebhookUrl' => webhook_url, 'Status' => status, 'Version' => version, }) 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], sid: @solution[:sid], ) end |
#update_with_metadata(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset, version: :unset) ⇒ WebhookInstance
Update the WebhookInstanceMetadata
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 |
# File 'lib/twilio-ruby/rest/verify/v2/service/webhook.rb', line 379 def ( friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset, version: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'EventTypes' => Twilio.serialize_list(event_types) { |e| e }, 'WebhookUrl' => webhook_url, 'Status' => status, 'Version' => version, }) 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, service_sid: @solution[:service_sid], sid: @solution[:sid], ) WebhookInstanceMetadata.new( @version, webhook_instance, response.headers, response.status_code ) end |