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.



388
389
390
391
392
# File 'lib/rerout/models.rb', line 388

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.



386
387
388
# File 'lib/rerout/models.rb', line 386

def endpoints
  @endpoints
end

#event_typesObject (readonly)

Returns the value of attribute event_types.



386
387
388
# File 'lib/rerout/models.rb', line 386

def event_types
  @event_types
end

Class Method Details

.from_hash(hash) ⇒ Object



394
395
396
397
398
399
# File 'lib/rerout/models.rb', line 394

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?



405
406
407
# File 'lib/rerout/models.rb', line 405

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

#hashObject



410
411
412
# File 'lib/rerout/models.rb', line 410

def hash
  to_h.hash
end

#to_hObject



401
402
403
# File 'lib/rerout/models.rb', line 401

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