Class: Broadcast::Resources::GlobalSuppressions
- Defined in:
- lib/broadcast/resources/global_suppressions.rb
Overview
The installation-wide suppression list. Addresses on it never receive mail from any channel. All operations require an admin (system) API token — a channel token gets a 401.
There is deliberately no check here: checking is a per-channel
question (it reads the channel list too), so it lives on Suppressions.
Instance Method Summary collapse
-
#add(email) ⇒ Object
Add an address to the global list.
-
#bulk_add(emails) ⇒ Object
Add up to 10,000 addresses at once.
-
#bulk_remove(emails) ⇒ Object
Remove up to 10,000 addresses at once.
-
#list(**params) ⇒ Object
List global suppressions (250 per page, with
paginationmetadata; passpage:). -
#remove(email) ⇒ Object
Remove an address from the global list only.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Broadcast::Resources::Base
Instance Method Details
#add(email) ⇒ Object
Add an address to the global list. Already-suppressed is a success (200 instead of 201).
20 21 22 |
# File 'lib/broadcast/resources/global_suppressions.rb', line 20 def add(email) post('/api/v1/global_suppressions.json', { email: email }) end |
#bulk_add(emails) ⇒ Object
Add up to 10,000 addresses at once. Idempotent. Returns added,
already_suppressed, and invalid counts.
32 33 34 |
# File 'lib/broadcast/resources/global_suppressions.rb', line 32 def bulk_add(emails) post('/api/v1/global_suppressions/bulk.json', { emails: emails }) end |
#bulk_remove(emails) ⇒ Object
Remove up to 10,000 addresses at once. Returns removed and
not_found counts.
38 39 40 |
# File 'lib/broadcast/resources/global_suppressions.rb', line 38 def bulk_remove(emails) @client.request(:delete, '/api/v1/global_suppressions/bulk.json', { emails: emails }) end |
#list(**params) ⇒ Object
List global suppressions (250 per page, with pagination metadata;
pass page:). Optional email: filters by partial match.
14 15 16 |
# File 'lib/broadcast/resources/global_suppressions.rb', line 14 def list(**params) get('/api/v1/global_suppressions.json', params) end |
#remove(email) ⇒ Object
Remove an address from the global list only. Channels that suppressed the same address on their own account keep their block.
26 27 28 |
# File 'lib/broadcast/resources/global_suppressions.rb', line 26 def remove(email) @client.request(:delete, '/api/v1/global_suppressions.json', { email: email }) end |