gds-api-adapters 77.0.0 → 77.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ea534ae361e87fde66ed0a9909c3920b0a58c86ad5e26b3dd4c7d13baabe15c
4
- data.tar.gz: a24876d1c08767f5d934e9327feb212a6e35f33142c4c6764e85f28eca525de5
3
+ metadata.gz: 4ae9935a6f00ed43737c077e942ba2fb89deff13e02bac93917b1db6215162d2
4
+ data.tar.gz: 0c7da0e74c80afc296468a98cd79f11f357957b12ba9ed90247c2d2ac0b0aff0
5
5
  SHA512:
6
- metadata.gz: 23a867c3eb864e2078989ac9f395d572a3679a06ad1efc20f080563d4aabd65e46e27b29118e77daa130924d00c9de4c6f7a7a4f1131d2b242099dc3a05783d6
7
- data.tar.gz: 2340a2464e1971055760d1169f05e18c40e9ef50e75610b763f6c6018fcae863a8669aa77a8c9aedaa9ed3632c8e463f0147b92a80d2a811c69d2f4b1ec47a94
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)
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = "77.0.0".freeze
2
+ VERSION = "77.1.0".freeze
3
3
  end
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.0.0
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: 2021-12-10 00:00:00.000000000 Z
11
+ date: 2022-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable