Module: DigiwinDsp::Webhooks
- Defined in:
- lib/digiwin_dsp/webhooks.rb,
lib/digiwin_dsp/webhooks/event.rb,
lib/digiwin_dsp/webhooks/invoice_update.rb,
lib/digiwin_dsp/webhooks/inventory_update.rb,
lib/digiwin_dsp/webhooks/logistics_update.rb
Overview
Inbound webhook payload parsers for events DSP pushes to your Rails app after you register a callback URL via ‘Resources::WebhookSubscription`.
⚠️ DSP does NOT sign these requests — there is no HMAC header. Defend the callback endpoint with HTTPS-only, an unguessable URL path, and (if possible) an IP allowlist for DSP’s egress range.
Defined Under Namespace
Classes: Event, InventoryUpdate, InvoiceUpdate, LogisticsUpdate, ParseError
Constant Summary collapse
- ACTION_REGISTRY =
action string => constant name (lazy resolution via const_get so this module file doesn’t force-load the per-event classes at boot).
{ "product/inventory_update" => :InventoryUpdate, "wms/logistics/package/update" => :LogisticsUpdate, "invoice/update" => :InvoiceUpdate }.freeze
Class Method Summary collapse
Class Method Details
.parse(raw_body, action:) ⇒ Object
24 25 26 27 28 |
# File 'lib/digiwin_dsp/webhooks.rb', line 24 def self.parse(raw_body, action:) sym = ACTION_REGISTRY[action] || raise(ParseError, "unknown action #{action.inspect}; expected one of #{ACTION_REGISTRY.keys.inspect}") const_get(sym).parse(raw_body) end |