gds-api-adapters 75.3.0 → 78.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 207e19a65d19c45b030d88ccc1028e781def6a120dfedcc725615628b7d2f35d
4
- data.tar.gz: a838e9f19dc4e7f8b45017aacd0fae259f1cb353ee44356c8c34066054fb1ea1
3
+ metadata.gz: 5a423ee043ccb33b30d2d1a0f12b0a5f43d14018b774afa6270f24626062f696
4
+ data.tar.gz: e18aa2ed41343e430781063d9a8e85584213781758a245f8c818849c9d51e30d
5
5
  SHA512:
6
- metadata.gz: d95b69e442c280cf3fbe5fa84dbfc1d16e9462a1c160f0678d7cd78b8a1f0426b4a5878eac6e78a5755f5eff27b293f1832b5d4a35a0958c5aed50d86bee1736
7
- data.tar.gz: c167d604668e3685b63c6d83e7a09d6332bd40b2099fa7f4d9afd29d482aa240eef8398b67a0e8aeced29fde34847fe0a3f28d980d7da571cb63efb5b3b251c8
6
+ metadata.gz: 2113447106f41212696c5daf6e048c1bf0df7feac8b524d63a437f8113d8cb4cf9e2a9910e898c55a6501d7495548ff131142a4cdccf3e4287b327be54320a4d
7
+ data.tar.gz: 74a1d841906f75f5f9f045f8157e8bf40ace3a4e12e6b30226d07e3e1959267d4b66821e72e2d0812cb1ee951b1a99724e71b60bbf8e057bd8aea7ee60622153
@@ -75,18 +75,12 @@ class GdsApi::AccountApi < GdsApi::Base
75
75
  # @param [String] subject_identifier The identifier of the user, shared between the auth service and GOV.UK.
76
76
  # @param [String, nil] email The user's current email address
77
77
  # @param [Boolean, nil] email_verified Whether the user's current email address is verified
78
- # @param [Boolean, nil] has_unconfirmed_email Whether the user has a new, pending, email address
79
- # @param [Boolean, nil] cookie_consent Whether the user has consented to analytics cookies
80
- # @param [Boolean, nil] feedback_consent Whether the user has consented to being contacted for feedback
81
78
  #
82
79
  # @return [Hash] The user's subject identifier and email attributes
83
- def update_user_by_subject_identifier(subject_identifier:, email: nil, email_verified: nil, has_unconfirmed_email: nil, cookie_consent: nil, feedback_consent: nil)
80
+ def update_user_by_subject_identifier(subject_identifier:, email: nil, email_verified: nil)
84
81
  params = {
85
82
  email: email,
86
83
  email_verified: email_verified,
87
- has_unconfirmed_email: has_unconfirmed_email,
88
- cookie_consent: cookie_consent,
89
- feedback_consent: feedback_consent,
90
84
  }.compact
91
85
 
92
86
  patch_json("#{endpoint}/api/oidc-users/#{subject_identifier}", params)
@@ -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] slug 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(slug:, body: nil, sender_message_id: nil)
257
+ post_json(
258
+ "#{endpoint}/subscriber-lists/#{slug}/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)
@@ -69,7 +69,7 @@ module GdsApi
69
69
  ###############
70
70
  # GET /api/user
71
71
  ###############
72
- def stub_account_api_user_info(id: "user-id", mfa: false, email: "email@example.com", email_verified: true, has_unconfirmed_email: false, services: {}, **options)
72
+ def stub_account_api_user_info(id: "user-id", mfa: false, email: "email@example.com", email_verified: true, services: {}, **options)
73
73
  stub_account_api_request(
74
74
  :get,
75
75
  "/api/user",
@@ -78,7 +78,6 @@ module GdsApi
78
78
  mfa: mfa,
79
79
  email: email,
80
80
  email_verified: email_verified,
81
- has_unconfirmed_email: has_unconfirmed_email,
82
81
  services: services,
83
82
  },
84
83
  **options,
@@ -160,18 +159,15 @@ module GdsApi
160
159
  ###########################################
161
160
  # PATCH /api/oidc-users/:subject_identifier
162
161
  ###########################################
163
- def stub_update_user_by_subject_identifier(subject_identifier:, email: nil, email_verified: nil, has_unconfirmed_email: nil, cookie_consent: nil, feedback_consent: nil, old_email: nil, old_email_verified: nil, old_has_unconfirmed_email: nil, old_cookie_consent: nil, old_feedback_consent: nil)
162
+ def stub_update_user_by_subject_identifier(subject_identifier:, email: nil, email_verified: nil, old_email: nil, old_email_verified: nil)
164
163
  stub_account_api_request(
165
164
  :patch,
166
165
  "/api/oidc-users/#{subject_identifier}",
167
- with: { body: hash_including({ email: email, email_verified: email_verified, has_unconfirmed_email: has_unconfirmed_email, cookie_consent: cookie_consent, feedback_consent: feedback_consent }.compact) },
166
+ with: { body: hash_including({ email: email, email_verified: email_verified }.compact) },
168
167
  response_body: {
169
168
  sub: subject_identifier,
170
169
  email: email || old_email,
171
170
  email_verified: email_verified || old_email_verified,
172
- has_unconfirmed_email: has_unconfirmed_email || old_has_unconfirmed_email,
173
- cookie_consent: cookie_consent || old_cookie_consent,
174
- feedback_consent: feedback_consent || old_feedback_consent,
175
171
  },
176
172
  )
177
173
  end
@@ -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(slug:)
412
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{slug}/bulk-unsubscribe")
413
+ .to_return(status: 202)
414
+ end
415
+
416
+ def stub_email_alert_api_bulk_unsubscribe_with_message(slug:, body:, sender_message_id:)
417
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{slug}/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(slug:)
427
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{slug}/bulk-unsubscribe")
428
+ .to_return(status: 404)
429
+ end
430
+
431
+ def stub_email_alert_api_bulk_unsubscribe_not_found_with_message(slug:, body:, sender_message_id:)
432
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{slug}/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(slug:, body:, sender_message_id:)
442
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{slug}/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(slug:, body:)
452
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{slug}/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 = "75.3.0".freeze
2
+ VERSION = "78.0.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: 75.3.0
4
+ version: 78.0.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-11-03 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