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
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
# File 'lib/rerout/models.rb', line 321 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?
342 343 344 |
# File 'lib/rerout/models.rb', line 342 def ==(other) other.is_a?(Webhook) && other.to_h == to_h end |
#hash ⇒ Object
347 348 349 |
# File 'lib/rerout/models.rb', line 347 def hash to_h.hash end |
#to_h ⇒ Object
338 339 340 |
# File 'lib/rerout/models.rb', line 338 def to_h ATTRS.to_h { |k| [k, public_send(k)] } end |