Class: Twilio::REST::Webhooks::V1::RuleContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Webhooks::V1::RuleContext
- Defined in:
- lib/twilio-ruby/rest/webhooks/v1/rule.rb
Instance Method Summary collapse
-
#delete(idempotency_key: :unset) ⇒ Boolean
Delete the RuleInstance.
-
#delete_with_metadata(idempotency_key: :unset) ⇒ Boolean
Delete the RuleInstanceMetadata.
-
#fetch ⇒ RuleInstance
Fetch the RuleInstance.
-
#fetch_with_metadata ⇒ RuleInstance
Fetch the RuleInstanceMetadata.
-
#initialize(version, rule_id) ⇒ RuleContext
constructor
Initialize the RuleContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#patch(idempotency_key: :unset, patch_rule: nil) ⇒ RuleInstance
Patch the RuleInstance.
-
#patch_with_metadata(idempotency_key: :unset, patch_rule: nil) ⇒ RuleInstance
Patch the RuleInstanceMetadata.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version, rule_id) ⇒ RuleContext
Initialize the RuleContext
346 347 348 349 350 351 352 353 354 355 356 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 346 def initialize(version, rule_id) apiV1Version = ApiV1Version.new version.domain, version super(apiV1Version) # Path Solution @solution = { rule_id: rule_id, } @uri = "/Webhooks/Rules/#{@solution[:rule_id]}" end |
Instance Method Details
#delete(idempotency_key: :unset) ⇒ Boolean
Delete the RuleInstance
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 361 def delete( idempotency_key: :unset ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'Idempotency-Key' => idempotency_key, }) response = @version.('DELETE', @uri, headers: headers) RuleInstance.new( @version, response.body, rule_id: @solution[:rule_id], ) end |
#delete_with_metadata(idempotency_key: :unset) ⇒ Boolean
Delete the RuleInstanceMetadata
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 382 def ( idempotency_key: :unset ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'Idempotency-Key' => idempotency_key, }) response = @version.('DELETE', @uri, headers: headers) rule_instance = RuleInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) RuleInstanceMetadata.new(@version, rule_instance, response.headers, response.status_code) end |
#fetch ⇒ RuleInstance
Fetch the RuleInstance
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 403 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) headers['Accept'] = '*/*' payload = @version.fetch('GET', @uri, headers: headers) RuleInstance.new( @version, payload, rule_id: @solution[:rule_id], ) end |
#fetch_with_metadata ⇒ RuleInstance
Fetch the RuleInstanceMetadata
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 422 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) headers['Accept'] = '*/*' response = @version.('GET', @uri, headers: headers) rule_instance = RuleInstance.new( @version, response.body, rule_id: @solution[:rule_id], ) RuleInstanceMetadata.new( @version, rule_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
508 509 510 511 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 508 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Webhooks.V1.RuleContext #{context}>" end |
#patch(idempotency_key: :unset, patch_rule: nil) ⇒ RuleInstance
Patch the RuleInstance
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 449 def patch( idempotency_key: :unset, patch_rule: nil ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'Idempotency-Key' => idempotency_key, }) headers['Content-Type'] = 'application/json' headers['Accept'] = '*/*' payload = @version.patch('PATCH', @uri, headers: headers, data: patch_rule.to_json) RuleInstance.new( @version, payload, rule_id: @solution[:rule_id], ) end |
#patch_with_metadata(idempotency_key: :unset, patch_rule: nil) ⇒ RuleInstance
Patch the RuleInstanceMetadata
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 473 def ( idempotency_key: :unset, patch_rule: nil ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'Idempotency-Key' => idempotency_key, }) headers['Content-Type'] = 'application/json' headers['Accept'] = '*/*' response = @version.('PATCH', @uri, headers: headers, data: patch_rule.to_json) rule_instance = RuleInstance.new( @version, response.body, rule_id: @solution[:rule_id], ) RuleInstanceMetadata.new( @version, rule_instance, response.headers, response.status_code ) end |
#to_s ⇒ Object
Provide a user friendly representation
501 502 503 504 |
# File 'lib/twilio-ruby/rest/webhooks/v1/rule.rb', line 501 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Webhooks.V1.RuleContext #{context}>" end |