Class: Courrier::Email::DeliveryJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/courrier/email/delivery_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(email_class_name, **options) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/courrier/email/delivery_job.rb', line 6

def perform(email_class_name, **options)
  Object.const_get(email_class_name).new(**options).deliver_now.tap do
    ActiveSupport::Notifications.instrument("delivery.courrier", email: email_class_name, options: options)
  end
rescue => exception
  ActiveSupport::Notifications.instrument("delivery_failed.courrier", email: email_class_name, options: options, exception: [exception.class.name, exception.message])
  raise
end