gds-api-adapters 71.4.0 → 71.9.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: d1bcd6f2192952444f80e49762cc4d1e2820c767162d194de9ce6c0f1b78ad2c
4
- data.tar.gz: cc96d6dc6f18b3ec2a58187977147b8be0bf6025e7a47c4b55671f2ab900c78f
3
+ metadata.gz: 8670645ff0ca90d1b259b0607aca69f3164d91330b33f3d05f2e741fbbd334e6
4
+ data.tar.gz: 7ac9e476e7ab01e1ad992bb9fd6dcb0fc4e494fcf05400e0df5cdc3a6b201a2e
5
5
  SHA512:
6
- metadata.gz: 2b0911632959b5c61c22ca3c5f208bd69d8cd6db5984fe83c4912251d38f1e895f8a90eda372de721a9f85a59af4931517eb468c3a23d554d9d3a9e4ecd24734
7
- data.tar.gz: 1ed0f2a61ed3833a05283684a443ae148324ae22e92daa49e14982af4e908ea5e4f96cda2f74ad20bedae96fdad3d4641fee09c01b958fd63e53190e319b7357
6
+ metadata.gz: fb5bdf29581b987c5be58ffc9ccba0e5f950194a3e8f26d2ec9eb83b87db370a618716fb1d9a9cfd7db6049309e7d136ae2815cdc365205392a6634603583f5d
7
+ data.tar.gz: 7f37ede40200371ead2740f89d44c4a588a0b488c0ae3516232370d6d65234b99e30a31c7fe36524b20ce19ebdcd222f81d72549627cb7182673389c030443eb
@@ -57,12 +57,19 @@ class GdsApi::AccountApi < GdsApi::Base
57
57
  # Update the user record with privileged information from the auth service. Only the auth service will call this.
58
58
  #
59
59
  # @param [String] subject_identifier The identifier of the user, shared between the auth service and GOV.UK.
60
- # @param [String, nil] email The new email address
61
- # @param [Boolean, nil] email_verified Whether the new email address is verified
60
+ # @param [String, nil] email The user's current
61
+ # @param [Boolean, nil] email_verified Whether the user's current email address is verified
62
+ # @param [Boolean, nil] has_unconfirmed_email Whether the user has a new, pending, email address
62
63
  #
63
64
  # @return [Hash] The user's subject identifier and email attributes
64
- def update_user_by_subject_identifier(subject_identifier:, email: nil, email_verified: nil)
65
- patch_json("#{endpoint}/api/oidc-users/#{subject_identifier}", { email: email, email_verified: email_verified }.compact)
65
+ def update_user_by_subject_identifier(subject_identifier:, email: nil, email_verified: nil, has_unconfirmed_email: nil)
66
+ params = {
67
+ email: email,
68
+ email_verified: email_verified,
69
+ has_unconfirmed_email: has_unconfirmed_email,
70
+ }.compact
71
+
72
+ patch_json("#{endpoint}/api/oidc-users/#{subject_identifier}", params)
66
73
  end
67
74
 
68
75
  # Check if a user has an email subscription for the Transition Checker
@@ -116,11 +123,40 @@ class GdsApi::AccountApi < GdsApi::Base
116
123
  get_json("#{endpoint}/api/attributes/names?#{querystring}", auth_headers(govuk_account_session))
117
124
  end
118
125
 
126
+ # Get the details of an account-linked email subscription.
127
+ #
128
+ # @param [String] name Name of the subscription
129
+ # @param [String] govuk_account_session Value of the session header
130
+ #
131
+ # @return [Hash] Details of the subscription, if it exists.
132
+ def get_email_subscription(name:, govuk_account_session:)
133
+ get_json("#{endpoint}/api/email-subscriptions/#{CGI.escape(name)}", auth_headers(govuk_account_session))
134
+ end
135
+
136
+ # Create or update an account-linked email subscription.
137
+ #
138
+ # @param [String] name Name of the subscription
139
+ # @param [String] topic_slug The email-alert-api topic slug to subscribe to
140
+ # @param [String] govuk_account_session Value of the session header
141
+ #
142
+ # @return [Hash] Details of the newly created subscription.
143
+ def put_email_subscription(name:, topic_slug:, govuk_account_session:)
144
+ put_json("#{endpoint}/api/email-subscriptions/#{CGI.escape(name)}", { topic_slug: topic_slug }, auth_headers(govuk_account_session))
145
+ end
146
+
147
+ # Unsubscribe and delete an account-linked email subscription.
148
+ #
149
+ # @param [String] name Name of the subscription
150
+ # @param [String] govuk_account_session Value of the session header
151
+ def delete_email_subscription(name:, govuk_account_session:)
152
+ delete_json("#{endpoint}/api/email-subscriptions/#{CGI.escape(name)}", {}, auth_headers(govuk_account_session))
153
+ end
154
+
119
155
  # Look up all pages saved by a user in their Account
