Module: Ckeditor::Webhook

Defined in:
lib/ckeditor/webhook.rb,
lib/ckeditor/webhook/event.rb,
lib/ckeditor/webhook/version.rb

Defined Under Namespace

Classes: Error, Event, InvalidPayload, SignatureVerificationError

Constant Summary collapse

VERSION =
"0.3.0"

Class Method Summary collapse

Class Method Details

.construct_event(secret:, payload:, signature:, timestamp:, url:, method: "POST") ⇒ Event

Returns an Event if the webhook signature is valid.

Raises:



28
29
30
31
32
33
34
# File 'lib/ckeditor/webhook.rb', line 28

def construct_event(secret:, payload:, signature:, timestamp:, url:, method: "POST")
  event = message(method: method, url: url, timestamp: timestamp, payload: payload)

  raise SignatureVerificationError if signature != message_signature(message: event, secret: secret)

  Event.new(parse_payload(payload))
end