Class: MandrillMailer::TemplateMailer
- Inherits:
-
CoreMailer
- Object
- CoreMailer
- MandrillMailer::TemplateMailer
- Defined in:
- lib/mandrill_mailer/offline.rb,
lib/mandrill_mailer/template_mailer.rb
Instance Attribute Summary collapse
-
#template_content ⇒ Object
Public: Template content.
-
#template_name ⇒ Object
Public: The name of the template to use.
Attributes inherited from CoreMailer
#async, #ip_pool, #message, #send_at
Instance Method Summary collapse
-
#deliver ⇒ Object
Public: Triggers the stored Mandrill params to be sent to the Mandrill api.
- #deliver_later(options = {}) ⇒ Object
- #deliver_now ⇒ Object
-
#mandrill_mail_handler(args) ⇒ Object
Handle template mailer specifics before formating the given args.
Methods inherited from CoreMailer
#bcc, default, #from, #mandrill_mail, method_missing, super_defaults, test, test_setup_for, #to, #to=
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class MandrillMailer::CoreMailer
Instance Attribute Details
#template_content ⇒ Object
Public: Template content
118 119 120 |
# File 'lib/mandrill_mailer/template_mailer.rb', line 118 def template_content @template_content end |
#template_name ⇒ Object
Public: The name of the template to use
115 116 117 |
# File 'lib/mandrill_mailer/template_mailer.rb', line 115 def template_name @template_name end |
Instance Method Details
#deliver ⇒ Object
Public: Triggers the stored Mandrill params to be sent to the Mandrill api
121 122 123 |
# File 'lib/mandrill_mailer/template_mailer.rb', line 121 def deliver deliver_now end |
#deliver_later(options = {}) ⇒ Object
129 130 131 |
# File 'lib/mandrill_mailer/template_mailer.rb', line 129 def deliver_later(={}) MandrillMailer::MandrillTemplateJob.set().perform_later(template_name, template_content, , async, ip_pool, send_at, self.class.name) end |
#deliver_now ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/mandrill_mailer/offline.rb', line 29 def deliver_now MandrillMailer::Mock.new({ :template_name => template_name, :template_content => template_content, :message => , :async => async, :ip_pool => ip_pool, :send_at => send_at }).tap do |mock| MandrillMailer.deliveries << mock end end |
#mandrill_mail_handler(args) ⇒ Object
Handle template mailer specifics before formating the given args
134 135 136 137 138 139 140 141 142 143 |
# File 'lib/mandrill_mailer/template_mailer.rb', line 134 def mandrill_mail_handler(args) # Mandrill requires template content to be there, set default value args[:template_content] = {"blank" => ""} if args[:template_content].blank? # Set the template content self.template_content = MandrillMailer::ArgFormatter.mandrill_args(args.delete(:template_content)) # Set the template name self.template_name = args.delete(:template) end |