gds-api-adapters 71.5.0 → 71.6.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: 40bafd0ac54082d307befb62d5a9f4af3d21c53ff42ec51bcc5ee4c2e7897e9a
4
- data.tar.gz: '029eeb35b60b20ad1da0c4f5da7162db15aa768ce539f67e39ea44e78df7e807'
3
+ metadata.gz: ecea9412cb0ad1e32c5b4eac37fd53699b06e7b9612a7033eb23f989e1a013d2
4
+ data.tar.gz: 311fc8a8a2dc36fc389dd7d0166943dfab092690d5e1ea504b9395fd44a5f2b6
5
5
  SHA512:
6
- metadata.gz: f025fac520f508122ffa5a7cf17569ec1b00a60d10b418fa1d4d3e57681f15497dd3e8eaba990b29a52ca87309945e2de90cae5682a265b89ac340bc0e08547e
7
- data.tar.gz: d0c513eda3423fba67d49250aa6d18359a09ad816a15d0523b215555e828003a6ccaf108412d91bbabcb80bed6ccf6fe67cba2590b6010c09a4667cf6ff719cb
6
+ metadata.gz: 255c6879512abcd1c8383d1f4b24799bc408ce04cce55e1cfd1db7365e5e17189d196fa26917283ff411c93b568c824fda237ea683bc9d5d6e56e397c43aaa54
7
+ data.tar.gz: 1bc48d079cba0ee202697442fd3646718100df7c5e870ff5c17b38ca32802a11fd4f833f424d12dcf6270a98d3be7fd9a067525c0432dc986c771448be91053c
@@ -176,6 +176,18 @@ 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
+
179
191
  # Verify a subscriber has control of a provided email
180
192
  #
181
193
  # @param [string] address Address to send verification email to
@@ -283,6 +283,51 @@ module GdsApi
283
283
  .to_return(status: 404)
284
284
  end
285
285
 
286
+ def stub_email_alert_api_authenticate_subscriber_by_govuk_account(govuk_account_session, subscriber_id, address, new_govuk_account_session: nil)
287
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscribers/govuk-account")
288
+ .with(
289
+ body: { govuk_account_session: govuk_account_session }.to_json,
290
+ ).to_return(
291
+ status: 200,
292
+ body: {
293
+ govuk_account_session: new_govuk_account_session,
294
+ }.compact.merge(get_subscriber_response(subscriber_id, address)).to_json,
295
+ )
296
+ end
297
+
298
+ def stub_email_alert_api_authenticate_subscriber_by_govuk_account_session_invalid(govuk_account_session)
299
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscribers/govuk-account")
300
+ .with(
301
+ body: { govuk_account_session: govuk_account_session }.to_json,
302
+ ).to_return(
303
+ status: 401,
304
+ )
305
+ end
306
+
307
+ def stub_email_alert_api_authenticate_subscriber_by_govuk_account_email_unverified(govuk_account_session, new_govuk_account_session: nil)
308
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscribers/govuk-account")
309
+ .with(
310
+ body: { govuk_account_session: govuk_account_session }.to_json,
311
+ ).to_return(
312
+ status: 403,
313
+ body: {
314
+ govuk_account_session: new_govuk_account_session,
315
+ }.compact.to_json,
316
+ )
317
+ end
318
+
319
+ def stub_email_alert_api_authenticate_subscriber_by_govuk_account_no_subscriber(govuk_account_session, new_govuk_account_session: nil)
320
+ stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscribers/govuk-account")
321
+ .with(
322
+ body: { govuk_account_session: govuk_account_session }.to_json,
323
+ ).to_return(
324
+ status: 404,
325
+ body: {
326
+ govuk_account_session: new_govuk_account_session,
327
+ }.compact.to_json,
328
+ )
329
+ end
330
+
286
331
  def assert_unsubscribed(uuid)
287
332
  assert_requested(:post, "#{EMAIL_ALERT_API_ENDPOINT}/unsubscribe/#{uuid}", times: 1)
288
333
  end
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = "71.5.0".freeze
2
+ VERSION = "71.6.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.5.0
4
+ version: 71.6.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-18 00:00:00.000000000 Z
11
+ date: 2021-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable