Class: Rerout::Models::ListWebhooksResult

Inherits:
Object
  • Object
show all
Defined in:
lib/rerout/models.rb

Overview

List of webhook endpoints plus every event type the server can deliver.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(endpoints:, event_types:) ⇒ ListWebhooksResult

Returns a new instance of ListWebhooksResult.



547
548
549
550
551
# File 'lib/rerout/models.rb', line 547

def initialize(endpoints:, event_types:)
  @endpoints = endpoints.freeze
  @event_types = event_types.freeze
  freeze
end

Instance Attribute Details

#endpointsObject (readonly)

Returns the value of attribute endpoints.



545
546
547
# File 'lib/rerout/models.rb', line 545

def endpoints
  @endpoints
end

#event_typesObject (readonly)

Returns the value of attribute event_types.



545
546
547
# File 'lib/rerout/models.rb', line 545

def event_types
  @event_types
end

Class Method Details

.from_hash(hash) ⇒ Object



553
554
555
556
557
558
# File 'lib/rerout/models.rb', line 553

def self.from_hash(hash)
  new(
    endpoints: (hash['endpoints'] || []).map { |e| Webhook.from_hash(e) },
    event_types: hash['event_types'] || []
  )
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



564
565
566
# File 'lib/rerout/models.rb', line 564

def ==(other)
  other.is_a?(ListWebhooksResult) && other.to_h == to_h
end

#hashObject



569
570
571
# File 'lib/rerout/models.rb', line 569

def hash
  to_h.hash
end

#to_hObject



560
561
562
# File 'lib/rerout/models.rb', line 560

def to_h
  { endpoints: endpoints.map(&:to_h), event_types: event_types }
end