Class: Rerout::Models::CreatedWebhook

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

Overview

Result of creating a webhook. The ‘signing_secret` (`whsec_…`) is returned once — store it now; it is never shown again.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(endpoint:, signing_secret:) ⇒ CreatedWebhook

Returns a new instance of CreatedWebhook.



357
358
359
360
361
# File 'lib/rerout/models.rb', line 357

def initialize(endpoint:, signing_secret:)
  @endpoint = endpoint
  @signing_secret = signing_secret
  freeze
end

Instance Attribute Details

#endpointObject (readonly)

Returns the value of attribute endpoint.



355
356
357
# File 'lib/rerout/models.rb', line 355

def endpoint
  @endpoint
end

#signing_secretObject (readonly)

Returns the value of attribute signing_secret.



355
356
357
# File 'lib/rerout/models.rb', line 355

def signing_secret
  @signing_secret
end

Class Method Details

.from_hash(hash) ⇒ Object



363
364
365
366
367
368
# File 'lib/rerout/models.rb', line 363

def self.from_hash(hash)
  new(
    endpoint: Webhook.from_hash(hash['endpoint'] || {}),
    signing_secret: hash['signing_secret']
  )
end

Instance Method Details

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



374
375
376
# File 'lib/rerout/models.rb', line 374

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

#hashObject



379
380
381
# File 'lib/rerout/models.rb', line 379

def hash
  to_h.hash
end

#to_hObject



370
371
372
# File 'lib/rerout/models.rb', line 370

def to_h
  { endpoint: endpoint.to_h, signing_secret: signing_secret }
end