Module: Resend::Suppressions
- Defined in:
- lib/resend/suppressions.rb,
lib/resend/suppressions/batch.rb
Overview
Suppressions API wrapper
Defined Under Namespace
Modules: Batch
Class Method Summary collapse
-
.add(params) ⇒ Object
Add an email address to the suppression list.
-
.get(id_or_email) ⇒ Object
Retrieve a single suppression.
-
.list(params = {}) ⇒ Object
Retrieve a list of suppressions.
-
.remove(id_or_email) ⇒ Object
Remove a single suppression, which allows sending to that address again.
Class Method Details
.add(params) ⇒ Object
Add an email address to the suppression list. Suppressed addresses are skipped by future sends. Adding an address that is already suppressed succeeds and returns the existing suppression.
https://resend.com/docs/api-reference/suppressions/add-suppression
17 18 19 |
# File 'lib/resend/suppressions.rb', line 17 def add(params) Resend::Request.new("suppressions", params, "post").perform end |
.get(id_or_email) ⇒ Object
Retrieve a single suppression. The API returns 404 'Suppression not found' when the address or ID is not suppressed.
https://resend.com/docs/api-reference/suppressions/get-suppression
44 45 46 47 48 |
# File 'lib/resend/suppressions.rb', line 44 def get(id_or_email) raise ArgumentError, "Missing required `id_or_email` field" if id_or_email.nil? || id_or_email.empty? Resend::Request.new("suppressions/#{ERB::Util.url_encode(id_or_email)}", {}, "get").perform end |
.list(params = {}) ⇒ Object
Retrieve a list of suppressions. Each entry has id, email, origin,
source_id and created_at; unlike get, list entries carry no object key.
https://resend.com/docs/api-reference/suppressions/list-suppressions
32 33 34 35 |
# File 'lib/resend/suppressions.rb', line 32 def list(params = {}) path = Resend::PaginationHelper.build_paginated_path("suppressions", params) Resend::Request.new(path, {}, "get").perform end |
.remove(id_or_email) ⇒ Object
Remove a single suppression, which allows sending to that address again. The API returns 404 'Suppression not found' when the address or ID is not suppressed.
https://resend.com/docs/api-reference/suppressions/remove-suppression
57 58 59 60 61 |
# File 'lib/resend/suppressions.rb', line 57 def remove(id_or_email) raise ArgumentError, "Missing required `id_or_email` field" if id_or_email.nil? || id_or_email.empty? Resend::Request.new("suppressions/#{ERB::Util.url_encode(id_or_email)}", {}, "delete").perform end |