Class: NotificationHub::Channels::Email::ActionMailer

Inherits:
Base
  • Object
show all
Defined in:
lib/notification_hub/channels/email/action_mailer.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ ActionMailer

Returns a new instance of ActionMailer.



9
10
11
# File 'lib/notification_hub/channels/email/action_mailer.rb', line 9

def initialize(configuration)
  super
end

Class Method Details

.send_message(event_code, data, options) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/notification_hub/channels/email/action_mailer.rb', line 14

def send_message(event_code, data, options)           
  event = event_code.split(".")

  begin
    if Rails.version.to_f >= 4.2
      "#{event[0].camelize}Mailer".constantize.send(event[1].to_sym, data, options[:email]).deliver_now
    else
      "#{event[0].camelize}Mailer".constantize.send(event[1].to_sym, data, options[:email]).deliver
    end
  rescue => exception
    raise "Email::ActionMailer Error: #{exception.message}"
  end
end