120
156
  #
121
157
  # @param [String] govuk_account_session Value of the session header
122
158
  #
123
- # @return [Hash] containing :saved_pages, an array of single saved page hashes def get_saved_pages(govuk_account_session:)
159
+ # @return [Hash] containing :saved_pages, an array of single saved page hashes
124
160
  def get_saved_pages(govuk_account_session:)
125
161
  get_json("#{endpoint}/api/saved-pages", auth_headers(govuk_account_session))
126
162
  end
@@ -156,10 +156,10 @@ class GdsApi::EmailAlertApi < GdsApi::Base
156
156
  # @param [string] Subscriber new_address
157
157
  #
158
158
  # @return [Hash] subscriber
159
- def change_subscriber(id:, new_address:)
159
+ def change_subscriber(id:, new_address:, on_conflict: nil)
160
160
  patch_json(
161
161
  "#{endpoint}/subscribers/#{uri_encode(id)}",
162
- new_address: new_address,
162
+ { new_address: new_address, on_conflict: on_conflict }.compact,
163
163
  )
164
164
  end
165
165
 
@@ -176,6 +176,44 @@ class GdsApi::EmailAlertApi < GdsApi::Base
176
176
  )
177
177
  end
178
178
 
179
+ # Verify a GOV.UK Account-holder has a corresponding subscriber
180
+ #
181
+ # @param [string] govuk_account_session The request's session identifier
182
+ #
183
+ # @return [Hash] subscriber
184
+ def authenticate_subscriber_by_govuk_account(govuk_account_session:)
185
+ post_json(
186
+ "#{endpoint}/subscribers/govuk-account",
187
+ govuk_account_session: govuk_account_session,
188
+ )
189
+ end
190
+
191
+ # Mark a subscriber as "linked" to its corresponding GOV.UK Account.
192
+ # In practice "linking" will mean that email-alert-frontend and
193
+ # account-api will treat the subscriber specially (eg, only allowing
194
+ # address changes via the account).
195
+ #
196
+ # @param [string] govuk_account_session The request's session identifier
197
+ #
198
+ # @return [Hash] subscriber
199
+ def link_subscriber_to_govuk_account(govuk_account_session:)
200
+ post_json(
201
+ "#{endpoint}/subscribers/govuk-account/link",
202
+ govuk_account_session: govuk_account_session,
203
+ )
204
+ end
205
+
206
+ # Find a subscriber which has been "linked" to a GOV.UK Account.
207
+ #
208
+ # @param [String] govuk_account_id An ID for the account.
209
+ #
210
+ # @return [Hash] subscriber
211
+ def find_subscriber_by_govuk_account(govuk_account_id:)
212
+ get_json(
213
+ "#{endpoint}/subscribers/govuk-account/#{govuk_account_id}",
214
+ )
215
+ end
216
+
179
217
  # Verify a subscriber has control of a provided email
180
218
  #
181
219
  # @param [string] address Address to send verification email to
@@ -5,6 +5,20 @@ module GdsApi
5
5
  module AccountApi
6
6
  ACCOUNT_API_ENDPOINT = Plek.find("account-api")
7
7
 
8
+ def stub_account_api_request(method, path, with: {}, response_status: 200, response_body: {}, govuk_account_session: nil, new_govuk_account_session: nil)
9
+ with.merge!(headers: { GdsApi::AccountApi::AUTH_HEADER_NAME => govuk_account_session }) if govuk_account_session
10
+ new_govuk_account_session = nil if response_status >= 400
11
+ to_return = { status: response_status, body: response_body.merge(govuk_account_session: new_govuk_account_session).compact.to_json }
12
+ if with.empty?
13
+ stub_request(method, "#{ACCOUNT_API_ENDPOINT}#{path}").to_return(**to_return)
14
+ else
15
+ stub_request(method, "#{ACCOUNT_API_ENDPOINT}#{path}").with(**with).to_return(**to_return)
16
+ end
17
+ end
18
+
19
+ #########################
20
+ # GET /api/oauth2/sign-in
21
+ #########################
8
22
  def stub_account_api_get_sign_in_url(redirect_path: nil, state_id: nil, level_of_authentication: nil, auth_uri: "http://auth/provider", state: "state")
