Module: Castle::Core::ProcessWebhook

Defined in:
lib/castle/core/process_webhook.rb

Overview

Parses a webhook

Class Method Summary collapse

Class Method Details

.call(webhook) ⇒ Object

Checks if webhook is valid

Parameters:

  • webhook (Request)


10
11
12
13
14
15
16
# File 'lib/castle/core/process_webhook.rb', line 10

def call(webhook)
  webhook.body.read.tap do |result|
    raise Castle::ApiError, 'Invalid webhook from Castle API' if result.blank?

    Castle::Logger.call('webhook:', result.to_s)
  end
end