Sha256: 48d19c93af1f5a904d7fd3dc7b9624adf745ed91cf38355330a8f922b8d90eca

Contents?: true

Size: 842 Bytes

Versions: 15

Compression:

Stored size: 842 Bytes

Contents

module Locomotive

  class SendPonyEmailJob < ActiveJob::Base

    queue_as :default

    def perform(options)
      _options = prepare_options(options)

      Pony.mail(_options)
    end

    protected

    def prepare_options(options)
      _options = options.deep_symbolize_keys

      _options[:via] = _options[:via].to_sym if _options[:via]

      if _options[:via_options] && (value = _options[:via_options][:authentication])
        _options[:via_options][:authentication] = value.to_sym
      end

      # if attachments, decode them because they were enccoding in base64
      if attachments = _options.delete(:attachments)
        _options[:attachments] = {}
        attachments.each do |name, content|
          _options[:attachments][name.to_s] = Base64.decode64(content)
        end
      end

      _options
    end

  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
locomotivecms-4.0.0 app/jobs/locomotive/send_pony_email_job.rb
locomotivecms-4.0.0.rc0 app/jobs/locomotive/send_pony_email_job.rb
locomotivecms-4.0.0.alpha3 app/jobs/locomotive/send_pony_email_job.rb
locomotivecms-3.4.1 app/jobs/locomotive/send_pony_email_job.rb
locomotivecms-4.0.0.alpha2 app/jobs/locomotive/send_pony_email_job.rb
locomotivecms-4.0.0.alpha1 app/jobs/locomotive/send_pony_email_job.rb
locomotivecms-3.4.0 app/jobs/locomotive/send_pony_email_job.rb
locomotivecms-3.3.0 app/jobs/locomotive/send_pony_email_job.rb
locomotivecms-3.3.0.rc3 app/jobs/locomotive/send_pony_email_job.rb
locomotivecms-3.3.0.rc2 app/jobs/locomotive/send_pony_email_job.rb
locomotivecms-3.2.1 app/jobs/locomotive/send_pony_email_job.rb
locomotivecms-3.3.0.rc1 app/jobs/locomotive/send_pony_email_job.rb
locomotivecms-3.2.0 app/jobs/locomotive/send_pony_email_job.rb
locomotivecms-3.2.0.rc2 app/jobs/locomotive/send_pony_email_job.rb
locomotivecms-3.2.0.rc1 app/jobs/locomotive/send_pony_email_job.rb