Class: Noticed::EventJob

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

Instance Method Summary collapse

Instance Method Details

#perform(event) ⇒ Object



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

def perform(event)
  # Enqueue bulk deliveries
  event.bulk_delivery_methods.each_value do |deliver_by|
    deliver_by.perform_later(event) if deliver_by.perform?(event)
  end

  # Enqueue individual deliveries
  event.notifications.each do |notification|
    event.delivery_methods.each_value do |deliver_by|
      deliver_by.perform_later(notification) if deliver_by.perform?(notification)
    end
  end
end