Sha256: 731ec808b10c13418c4b0d955cf2a4737e258fb671961afae672bcccdf020243

Contents?: true

Size: 562 Bytes

Versions: 1

Compression:

Stored size: 562 Bytes

Contents

module Macaco
  class Mandrill < Sender

    def api_key
      Macaco.config.api_key || ENV['MACACO_API_KEY']
    end

    def api_root
      'mandrillapp.com'
    end

    def api_path
      '/api/1.0/messages/send.json'
    end

    def to_hash
      {
        message: {
          from_email: @from,
          to: @to,
          subject: @subject,
          html: @body_html,
          text: @body_text
        }
      }
    end

    def send
      data = to_hash.merge!({ key: api_key })
      Macaco::Api.post({ mail: self, data: data })
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
macaco-0.0.2 lib/macaco/senders/mandrill.rb