Module: Resend::Emails

Included in:
Client
Defined in:
lib/resend/emails.rb

Overview

Module responsible for wrapping email sending API

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.cancel(email_id = "") ⇒ Object

Cancel a scheduled email. see more: resend.com/docs/api-reference/emails/cancel-email



30
31
32
33
# File 'lib/resend/emails.rb', line 30

def cancel(email_id = "")
  path = "emails/#{email_id}/cancel"
  Resend::Request.new(path, {}, "post").perform
end

.get(email_id = "") ⇒ Object

Retrieve a single email. see more: resend.com/docs/api-reference/emails/retrieve-email



16
17
18
19
# File 'lib/resend/emails.rb', line 16

def get(email_id = "")
  path = "emails/#{email_id}"
  Resend::Request.new(path, {}, "get").perform
end

.send(params, options: {}) ⇒ Object

Sends or schedules an email. see more: resend.com/docs/api-reference/emails/send-email



9
10
11
12
# File 'lib/resend/emails.rb', line 9

def send(params, options: {})
  path = "emails"
  Resend::Request.new(path, params, "post", options: options).perform
end

.update(params) ⇒ Object

Update a scheduled email. see more: resend.com/docs/api-reference/emails/update-email



23
24
25
26
# File 'lib/resend/emails.rb', line 23

def update(params)
  path = "emails/#{params[:email_id]}"
  Resend::Request.new(path, params, "patch").perform
end

Instance Method Details

#send_email(params) ⇒ Object

This method is kept here for backwards compatibility Use Resend::Emails.send instead.



38
39
40
41
# File 'lib/resend/emails.rb', line 38

def send_email(params)
  warn "[DEPRECATION] `send_email` is deprecated.  Please use `Resend::Emails.send` instead."
  Resend::Emails.send(params)
end