Class: Macaco::Mandrill
Instance Method Summary
collapse
Methods inherited from Sender
#body_html, #body_text, #from, #hash_attributes, #initialize, #subject, #to, #to_json
Constructor Details
This class inherits a constructor from Macaco::Sender
Instance Method Details
#api_key ⇒ Object
4
5
6
|
# File 'lib/macaco/senders/mandrill.rb', line 4
def api_key
Macaco.config.api_key || ENV['MACACO_API_KEY']
end
|
#api_path ⇒ Object
12
13
14
|
# File 'lib/macaco/senders/mandrill.rb', line 12
def api_path
'/api/1.0/messages/send.json'
end
|
#api_root ⇒ Object
8
9
10
|
# File 'lib/macaco/senders/mandrill.rb', line 8
def api_root
'mandrillapp.com'
end
|
#send ⇒ Object
28
29
30
31
|
# File 'lib/macaco/senders/mandrill.rb', line 28
def send
data = to_hash.merge!({ key: api_key })
Macaco::Api.post({ mail: self, data: data })
end
|
#to_hash ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/macaco/senders/mandrill.rb', line 16
def to_hash
{
message: {
from_email: @from,
to: @to,
subject: @subject,
html: @body_html,
text: @body_text
}
}
end
|