gds-api-adapters 76.0.0 → 78.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4aced99bb9908549cfe0a2d8f2a57df4e799d55fe7df796f3f29ae7361884694
|
4
|
+
data.tar.gz: 29835f7a98aaf0cb5e4feadd57de90a2c01231a7dc12f28f5aa99845994a5a9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f6a041fb8a075caafd88fc3f7828cd41be441ad1b491f5c738bfb3b726bd34993d30eaf52c83da3f55d19ce40267a6141e2221e8fef4a9d5682cede429537a2
|
7
|
+
data.tar.gz: 0d47922f059483ff795bac96f673f8bb51284a544b0af926e4aa7afbbd6f53c9310a371d53107dd2b1fba3b5656ac8c60fbf6cb0af490b8e295a261958a5b055
|
data/lib/gds_api/account_api.rb
CHANGED
@@ -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
|
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,
|
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
|
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)
|
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:
|
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:
|
11
|
+
date: 2022-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|