Class: Smartpay::Requests::WebhookEndpoint
- Inherits:
-
Object
- Object
- Smartpay::Requests::WebhookEndpoint
- Includes:
- Validator
- Defined in:
- lib/smartpay/requests/webhook_endpoint.rb
Overview
WebhookEndpoint
Direct Known Subclasses
Constant Summary collapse
- REQUIREMENT_KEY_NAME =
i[url].freeze
- ALLOWED_EVENT_SUBSCRIPTIONS_VALUES =
[ "order.authorized", "order.rejected", "order.canceled", "payment.created", "refund.created", "payout.generated", "payout.paid", "coupon.created", "coupon.updated", "promotion_code.created", "promotion_code.updated", "merchant_user.created", "merchant_user.password_reset", "token.approved", "token.rejected", "token.deleted", "token.disabled", "token.enabled", "token.created", "token.used" ].freeze
Instance Attribute Summary collapse
-
#payload ⇒ Object
Returns the value of attribute payload.
Instance Method Summary collapse
- #as_hash ⇒ Object
-
#initialize(raw_payload) ⇒ WebhookEndpoint
constructor
A new instance of WebhookEndpoint.
Constructor Details
#initialize(raw_payload) ⇒ WebhookEndpoint
Returns a new instance of WebhookEndpoint.
35 36 37 |
# File 'lib/smartpay/requests/webhook_endpoint.rb', line 35 def initialize(raw_payload) @payload = raw_payload.transform_keys(&:to_sym) end |
Instance Attribute Details
#payload ⇒ Object
Returns the value of attribute payload.
9 10 11 |
# File 'lib/smartpay/requests/webhook_endpoint.rb', line 9 def payload @payload end |
Instance Method Details
#as_hash ⇒ Object
39 40 41 42 43 |
# File 'lib/smartpay/requests/webhook_endpoint.rb', line 39 def as_hash check_requirement!(REQUIREMENT_KEY_NAME) validate_event_subscription normalize_payload end |