Class: Noticed::EventJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/noticed/event_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(event) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/jobs/noticed/event_job.rb', line 5

def perform(event)
  # Enqueue bulk deliveries
  event.bulk_delivery_methods.each do |_, deliver_by|
    deliver_by.perform_later(event)
  end

  # Enqueue individual deliveries
  event.notifications.each do |notification|
    event.delivery_methods.each do |_, deliver_by|
      deliver_by.perform_later(notification)
    end
  end
end