Class: Worldline::Connect::SDK::V1::Webhooks::WebhooksHelper
- Inherits:
-
Object
- Object
- Worldline::Connect::SDK::V1::Webhooks::WebhooksHelper
- Defined in:
- lib/worldline/connect/sdk/v1/webhooks/webhooks_helper.rb
Overview
Worldline Global Collect platform v1 webhooks Helper, Thread-safe.
Instance Method Summary collapse
-
#initialize(marshaller, secret_key_store) ⇒ WebhooksHelper
constructor
A new instance of WebhooksHelper.
-
#unmarshal(body, request_headers) ⇒ Worldline::Connect::SDK::V1::Domain::WebhooksEvent
Unmarshals the given body, while also validating it using the given request headers.
Constructor Details
#initialize(marshaller, secret_key_store) ⇒ WebhooksHelper
Returns a new instance of WebhooksHelper.
16 17 18 19 20 |
# File 'lib/worldline/connect/sdk/v1/webhooks/webhooks_helper.rb', line 16 def initialize(marshaller, secret_key_store) raise ArgumentError if marshaller.nil? @marshaller = marshaller @signature_validator = Worldline::Connect::SDK::Webhooks::SignatureValidator.new(secret_key_store) end |
Instance Method Details
#unmarshal(body, request_headers) ⇒ Worldline::Connect::SDK::V1::Domain::WebhooksEvent
Unmarshals the given body, while also validating it using the given request headers.
27 28 29 30 31 32 33 |
# File 'lib/worldline/connect/sdk/v1/webhooks/webhooks_helper.rb', line 27 def unmarshal(body, request_headers) @signature_validator.validate(body, request_headers) event = @marshaller.unmarshal(body, Worldline::Connect::SDK::V1::Domain::WebhooksEvent) validate_api_version(event) event end |