lib/drill/mail/default.rb in drill-mailer-0.1.1 vs lib/drill/mail/default.rb in drill-mailer-0.3.0

- old
+ new

@@ -4,21 +4,33 @@ module Drill module Mail class Default < Base def deliver + return if params.skip_delivery + template_name = params.template_name Drill.client.messages.send_template(template_name, [], message_hash) end - def deliver_later + def deliver_later(wait: nil) + return if params.skip_delivery + template_name = params.template_name - Drill::DeliveryWorker.perform_async(template_name, message_hash) + if wait + worker.perform_in(wait.to_i, template_name, message_hash) + else + worker.perform_async(template_name, message_hash) + end end private + + def worker + Drill::DeliveryWorker + end def message_hash message_hash = {} to_emails = Array(params.to).map do |email|