Class: SendgridNotification::SendmailJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- SendgridNotification::SendmailJob
- Defined in:
- app/jobs/sendgrid_notification/sendmail_job.rb
Defined Under Namespace
Classes: HTTPException
Constant Summary collapse
- MailerClass =
Rails.application.config.sendgrid_notification.mailer.constantize
Instance Method Summary collapse
Instance Method Details
#perform(to, notification_mail, params, hash_attachments = []) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'app/jobs/sendgrid_notification/sendmail_job.rb', line 9 def perform(to, notification_mail, params, = []) mailer = MailerClass.new(params) = .map{|hash| SendgridNotification::Attachment.wrap(hash.symbolize_keys) } mailer.sendmail(to, notification_mail, params, ) raise HTTPException, mailer.last_result.body unless mailer.last_result_success? mailer.last_result.body end |