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_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
|
#content_type ⇒ Object
16
17
18
|
# File 'lib/macaco/senders/mandrill.rb', line 16
def content_type
'application/json'
end
|
#docs ⇒ Object
4
5
6
|
# File 'lib/macaco/senders/mandrill.rb', line 4
def docs
'https://mandrillapp.com/api/docs/messages.JSON.html#method-send'
end
|
#send ⇒ Object
32
33
34
35
|
# File 'lib/macaco/senders/mandrill.rb', line 32
def send
data = to_hash.merge!({ key: api_key })
Macaco::Api.post({ mail: self, data: convert_data_params(data) })
end
|
#to_hash ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/macaco/senders/mandrill.rb', line 20
def to_hash
{
message: {
from_email: @from,
to: @to,
subject: @subject,
html: @body_html,
text: @body_text
}
}
end
|