Class: WebhookInbox::Event
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- WebhookInbox::Event
- Defined in:
- app/models/webhook_inbox/event.rb
Constant Summary collapse
- STATUSES =
%w[pending processing processed failed].freeze
Instance Method Summary collapse
-
#parsed_payload ⇒ Object
parsed_payload returns the payload as a Hash regardless of how it was stored.
-
#retry! ⇒ Object
Enqueue for reprocessing.
Instance Method Details
#parsed_payload ⇒ Object
parsed_payload returns the payload as a Hash regardless of how it was stored
23 24 25 26 27 28 29 |
# File 'app/models/webhook_inbox/event.rb', line 23 def parsed_payload return payload if payload.is_a?(Hash) JSON.parse(payload) rescue JSON::ParserError {} end |
#retry! ⇒ Object
Enqueue for reprocessing. Resets status to pending.
32 33 34 35 36 |
# File 'app/models/webhook_inbox/event.rb', line 32 def retry! update!(status: "pending", error_message: nil) WebhookInbox::ProcessJob.set(queue: WebhookInbox.configuration.queue_name) .perform_later(id) end |