Class: UtoboEmail::Emails
- Inherits:
-
Object
- Object
- UtoboEmail::Emails
- Defined in:
- lib/utobo_email/emails.rb
Instance Method Summary collapse
-
#get(id) ⇒ Hash
Retrieve the status of a previously sent email.
-
#initialize(client) ⇒ Emails
constructor
A new instance of Emails.
-
#send(from:, to:, subject:, html: nil, text: nil, reply_to: nil, cc: nil, bcc: nil, attachments: nil, headers: nil) ⇒ Hash
Send a transactional email.
Constructor Details
#initialize(client) ⇒ Emails
Returns a new instance of Emails.
3 4 5 |
# File 'lib/utobo_email/emails.rb', line 3 def initialize(client) @client = client end |
Instance Method Details
#get(id) ⇒ Hash
Retrieve the status of a previously sent email.
41 42 43 |
# File 'lib/utobo_email/emails.rb', line 41 def get(id) @client.get("/send-email/#{id}") end |
#send(from:, to:, subject:, html: nil, text: nil, reply_to: nil, cc: nil, bcc: nil, attachments: nil, headers: nil) ⇒ Hash
Send a transactional email.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/utobo_email/emails.rb', line 20 def send(from:, to:, subject:, html: nil, text: nil, reply_to: nil, cc: nil, bcc: nil, attachments: nil, headers: nil) body = { from: from, to: Array(to), subject: subject, } body[:html] = html if html body[:text] = text if text body[:reply_to] = Array(reply_to) if reply_to body[:cc] = Array(cc) if cc body[:bcc] = Array(bcc) if bcc body[:attachments] = if body[:headers] = headers if headers @client.post("/send-email", body) end |