9
23
  querystring = Rack::Utils.build_nested_query({ redirect_path: redirect_path, state_id: state_id, level_of_authentication: level_of_authentication }.compact)
10
24
  stub_request(:get, "#{ACCOUNT_API_ENDPOINT}/api/oauth2/sign-in?#{querystring}")
@@ -14,12 +28,15 @@ module GdsApi
14
28
  )
15
29
  end
16
30
 
17
- def stub_account_api_validates_auth_response(code: nil, state: nil, govuk_account_session: "govuk-account-session", redirect_path: "/", ga_client_id: "ga-client-id")
31
+ ###########################
32
+ # POST /api/oauth2/callback
33
+ ###########################
34
+ def stub_account_api_validates_auth_response(code: nil, state: nil, govuk_account_session: "govuk-account-session", redirect_path: "/", ga_client_id: "ga-client-id", cookie_consent: false)
18
35
  stub_request(:post, "#{ACCOUNT_API_ENDPOINT}/api/oauth2/callback")
19
36
  .with(body: hash_including({ code: code, state: state }.compact))
20
37
  .to_return(
21
38
  status: 200,
22
- body: { govuk_account_session: govuk_account_session, redirect_path: redirect_path, ga_client_id: ga_client_id }.to_json,
39
+ body: { govuk_account_session: govuk_account_session, redirect_path: redirect_path, ga_client_id: ga_client_id, cookie_consent: cookie_consent }.to_json,
23
40
  )
24
41
  end
25
42
 
@@ -29,6 +46,9 @@ module GdsApi
29
46
  .to_return(status: 401)
30
47
  end
31
48
 
49
+ ########################
50
+ # POST /api/oauth2/state
51
+ ########################
32
52
  def stub_account_api_create_registration_state(attributes: nil, state_id: "state-id")
33
53
  stub_request(:post, "#{ACCOUNT_API_ENDPOINT}/api/oauth2/state")
34
54
  .with(body: hash_including({ attributes: attributes }.compact))
@@ -38,14 +58,19 @@ module GdsApi
38
58
  )
39
59
  end
40
60
 
41
- def stub_account_api_user_info(level_of_authentication: "level0", email: "email@example.com", email_verified: true, services: {}, **options)
61
+ ###############
62
+ # GET /api/user
63
+ ###############
64
+ def stub_account_api_user_info(id: "user-id", level_of_authentication: "level0", email: "email@example.com", email_verified: true, has_unconfirmed_email: false, services: {}, **options)
42
65
  stub_account_api_request(
43
66
  :get,
44
67
  "/api/user",
45
68
  response_body: {
69
+ id: id,
46
70
  level_of_authentication: level_of_authentication,
47
71
  email: email,
48
72
  email_verified: email_verified,
73
+ has_unconfirmed_email: has_unconfirmed_email,
49
74
  services: services,
50
75
  },
51
76
  **options,
@@ -69,19 +94,120 @@ module GdsApi
69
94
  )
70
95
  end
71
96
 
