Class: ActionWebhook::DeliveryJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/action_webhook/delivery_job.rb

Overview

Job responsible for delivering webhooks in the background

Instance Method Summary collapse

Instance Method Details

#perform(delivery_method, serialized_webhook) ⇒ Object

Performs the webhook delivery with the specified delivery method

Parameters:

  • delivery_method (String)

    The delivery method to call (e.g., “deliver_now”)

  • serialized_webhook (Hash)

    The serialized webhook data



12
13
14
15
16
17
18
19
20
# File 'lib/action_webhook/delivery_job.rb', line 12

def perform(delivery_method, serialized_webhook)
  # Reconstruct the webhook from serialized data
  webhook_class = serialized_webhook["webhook_class"].constantize
  webhook = webhook_class.new
  webhook.deserialize(serialized_webhook)

  # Invoke the specified delivery method
  webhook.send(delivery_method)
end