Class: Base::Endpoints::Emails
- Inherits:
-
Base::Endpoint
- Object
- Base::Endpoint
- Base::Endpoints::Emails
- Defined in:
- lib/base/endpoints/emails.rb
Overview
This endpoint contains methods for sending emails.
Instance Attribute Summary
Attributes inherited from Base::Endpoint
Instance Method Summary collapse
-
#initialize(access_token:, url:) ⇒ Emails
constructor
Initializes this endpoint.
-
#send(subject:, from:, html:, text:, to:) ⇒ Object
Sends an email with the given parameters.
Methods inherited from Base::Endpoint
Constructor Details
#initialize(access_token:, url:) ⇒ Emails
Initializes this endpoint.
8 9 10 11 |
# File 'lib/base/endpoints/emails.rb', line 8 def initialize(access_token:, url:) @path = 'email' super end |
Instance Method Details
#send(subject:, from:, html:, text:, to:) ⇒ Object
Sends an email with the given parameters.
If there is no sending domain set up all emails will use the ‘[email protected]` sender and ignore the given one, also in this case there is a rate limit which is 30 emails in an hour.
If there is a sending domain, the sender must match that domain otherwise it will return an error.
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/base/endpoints/emails.rb', line 21 def send(subject:, from:, html:, text:, to:) request do response = connection.post('', 'from' => from, 'to' => to, 'subject' => subject, 'html' => html, 'text' => text) parse(response.body) end end |