Class: Rerout::Models::Webhook
- Inherits:
-
Object
- Object
- Rerout::Models::Webhook
- Defined in:
- lib/rerout/models.rb
Overview
A webhook endpoint registered to the project. Mirrors the server-side ‘WebhookEndpointResponse`.
Constant Summary collapse
- ATTRS =
%i[ id project_id name url events is_active payload_format created_at updated_at last_delivery_at last_success_at last_failure_at ].freeze
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(**attrs) ⇒ Webhook
constructor
A new instance of Webhook.
- #to_h ⇒ Object
Constructor Details
Class Method Details
.from_hash(hash) ⇒ Object
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 |
# File 'lib/rerout/models.rb', line 480 def self.from_hash(hash) new( id: hash['id'], project_id: hash['project_id'], name: hash['name'], url: hash['url'], events: hash['events'] || [], is_active: hash['is_active'], payload_format: hash['payload_format'], created_at: hash['created_at'], updated_at: hash['updated_at'], last_delivery_at: hash['last_delivery_at'], last_success_at: hash['last_success_at'], last_failure_at: hash['last_failure_at'] ) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
501 502 503 |
# File 'lib/rerout/models.rb', line 501 def ==(other) other.is_a?(Webhook) && other.to_h == to_h end |
#hash ⇒ Object
506 507 508 |
# File 'lib/rerout/models.rb', line 506 def hash to_h.hash end |
#to_h ⇒ Object
497 498 499 |
# File 'lib/rerout/models.rb', line 497 def to_h ATTRS.to_h { |k| [k, public_send(k)] } end |