72
- def stub_update_user_by_subject_identifier(subject_identifier:, email: nil, email_verified: nil, old_email: nil, old_email_verified: nil)
97
+ ###########################################
98
+ # PATCH /api/oidc-users/:subject_identifier
99
+ ###########################################
100
+ def stub_update_user_by_subject_identifier(subject_identifier:, email: nil, email_verified: nil, has_unconfirmed_email: nil, old_email: nil, old_email_verified: nil, old_has_unconfirmed_email: nil)
73
101
  stub_account_api_request(
74
102
  :patch,
75
103
  "/api/oidc-users/#{subject_identifier}",
76
- with: { body: hash_including({ email: email, email_verified: email_verified }.compact) },
104
+ with: { body: hash_including({ email: email, email_verified: email_verified, has_unconfirmed_email: has_unconfirmed_email }.compact) },
77
105
  response_body: {
78
106
  sub: subject_identifier,
79
107
  email: email || old_email,
80
108
  email_verified: email_verified || old_email_verified,
109
+ has_unconfirmed_email: has_unconfirmed_email || old_has_unconfirmed_email,
110
+ },
111
+ )
112
+ end
113
+
114
+ ####################################
115
+ # GET /api/email-subscriptions/:name
116
+ ####################################
117
+ def stub_account_api_get_email_subscription(name:, topic_slug: "slug", email_alert_api_subscription_id: "12345", **options)
118
+ stub_account_api_request(
119
+ :get,
120
+ "/api/email-subscriptions/#{name}",
121
+ response_body: {
122
+ email_subscription: {
123
+ name: name,
124
+ topic_slug: topic_slug,
125
+ email_alert_api_subscription_id: email_alert_api_subscription_id,
126
+ },
127
+ },
128
+ **options,
129
+ )
130
+ end
131
+
132
+ def stub_account_api_get_email_subscription_does_not_exist(name:, **options)
133
+ stub_account_api_request(
134
+ :get,
135
+ "/api/email-subscriptions/#{name}",
136
+ response_status: 404,
137
+ **options,
138
+ )
139
+ end
140
+
141
+ def stub_account_api_get_email_subscription_unauthorized(name:, **options)
142
+ stub_account_api_request(
143
+ :get,
144
+ "/api/email-subscriptions/#{name}",
145
+ response_status: 401,
146
+ **options,
147
+ )
148
+ end
149
+
150
+ ####################################
151
+ # PUT /api/email-subscriptions/:name
152
+ ####################################
153
+ def stub_account_api_put_email_subscription(name:, topic_slug: nil, **options)
154
+ stub_account_api_request(
155
+ :put,
156
+ "/api/email-subscriptions/#{name}",
157
+ with: { body: hash_including({ topic_slug: topic_slug }.compact) },
158
+ response_body: {
159
+ email_subscription: {
160
+ name: name,
161
+ topic_slug: topic_slug || "slug",
162
+ },
81
163
  },
164
+ **options,
165
+ )
166
+ end
167
+
168
+ def stub_account_api_unauthorized_put_email_subscription(name:, topic_slug: nil, **options)
169
+ stub_account_api_request(
170
+ :put,
171
+ "/api/email-subscriptions/#{name}",
172
+ with: { body: hash_including({ topic_slug: topic_slug }.compact) },
173
+ response_status: 401,
174
+ **options,
82
175
  )
83
176
  end
84
177
 
178
+ #######################################
179
+ # DELETE /api/email-subscriptions/:name
180
+ #######################################
181
+ def stub_account_api_delete_email_subscription(name:, **options)
182
+ stub_account_api_request(
183
+ :delete,
184
+ "/api/email-subscriptions/#{name}",
185
+ response_status: 204,
186
+ **options,
187
+ )
188
+ end
189
+
190
+ def stub_account_api_delete_email_subscription_does_not_exist(name:, **options)
191
+ stub_account_api_request(
192
+ :delete,
193
+ "/api/email-subscriptions/#{name}",
194
+ response_status: 404,
195
+ **options,
196
+ )
197
+ end
198
+
199
+ def stub_account_api_unauthorized_delete_email_subscription(name:, **options)
200
+ stub_account_api_request(
201
+ :delete,
202
+ "/api/email-subscriptions/#{name}",
203
+ response_status: 401,
204
+ **options,
205
+ )
206
+ end
207
+
208
+ ################################################
209
+ # GET /api/transition-checker-email-subscription
210
+ ################################################
85
211
  def stub_account_api_has_email_subscription(**options)
86
212
  stub_account_api_request(
87
213
  :get,
@@ -119,6 +245,9 @@ module GdsApi
119
245
  )
120
246
  end
121
247
 
248
+ #################################################
249
+ # POST /api/transition-checker-email-subscription
250
+ #################################################
122
251
  def stub_account_api_set_email_subscription(slug: nil, **options)
123
252
  stub_account_api_request(
124
253
  :post,
@@ -149,6 +278,9 @@ module GdsApi
149
278
  )
150
279
  end
151
280
 
281
+ #####################
282
+ # GET /api/attributes
283
+ #####################
152
284
  def stub_account_api_has_attributes(attributes: [], values: {}, **options)
