Class: SquareEvent::Webhook
- Inherits:
-
Object
- Object
- SquareEvent::Webhook
- Defined in:
- lib/square_event/webhook.rb
Defined Under Namespace
Modules: Signature
Class Method Summary collapse
-
.construct_event(payload, signature, secret, notification_url, environment, timestamp) ⇒ Object
Initializes an webook Event object from a JSON payload.
Class Method Details
.construct_event(payload, signature, secret, notification_url, environment, timestamp) ⇒ Object
Initializes an webook Event object from a JSON payload.
TODO: raise JSON::ParserError if the payload is not valid JSON, or SignatureVerificationError if the signature verification fails.
8 9 10 11 12 13 14 |
# File 'lib/square_event/webhook.rb', line 8 def self.construct_event(payload, signature, secret, notification_url, environment, ) Signature.verify_header(payload, signature, secret, notification_url) data = JSON.parse(payload, symbolize_names: true) Event.construct_from(data, environment, ) end |