Class: Spree::Products::QueueStatusChangedWebhook

Inherits:
Object
  • Object
show all
Defined in:
app/services/spree/products/queue_status_changed_webhook.rb

Class Method Summary collapse

Class Method Details

.call(ids:, event:) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'app/services/spree/products/queue_status_changed_webhook.rb', line 4

def self.call(ids:, event:)
  return false if ids.blank? || event.blank?

  # for ActiveJob 7.1+
  if ActiveJob.respond_to?(:perform_all_later)
    jobs = ids.map { |id| Spree::Products::QueueStatusChangedWebhookJob.new(id, event) }
    ActiveJob.perform_all_later(jobs)
  else
    ids.each { |id| Spree::Products::QueueStatusChangedWebhookJob.perform_later(id, event) }
  end
end