15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/noticed/delivery_method.rb', line 15
def perform(delivery_method_name, notification, recipient: nil, params: {}, overrides: {})
if notification.is_a? String
@notification = notification.constantize.new_with_params(recipient, params)
@event = @notification.event
else
@notification = notification
@event = notification.event
end
@config = event.delivery_methods.fetch(delivery_method_name).config.merge(overrides)
return false if config.has_key?(:if) && !evaluate_option(:if)
return false if config.has_key?(:unless) && evaluate_option(:unless)
run_callbacks :deliver do
deliver
end
end
|