Class: Mail::Notify::DeliveryMethod
- Inherits:
-
Object
- Object
- Mail::Notify::DeliveryMethod
- Defined in:
- lib/mail/notify/delivery_method.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
Returns the value of attribute response.
-
#settings ⇒ Object
Returns the value of attribute settings.
Instance Method Summary collapse
- #deliver!(mail) ⇒ Object
-
#initialize(settings) ⇒ DeliveryMethod
constructor
A new instance of DeliveryMethod.
- #preview(mail) ⇒ Object
Constructor Details
#initialize(settings) ⇒ DeliveryMethod
Returns a new instance of DeliveryMethod.
8 9 10 11 12 |
# File 'lib/mail/notify/delivery_method.rb', line 8 def initialize(settings) raise ArgumentError, "You must specify an API key" if settings[:api_key].blank? @settings = settings end |
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
6 7 8 |
# File 'lib/mail/notify/delivery_method.rb', line 6 def response @response end |
#settings ⇒ Object
Returns the value of attribute settings.
6 7 8 |
# File 'lib/mail/notify/delivery_method.rb', line 6 def settings @settings end |
Instance Method Details
#deliver!(mail) ⇒ Object
14 15 16 17 18 |
# File 'lib/mail/notify/delivery_method.rb', line 14 def deliver!(mail) @mail = mail @personalisation = Personalisation.new(mail) send_email end |
#preview(mail) ⇒ Object
20 21 22 23 24 |
# File 'lib/mail/notify/delivery_method.rb', line 20 def preview(mail) personalisation = Personalisation.new(mail).to_h template_id = mail[:template_id].to_s client.generate_template_preview(template_id, personalisation: personalisation) end |