gds-api-adapters 77.0.0 → 77.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gds_api/email_alert_api.rb +16 -0
- data/lib/gds_api/test_helpers/email_alert_api.rb +47 -0
- data/lib/gds_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ae9935a6f00ed43737c077e942ba2fb89deff13e02bac93917b1db6215162d2
|
4
|
+
data.tar.gz: 0c7da0e74c80afc296468a98cd79f11f357957b12ba9ed90247c2d2ac0b0aff0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0279189027b025193a9340b849a3fea6c682563af8affbf73ebdae40a83f4aecbaa878b039d6d23311bda729c7ab7fb94f1fa6b9739e867ac44136830f145c0e'
|
7
|
+
data.tar.gz: dc55f3c73fb2c1e45ac97dcd74581f3c52701186ca7f96171abbea8178d6721629f1c6deee08e7dce3d68bcf5277544f2bced1189fa9bbeb49f2b179d0da14af
|
@@ -247,6 +247,22 @@ class GdsApi::EmailAlertApi < GdsApi::Base
|
|
247
247
|
)
|
248
248
|
end
|
249
249
|
|
250
|
+
# Unsubscribe all users for a subscription list
|
251
|
+
# optionally send a notification email explaining the reason
|
252
|
+
#
|
253
|
+
# @param [string] subscriber_list_id Identifier for the subscription list
|
254
|
+
# @param [string] (optional) body Optional email body to send to alert users they are being unsubscribed
|
255
|
+
# @param [string] (optional) sender_message_id A UUID to prevent multiple emails for the same event
|
256
|
+
def bulk_unsubscribe(subscriber_list_id:, body: nil, sender_message_id: nil)
|
257
|
+
post_json(
|
258
|
+
"#{endpoint}/subscriber-lists/#{subscriber_list_id}/bulk-unsubscribe",
|
259
|
+
{
|
260
|
+
body: body,
|
261
|
+
sender_message_id: sender_message_id,
|
262
|
+
}.compact,
|
263
|
+
)
|
264
|
+
end
|
265
|
+
|
250
266
|
private
|
251
267
|
|
252
268
|
def nested_query_string(params)
|
@@ -408,6 +408,53 @@ module GdsApi
|
|
408
408
|
.to_return(status: 404)
|
409
409
|
end
|
410
410
|
|
411
|
+
def stub_email_alert_api_bulk_unsubscribe(subscriber_list_id:)
|
412
|
+
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{subscriber_list_id}/bulk-unsubscribe")
|
413
|
+
.to_return(status: 202)
|
414
|
+
end
|
415
|
+
|
416
|
+
def stub_email_alert_api_bulk_unsubscribe_with_message(subscriber_list_id:, body:, sender_message_id:)
|
417
|
+
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{subscriber_list_id}/bulk-unsubscribe")
|
418
|
+
.with(
|
419
|
+
body: {
|
420
|
+
body: body,
|
421
|
+
sender_message_id: sender_message_id,
|
422
|
+
}.to_json,
|
423
|
+
).to_return(status: 202)
|
424
|
+
end
|
425
|
+
|
426
|
+
def stub_email_alert_api_bulk_unsubscribe_not_found(subscriber_list_id:)
|
427
|
+
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{subscriber_list_id}/bulk-unsubscribe")
|
428
|
+
.to_return(status: 404)
|
429
|
+
end
|
430
|
+
|
431
|
+
def stub_email_alert_api_bulk_unsubscribe_not_found_with_message(subscriber_list_id:, body:, sender_message_id:)
|
432
|
+
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{subscriber_list_id}/bulk-unsubscribe")
|
433
|
+
.with(
|
434
|
+
body: {
|
435
|
+
body: body,
|
436
|
+
sender_message_id: sender_message_id,
|
437
|
+
}.to_json,
|
438
|
+
).to_return(status: 404)
|
439
|
+
end
|
440
|
+
|
441
|
+
def stub_email_alert_api_bulk_unsubscribe_conflict_with_message(subscriber_list_id:, body:, sender_message_id:)
|
442
|
+
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{subscriber_list_id}/bulk-unsubscribe")
|
443
|
+
.with(
|
444
|
+
body: {
|
445
|
+
body: body,
|
446
|
+
sender_message_id: sender_message_id,
|
447
|
+
}.to_json,
|
448
|
+
).to_return(status: 409)
|
449
|
+
end
|
450
|
+
|
451
|
+
def stub_email_alert_api_bulk_unsubscribe_bad_request(subscriber_list_id:, body:)
|
452
|
+
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{subscriber_list_id}/bulk-unsubscribe")
|
453
|
+
.with(
|
454
|
+
body: { body: body }.to_json,
|
455
|
+
).to_return(status: 422)
|
456
|
+
end
|
457
|
+
|
411
458
|
private
|
412
459
|
|
413
460
|
def get_subscriber_response(id, address, govuk_account_id)
|
data/lib/gds_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gds-api-adapters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 77.
|
4
|
+
version: 77.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|