Sha256: e91186a29c4c66bd26e0db2113a3e9aef3ddfc133314f3e9f4e403ad8e5f960d

Contents?: true

Size: 916 Bytes

Versions: 23

Compression:

Stored size: 916 Bytes

Contents

module Locomotive
  module Steam

    class AsyncEmailService < EmailService

      def send_email!(options)
        _options = prepare_options_for_async(options)

        SendPonyEmailJob.perform_later(_options)
      end

      protected

      def prepare_options_for_async(options)
        _options = options.deep_stringify_keys

        # convert symbol values to string
        _options['via'] = _options['via'].to_s if _options['via']

        if _options['via_options'] && (value = _options['via_options']['authentication'])
          _options['via_options']['authentication'] = value.to_s
        end

        # if attachments, encode them in base64 to avoid encoding
        # errors when persisting them in Redis.
        (_options['attachments'] || {}).each do |name, content|
          _options['attachments'][name] = Base64.encode64(content)
        end

        _options
      end

    end

  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
locomotivecms-4.2.0.alpha2 lib/locomotive/steam/services/async_email_service.rb
locomotivecms-4.2.0.alpha1 lib/locomotive/steam/services/async_email_service.rb
locomotivecms-4.1.1 lib/locomotive/steam/services/async_email_service.rb
locomotivecms-4.1.0 lib/locomotive/steam/services/async_email_service.rb
locomotivecms-4.1.0.rc1 lib/locomotive/steam/services/async_email_service.rb
locomotivecms-4.0.3 lib/locomotive/steam/services/async_email_service.rb
locomotivecms-4.0.2 lib/locomotive/steam/services/async_email_service.rb
locomotivecms-4.0.1 lib/locomotive/steam/services/async_email_service.rb
locomotivecms-4.0.0 lib/locomotive/steam/services/async_email_service.rb
locomotivecms-4.0.0.rc0 lib/locomotive/steam/services/async_email_service.rb
locomotivecms-4.0.0.alpha3 lib/locomotive/steam/services/async_email_service.rb
locomotivecms-3.4.1 lib/locomotive/steam/services/async_email_service.rb
locomotivecms-4.0.0.alpha2 lib/locomotive/steam/services/async_email_service.rb
locomotivecms-4.0.0.alpha1 lib/locomotive/steam/services/async_email_service.rb
locomotivecms-3.4.0 lib/locomotive/steam/services/async_email_service.rb
locomotivecms-3.3.0 lib/locomotive/steam/services/async_email_service.rb
locomotivecms-3.3.0.rc3 lib/locomotive/steam/services/async_email_service.rb
locomotivecms-3.3.0.rc2 lib/locomotive/steam/services/async_email_service.rb
locomotivecms-3.2.1 lib/locomotive/steam/services/async_email_service.rb
locomotivecms-3.3.0.rc1 lib/locomotive/steam/services/async_email_service.rb