Class: Telnyx::Resources::EmailUnsubscribeGroups::Suppressions
- Inherits:
-
Object
- Object
- Telnyx::Resources::EmailUnsubscribeGroups::Suppressions
- Defined in:
- lib/telnyx/resources/email_unsubscribe_groups/suppressions.rb,
sig/telnyx/resources/email_unsubscribe_groups/suppressions.rbs
Overview
Named groups and group-scoped suppressions.
Instance Method Summary collapse
-
#create(id, to:, request_options: {}) ⇒ Telnyx::Models::EmailBlockResponse
Creates a suppression with
reason: unsubscribe,source: manual,group_id: <this group>. -
#delete(email, id:, request_options: {}) ⇒ nil
Soft-deletes all active blocks for (account, group, normalized email) — one
removedaudit event per block (actor: manual). -
#initialize(client:) ⇒ Suppressions
constructor
private
A new instance of Suppressions.
-
#list(id, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::EmailBlock>
Account + group scoped.
Constructor Details
#initialize(client:) ⇒ Suppressions
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Suppressions.
105 106 107 |
# File 'lib/telnyx/resources/email_unsubscribe_groups/suppressions.rb', line 105 def initialize(client:) @client = client end |
Instance Method Details
#create(id, to:, request_options: {}) ⇒ Telnyx::Models::EmailBlockResponse
Creates a suppression with reason: unsubscribe, source: manual,
group_id: <this group>. All other body fields are ignored; only to is read.
Idempotent (same dedupe key → 200, no new event).
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/telnyx/resources/email_unsubscribe_groups/suppressions.rb', line 23 def create(id, params) parsed, = Telnyx::EmailUnsubscribeGroups::SuppressionCreateParams.dump_request(params) @client.request( method: :post, path: ["email_unsubscribe_groups/%1$s/suppressions", id], body: parsed, model: Telnyx::EmailBlockResponse, options: ) end |
#delete(email, id:, request_options: {}) ⇒ nil
Soft-deletes all active blocks for (account, group, normalized email) — one
removed audit event per block (actor: manual). The email path segment is
normalized (trim + lower-case) before matching. Idempotent on already-removed
rows (returns 404 since they're no longer active).
Two distinct 404 cases: a missing/cross-account group returns
10001 "The requested unsubscribe group was not found"; a group that exists but
has no active suppression for that email returns
10001 "The requested group suppression was not found".
88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/telnyx/resources/email_unsubscribe_groups/suppressions.rb', line 88 def delete(email, params) parsed, = Telnyx::EmailUnsubscribeGroups::SuppressionDeleteParams.dump_request(params) id = parsed.delete(:id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["email_unsubscribe_groups/%1$s/suppressions/%2$s", id, email], model: NilClass, options: ) end |
#list(id, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::EmailBlock>
Account + group scoped. Offset pagination only (page[number] default 1,
page[size] default 25, max 100). No sort/filter/ cursor — ordering fixed
desc created_at, desc id. Uses the shared QueryParser.parse_offset/1 — a
malformed page returns 400 (code 10015), consistent with
GET /v2/email_blocks. meta includes total_pages. Rows reuse the standard
suppression shape (group_id set to this group).
54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/telnyx/resources/email_unsubscribe_groups/suppressions.rb', line 54 def list(id, params = {}) parsed, = Telnyx::EmailUnsubscribeGroups::SuppressionListParams.dump_request(params) query = Telnyx::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["email_unsubscribe_groups/%1$s/suppressions", id], query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"), page: Telnyx::Internal::DefaultFlatPagination, model: Telnyx::EmailBlock, options: ) end |