Class: ActiveNotifier::Transports::ActionMailer

Inherits:
Object
  • Object
show all
Defined in:
lib/active_notifier/transports/action_mailer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration, notifier) ⇒ ActionMailer

Returns a new instance of ActionMailer.



9
10
11
# File 'lib/active_notifier/transports/action_mailer.rb', line 9

def initialize(configuration, notifier)
  self.configuration = configuration
end

Instance Attribute Details

#configurationObject

Returns the value of attribute configuration.



4
5
6
# File 'lib/active_notifier/transports/action_mailer.rb', line 4

def configuration
  @configuration
end

Instance Method Details

#deliverable(notifier) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/active_notifier/transports/action_mailer.rb', line 13

def deliverable(notifier)
  email_attribute = configuration.email_attribute
  to = notifier.recipient.public_send(email_attribute)
  if to.blank?
    raise ActiveNotifier::DeliveryImpossible.new("Recipient email not present.")
  end

  mailer_class(notifier).notification({
    to: to
  })
end