153
285
  querystring = Rack::Utils.build_nested_query({ attributes: attributes }.compact)
154
286
  stub_account_api_request(
@@ -180,6 +312,9 @@ module GdsApi
180
312
  )
181
313
  end
182
314
 
315
+ #######################
316
+ # PATCH /api/attributes
317
+ #######################
183
318
  def stub_account_api_set_attributes(attributes: nil, **options)
184
319
  stub_account_api_request(
185
320
  :patch,
@@ -210,6 +345,9 @@ module GdsApi
210
345
  )
211
346
  end
212
347
 
348
+ ###########################
349
+ # GET /api/attributes/names
350
+ ###########################
213
351
  def stub_account_api_get_attributes_names(attributes: [], **options)
214
352
  querystring = Rack::Utils.build_nested_query({ attributes: attributes }.compact)
215
353
  stub_account_api_request(
@@ -241,17 +379,6 @@ module GdsApi
241
379
  )
242
380
  end
243
381
 
244
- def stub_account_api_request(method, path, with: {}, response_status: 200, response_body: {}, govuk_account_session: nil, new_govuk_account_session: nil)
245
- with.merge!(headers: { GdsApi::AccountApi::AUTH_HEADER_NAME => govuk_account_session }) if govuk_account_session
246
- new_govuk_account_session = nil if response_status >= 400
247
- to_return = { status: response_status, body: response_body.merge(govuk_account_session: new_govuk_account_session).compact.to_json }
248
- if with.empty?
249
- stub_request(method, "#{ACCOUNT_API_ENDPOINT}#{path}").to_return(**to_return)
250
- else
251
- stub_request(method, "#{ACCOUNT_API_ENDPOINT}#{path}").with(**with).to_return(**to_return)
252
- end
253
- end
254
-
255
382
  ######################
256
383
  # GET /api/saved-pages
257
384
  ######################
@@ -6,11 +6,11 @@ module GdsApi
6
6
  module EmailAlertApi
7
7
  EMAIL_ALERT_API_ENDPOINT = Plek.find("email-alert-api")
8
8
 
9
- def stub_email_alert_api_has_updated_subscriber(id, new_address)
9
+ def stub_email_alert_api_has_updated_subscriber(id, new_address, govuk_account_id: nil)
10
10
  stub_request(:patch, "#{EMAIL_ALERT_API_ENDPOINT}/subscribers/#{id}")
11
11
  .to_return(
12
12
  status: 200,
13
- body: get_subscriber_response(id, new_address).to_json,
13
+ body: get_subscriber_response(id, new_address, govuk_account_id).to_json,
14
14
  )
15
15
  end
16
16
 
@@ -265,11 +265,11 @@ module GdsApi
265
265
  ).to_return(status: 422)
266
266
  end
267
267
 
268
- def stub_email_alert_api_sends_subscriber_verification_email(subscriber_id, address)
268
+ def stub_email_alert_api_sends_subscriber_verification_email(subscriber_id, address, govuk_account_id: nil)
269
269
  stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscribers/auth-token")
270
270
  .to_return(
271
271
  status: 201,
272
- body: get_subscriber_response(subscriber_id, address).to_json,
272
+ body: get_subscriber_response(subscriber_id, address, govuk_account_id).to_json,
273
273
  )
274
274
  end
275
275
 
@@ -283,6 +283,102 @@ module GdsApi
283
283
  .to_return(status: 404)
284
284
  end
285
285
 
