Sha256: f85ff4238304d92f765375c3b014286ac3389cf762a551630965e42f1ab990f4
Contents?: true
Size: 894 Bytes
Versions: 2
Compression:
Stored size: 894 Bytes
Contents
module Macaco class Mandrill < Sender def docs 'https://mandrillapp.com/api/docs/messages.JSON.html#method-send' end def api_root 'mandrillapp.com' end def api_path '/api/1.0/messages/send.json' end def content_type 'application/json' end def to_hash { message: { from_email: @from, to: @to, subject: @subject, html: @body_html, text: @body_text } } end def to(val = nil) return @to unless val @to << { email: val } end def send data = to_hash.merge!({ key: api_key }) Macaco::Api.post({ mail: self, data: convert_data_params(data) }) end private def convert_data_params(data) data.to_json end def api_key Macaco.config.api_key || ENV['MACACO_API_KEY'] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
macaco-0.0.6 | lib/macaco/senders/mandrill.rb |
macaco-0.0.5 | lib/macaco/senders/mandrill.rb |