Class: Noticed::DeliveryMethods::Email

Inherits:
Noticed::DeliveryMethod show all
Defined in:
lib/noticed/delivery_methods/email.rb

Instance Attribute Summary

Attributes inherited from Noticed::DeliveryMethod

#config, #event, #notification

Instance Method Summary collapse

Methods inherited from Noticed::DeliveryMethod

#evaluate_option, #fetch_constant, #perform

Methods included from ApiClient

#post_request

Instance Method Details

#deliverObject



6
7
8
9
10
11
12
# File 'lib/noticed/delivery_methods/email.rb', line 6

def deliver
  mailer = fetch_constant(:mailer)
  email = evaluate_option(:method)
  args = evaluate_option(:args) || []
  mail = mailer.with(params).send(email, *args)
  (!!evaluate_option(:enqueue)) ? mail.deliver_later : mail.deliver_now
end

#paramsObject



14
15
16
17
18
19
20
# File 'lib/noticed/delivery_methods/email.rb', line 14

def params
  (evaluate_option(:params) || notification&.params || {}).merge(
    notification: notification,
    record: notification&.record,
    recipient: notification&.recipient
  )
end