Class: Madmimi::Rails::DeliveryMethod
- Inherits:
-
Object
- Object
- Madmimi::Rails::DeliveryMethod
- Defined in:
- lib/madmimi/rails/delivery_method.rb
Defined Under Namespace
Classes: InvalidOptions
Instance Attribute Summary collapse
-
#settings ⇒ Object
Returns the value of attribute settings.
Instance Method Summary collapse
- #deliver!(mail) ⇒ Object
-
#initialize(config = {}) ⇒ DeliveryMethod
constructor
A new instance of DeliveryMethod.
Constructor Details
#initialize(config = {}) ⇒ DeliveryMethod
Returns a new instance of DeliveryMethod.
9 10 11 12 |
# File 'lib/madmimi/rails/delivery_method.rb', line 9 def initialize config = {} fail(InvalidOptions, "Missing configuration") if config[:email].nil? || config[:api_key].nil? self.settings = config end |
Instance Attribute Details
#settings ⇒ Object
Returns the value of attribute settings.
7 8 9 |
# File 'lib/madmimi/rails/delivery_method.rb', line 7 def settings @settings end |
Instance Method Details
#deliver!(mail) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/madmimi/rails/delivery_method.rb', line 14 def deliver! mail = { 'promotion_name' => mail.subject, 'recipients' => mail.to.join(','), 'from' => mail.from, 'subject' => mail.subject, 'remove_unsubscribe' => true } raw = mail.body.raw_source mimi = MadMimi.new(settings[:email], settings[:api_key]) mimi.send_html(, raw) end |