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



32
33
34
35
# File 'lib/resend/emails.rb', line 32

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



18
19
20
21
# File 'lib/resend/emails.rb', line 18

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

.send(params) ⇒ Object

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



11
12
13
14
# File 'lib/resend/emails.rb', line 11

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

.update(params) ⇒ Object

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



25
26
27
28
# File 'lib/resend/emails.rb', line 25

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.



40
41
42
43
# File 'lib/resend/emails.rb', line 40

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