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.
-
#list(page: 1, per_page: 10) ⇒ Object
Lists the emails of a project.
-
#send(subject:, from:, to:, html: nil, text: nil) ⇒ 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 = 'emails' super end |
Instance Method Details
#list(page: 1, per_page: 10) ⇒ Object
Lists the emails of a project
14 15 16 17 18 19 20 21 |
# File 'lib/base/endpoints/emails.rb', line 14 def list(page: 1, per_page: 10) request do response = connection.get('', per_page: per_page, page: page) parse(response.body) end end |
#send(subject:, from:, to:, html: nil, text: nil) ⇒ 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.
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/base/endpoints/emails.rb', line 31 def send(subject:, from:, to:, html: nil, text: nil) request do response = connection.post('', 'from' => from, 'to' => to, 'subject' => subject, 'html' => html, 'text' => text) parse(response.body) end end |