Class: Seam::Webhook

Inherits:
Object
  • Object
show all
Defined in:
lib/seam/webhook.rb

Instance Method Summary collapse

Constructor Details

#initialize(secret) ⇒ Webhook

Returns a new instance of Webhook.



12
13
14
# File 'lib/seam/webhook.rb', line 12

def initialize(secret)
  @webhook = Svix::Webhook.new(secret)
end

Instance Method Details

#verify(payload, headers) ⇒ Object



16
17
18
19
20
21
# File 'lib/seam/webhook.rb', line 16

def verify(payload, headers)
  normalized_headers = headers.transform_keys(&:downcase)
  res = @webhook.verify(payload, normalized_headers)

  Seam::Resources::SeamEvent.load_from_response(res)
end