286
+ def stub_email_alert_api_subscriber_verification_email_linked_to_govuk_account
287
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscribers/auth-token")
288
+ .to_return(status: 403)
289
+ end
290
+
291
+ def stub_email_alert_api_authenticate_subscriber_by_govuk_account(govuk_account_session, subscriber_id, address, govuk_account_id: "user-id", new_govuk_account_session: nil)
292
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscribers/govuk-account")
293
+ .with(
294
+ body: { govuk_account_session: govuk_account_session }.to_json,
295
+ ).to_return(
296
+ status: 200,
297
+ body: {
298
+ govuk_account_session: new_govuk_account_session,
299
+ }.compact.merge(get_subscriber_response(subscriber_id, address, govuk_account_id)).to_json,
300
+ )
301
+ end
302
+
303
+ def stub_email_alert_api_authenticate_subscriber_by_govuk_account_session_invalid(govuk_account_session)
304
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscribers/govuk-account")
305
+ .with(
306
+ body: { govuk_account_session: govuk_account_session }.to_json,
307
+ ).to_return(
308
+ status: 401,
309
+ )
310
+ end
311
+
312
+ def stub_email_alert_api_authenticate_subscriber_by_govuk_account_email_unverified(govuk_account_session, new_govuk_account_session: nil)
313
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscribers/govuk-account")
314
+ .with(
315
+ body: { govuk_account_session: govuk_account_session }.to_json,
316
+ ).to_return(
317
+ status: 403,
318
+ body: {
319
+ govuk_account_session: new_govuk_account_session,
320
+ }.compact.to_json,
321
+ )
322
+ end
323
+
324
+ def stub_email_alert_api_authenticate_subscriber_by_govuk_account_no_subscriber(govuk_account_session, new_govuk_account_session: nil)
325
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscribers/govuk-account")
326
+ .with(
327
+ body: { govuk_account_session: govuk_account_session }.to_json,
328
+ ).to_return(
329
+ status: 404,
330
+ body: {
331
+ govuk_account_session: new_govuk_account_session,
332
+ }.compact.to_json,
333
+ )
334
+ end
335
+
336
+ def stub_email_alert_api_link_subscriber_to_govuk_account(govuk_account_session, subscriber_id, address, govuk_account_id: "user-id", new_govuk_account_session: nil)
337
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscribers/govuk-account/link")
338
+ .with(
339
+ body: { govuk_account_session: govuk_account_session }.to_json,
340
+ ).to_return(
341
+ status: 200,
342
+ body: {
343
+ govuk_account_session: new_govuk_account_session,
344
+ }.compact.merge(get_subscriber_response(subscriber_id, address, govuk_account_id)).to_json,
345
+ )
346
+ end
347
+
348
+ def stub_email_alert_api_link_subscriber_to_govuk_account_session_invalid(govuk_account_session)
349
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscribers/govuk-account/link")
350
+ .with(
351
+ body: { govuk_account_session: govuk_account_session }.to_json,
352
+ ).to_return(
353
+ status: 401,
354
+ )
355
+ end
356
+
357
+ def stub_email_alert_api_link_subscriber_to_govuk_account_email_unverified(govuk_account_session, new_govuk_account_session: nil)
358
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscribers/govuk-account/link")
359
+ .with(
360
+ body: { govuk_account_session: govuk_account_session }.to_json,
361
+ ).to_return(
362
+ status: 403,
363
+ body: {
364
+ govuk_account_session: new_govuk_account_session,
365
+ }.compact.to_json,
366
+ )
367
+ end
368
+
369
+ def stub_email_alert_api_find_subscriber_by_govuk_account(govuk_account_id, subscriber_id, address)
370
+ stub_request(:get, "#{EMAIL_ALERT_API_ENDPOINT}/subscribers/govuk-account/#{govuk_account_id}")
371
+ .to_return(
372
+ status: 200,
373
+ body: get_subscriber_response(subscriber_id, address, govuk_account_id).to_json,
374
+ )
375
+ end
376
+
377
+ def stub_email_alert_api_find_subscriber_by_govuk_account_no_subscriber(govuk_account_id)
378
+ stub_request(:get, "#{EMAIL_ALERT_API_ENDPOINT}/subscribers/govuk-account/#{govuk_account_id}")
379
+ .to_return(status: 404)
380
+ end
381
+
286
382
  def assert_unsubscribed(uuid)
287
383
  assert_requested(:post, "#{EMAIL_ALERT_API_ENDPOINT}/unsubscribe/#{uuid}", times: 1)
288
384
  end
@@ -314,11 +410,12 @@ module GdsApi
314
410
 
315
411
  private
316
412
 
317
- def get_subscriber_response(id, address)
413
+ def get_subscriber_response(id, address, govuk_account_id)
318
414
  {
319
415
  "subscriber" => {
320
416
  "id" => id,
321
417
  "address" => address,
418
+ "govuk_account_id" => govuk_account_id,
322
419
  },
323
420
  }
324
421
  end
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = "71.4.0".freeze
2
+ VERSION = "71.9.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: 71.4.0
4
+ version: 71.9.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-06-10 00:00:00.000000000 Z
11
+ date: 2021-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable