class Base::Endpoints::Emails
This endpoint contains methods for sending emails.
Public Class Methods
new(access_token:, url:)
click to toggle source
Initializes this endpoint.
Calls superclass method
Base::Endpoint::new
# File lib/base/endpoints/emails.rb, line 8 def initialize(access_token:, url:) @path = 'emails' super end
Public Instance Methods
list(page: 1, per_page: 10)
click to toggle source
Lists the emails of a project
# 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)
click to toggle source
Sends an email with the given parameters.
If there is no sending domain set up all emails will use the `proxy@base-api.io` 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.
# 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