gds-api-adapters 76.0.0 → 78.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: c6fbbdd523fc7bf5afd6d23497c1adffa0c61d5cc0d836f377e7f836164cb886
4
- data.tar.gz: cfeb1598eb0ef9409be473c362f682d72c0b4e26ba0889b596bb037a8327593f
3
+ metadata.gz: 4aced99bb9908549cfe0a2d8f2a57df4e799d55fe7df796f3f29ae7361884694
4
+ data.tar.gz: 29835f7a98aaf0cb5e4feadd57de90a2c01231a7dc12f28f5aa99845994a5a9d
5
5
  SHA512:
6
- metadata.gz: dc9c4199017d1f929c9a061767585ffc8dc4d49dcb70606f7e32336683f4061be6e00f1c265aed8c9f52a0761028f4da35527abccf30d5a3b8ebe98c2991eb34
7
- data.tar.gz: 9d87aa59e50a159dac97564245334a132b6550bd946eace9260177882bafee15a82e1992fe7fb99708fdaf813c0f723fb15e971660315b58c5e309f5eaf073de
6
+ metadata.gz: 9f6a041fb8a075caafd88fc3f7828cd41be441ad1b491f5c738bfb3b726bd34993d30eaf52c83da3f55d19ce40267a6141e2221e8fef4a9d5682cede429537a2
7
+ data.tar.gz: 0d47922f059483ff795bac96f673f8bb51284a544b0af926e4aa7afbbd6f53c9310a371d53107dd2b1fba3b5656ac8c60fbf6cb0af490b8e295a261958a5b055
@@ -75,16 +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] cookie_consent Whether the user has consented to analytics cookies
79
- # @param [Boolean, nil] feedback_consent Whether the user has consented to being contacted for feedback
80
78
  #
81
79
  # @return [Hash] The user's subject identifier and email attributes
82
- def update_user_by_subject_identifier(subject_identifier:, email: nil, email_verified: nil, cookie_consent: nil, feedback_consent: nil)
80
+ def update_user_by_subject_identifier(subject_identifier:, email: nil, email_verified: nil)
83
81
  params = {
84
82
  email: email,
85
83
  email_verified: email_verified,
86
- cookie_consent: cookie_consent,
87
- feedback_consent: feedback_consent,
88
84
  }.compact
89
85
 
90
86
  patch_json("#{endpoint}/api/oidc-users/#{subject_identifier}", params)
@@ -247,6 +247,26 @@ 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) govuk_request_id An ID allowing us to trace requests across our infra. Required if you want to send an email.
255
+ # @param [string] (optional) body Optional email body to send to alert users they are being unsubscribed. Required if you want to send an email
256
+ # @param [string] (optional) sender_message_id A UUID to prevent multiple emails for the same event. Required if you want to send an email.
257
+ def bulk_unsubscribe(slug:, govuk_request_id: nil, body: nil, sender_message_id: nil)
258
+ post_json(
259
+ "#{endpoint}/subscriber-lists/#{slug}/bulk-unsubscribe",
260
+ {
261
+ body: body,
262
+ sender_message_id: sender_message_id,
263
+ }.compact,
264
+ {
265
+ "Govuk-Request-Id" => govuk_request_id,
266
+ }.compact,
267
+ )
268
+ end
269
+
250
270
  private
251
271
 
252
272
  def nested_query_string(params)
@@ -159,17 +159,15 @@ module GdsApi
159
159
  ###########################################
160
160
  # PATCH /api/oidc-users/:subject_identifier
161
161
  ###########################################
162
- def stub_update_user_by_subject_identifier(subject_identifier:, email: nil, email_verified: nil, cookie_consent: nil, feedback_consent: nil, old_email: nil, old_email_verified: 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)
163
163
  stub_account_api_request(
164
164
  :patch,
165
165
  "/api/oidc-users/#{subject_identifier}",
166
- with: { body: hash_including({ email: email, email_verified: email_verified, cookie_consent: cookie_consent, feedback_consent: feedback_consent }.compact) },
166
+ with: { body: hash_including({ email: email, email_verified: email_verified }.compact) },
167
167
  response_body: {
168
168
  sub: subject_identifier,
169
169
  email: email || old_email,
170
170
  email_verified: email_verified || old_email_verified,
171
- cookie_consent: cookie_consent || old_cookie_consent,
172
- feedback_consent: feedback_consent || old_feedback_consent,
173
171
  },
174
172
  )
175
173
  end
@@ -408,6 +408,56 @@ 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:, govuk_request_id:, 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
+ headers: { "Govuk-Request-Id" => govuk_request_id },
424
+ ).to_return(status: 202)
425
+ end
426
+
427
+ def stub_email_alert_api_bulk_unsubscribe_not_found(slug:)
428
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{slug}/bulk-unsubscribe")
429
+ .to_return(status: 404)
430
+ end
431
+
432
+ def stub_email_alert_api_bulk_unsubscribe_not_found_with_message(slug:, govuk_request_id:, body:, sender_message_id:)
433
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{slug}/bulk-unsubscribe")
434
+ .with(
435
+ body: {
436
+ body: body,
437
+ sender_message_id: sender_message_id,
438
+ }.to_json,
439
+ headers: { "Govuk-Request-Id" => govuk_request_id },
440
+ ).to_return(status: 404)
441
+ end
442
+
443
+ def stub_email_alert_api_bulk_unsubscribe_conflict_with_message(slug:, govuk_request_id:, body:, sender_message_id:)
444
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{slug}/bulk-unsubscribe")
445
+ .with(
446
+ body: {
447
+ body: body,
448
+ sender_message_id: sender_message_id,
449
+ }.to_json,
450
+ headers: { "Govuk-Request-Id" => govuk_request_id },
451
+ ).to_return(status: 409)
452
+ end
453
+
454
+ def stub_email_alert_api_bulk_unsubscribe_bad_request(slug:, body:)
455
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{slug}/bulk-unsubscribe")
456
+ .with(
457
+ body: { body: body }.to_json,
458
+ ).to_return(status: 422)
459
+ end
460
+
411
461
  private
412
462
 
413
463
  def get_subscriber_response(id, address, govuk_account_id)
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = "76.0.0".freeze
2
+ VERSION = "78.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: 76.0.0
4
+ version: 78.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-07 00:00:00.000000000 Z
11
+ date: 2022-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable