Sha256: 4d7461d5651f3f2dc95e9dd949753a9ec1add844dbf2f46c3a3f38190b0580f7

Contents?: true

Size: 1015 Bytes

Versions: 2

Compression:

Stored size: 1015 Bytes

Contents

module NoNotifierNeeded
  module Send
    def send_now(which_email, *args)
      email_hash = translate_to_hash(which_email, args)
      Resque.enqueue(EmailProcessor, email_hash)
    end

    def send_in(time_from_now, which_email, *args)
      email_hash = translate_to_hash(which_email, args)
      Resque.enqueue_at(time_from_now, EmailProcessor, email_hash)
    end

    def send_at(what_time, which_email, *args)
      email_hash = translate_to_hash(which_email, args)
      time_from_now = what_time.is_a?(Time) ? what_time : Chronic.parse(what_time)
      Resque.enqueue_at(time_from_now, EmailProcessor, email_hash)
    end

    def mcp(email_name, args)
      @template = EmailTemplate.find_by_name(email_name)
      raise "Email Template name not found" if @template.nil?

      args_to_instance_vars(args)


      mail_is = ActionMailer::Base.mail(get_send_hash) do|format|
        format.html { render :inline => render_template_body_type(@template) }
      end

      return mail_is
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
no_notifier_needed-0.1.1 lib/no_notifier_needed/send.rb
no_notifier_needed-0.1.0 lib/no_notifier_needed/send.rb