class MandrillMailer::TemplateMailer

Attributes

template_content[RW]

Public: Template content

template_name[RW]

Public: The name of the template to use

Public Instance Methods

deliver() click to toggle source

Public: Triggers the stored Mandrill params to be sent to the Mandrill api

# File lib/mandrill_mailer/template_mailer.rb, line 121
def deliver
  deliver_now
end
deliver_later(options={}) click to toggle source
# File lib/mandrill_mailer/template_mailer.rb, line 129
def deliver_later(options={})
  MandrillMailer::MandrillTemplateJob.set(options).perform_later(template_name, template_content, message, async, ip_pool, send_at, self.class.name)
end
deliver_now() click to toggle source
# File lib/mandrill_mailer/offline.rb, line 29
def deliver_now
  MandrillMailer::Mock.new({
    :template_name    => template_name,
    :template_content => template_content,
    :message          => message,
    :async            => async,
    :ip_pool          => ip_pool,
    :send_at          => send_at
  }).tap do |mock|
     MandrillMailer.deliveries << mock
  end
end
mandrill_mail_handler(args) click to toggle source

Handle template mailer specifics before formating the given args

# 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