gds-api-adapters 61.1.0 → 62.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gds_api/email_alert_api.rb +20 -3
- data/lib/gds_api/test_helpers/email_alert_api.rb +17 -4
- data/lib/gds_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92eba8c68e225ff418851d17f752e878114c846406a537081ebe34e0ae2e34c4
|
4
|
+
data.tar.gz: 7f42445ceb3ab057ded3a60a1dc8689fcec344398c1b735dbafb43e01c51653d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9d9b95df9631d8b54ac61ae808be26cc8f47d48fb8a9a13489aa1bb04457d76a044eae8732b7abd0a774304be484c5c29f0fa7a4430a06e2f9daf1cad698008
|
7
|
+
data.tar.gz: 326e54ff7b2f4fb098ce3d39f50fd96897cedd25d9a73c86f1eba71b7b70a188ab4952bddc59cd8059abc4caf01b2c80d1326cde50bc4a7dcd464283e6ed61a3
|
@@ -220,15 +220,15 @@ class GdsApi::EmailAlertApi < GdsApi::Base
|
|
220
220
|
)
|
221
221
|
end
|
222
222
|
|
223
|
-
#
|
223
|
+
# Verify a subscriber has control of a provided email
|
224
224
|
#
|
225
|
-
# @param [string] address
|
225
|
+
# @param [string] address Address to send verification email to
|
226
226
|
# @param [string] destination Path on GOV.UK that subscriber will be emailed
|
227
227
|
# @param [string, nil] redirect Path on GOV.UK to be encoded into the token for redirecting
|
228
228
|
#
|
229
229
|
# @return [Hash] subscriber
|
230
230
|
#
|
231
|
-
def
|
231
|
+
def send_subscriber_verification_email(address:, destination:, redirect: nil)
|
232
232
|
post_json(
|
233
233
|
"#{endpoint}/subscribers/auth-token",
|
234
234
|
address: address,
|
@@ -237,6 +237,23 @@ class GdsApi::EmailAlertApi < GdsApi::Base
|
|
237
237
|
)
|
238
238
|
end
|
239
239
|
|
240
|
+
# Verify a subscriber intends to be added to a subscription
|
241
|
+
#
|
242
|
+
# @param [string] address Address to send verification email to
|
243
|
+
# @param [string] frequency How often the subscriber wishes to be notified of new items
|
244
|
+
# @param [string] topic_id The slugs/ID for the topic being subscribed to
|
245
|
+
#
|
246
|
+
# return [Hash] subscription
|
247
|
+
#
|
248
|
+
def send_subscription_verification_email(address:, frequency:, topic_id:)
|
249
|
+
post_json(
|
250
|
+
"#{endpoint}/subscriptions/auth-token",
|
251
|
+
address: address,
|
252
|
+
frequency: frequency,
|
253
|
+
topic_id: topic_id,
|
254
|
+
)
|
255
|
+
end
|
256
|
+
|
240
257
|
private
|
241
258
|
|
242
259
|
def nested_query_string(params)
|
@@ -239,7 +239,21 @@ module GdsApi
|
|
239
239
|
).to_return(status: 422)
|
240
240
|
end
|
241
241
|
|
242
|
-
def
|
242
|
+
def stub_email_alert_api_sends_subscription_verification_email(address, frequency, topic_id)
|
243
|
+
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriptions/auth-token")
|
244
|
+
.with(
|
245
|
+
body: { address: address, frequency: frequency, topic_id: topic_id }.to_json,
|
246
|
+
).to_return(status: 200)
|
247
|
+
end
|
248
|
+
|
249
|
+
def stub_email_alert_api_subscription_verification_email_invalid(address, frequency, topic_id)
|
250
|
+
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriptions/auth-token")
|
251
|
+
.with(
|
252
|
+
body: { address: address, frequency: frequency, topic_id: topic_id }.to_json,
|
253
|
+
).to_return(status: 422)
|
254
|
+
end
|
255
|
+
|
256
|
+
def stub_email_alert_api_sends_subscriber_verification_email(subscriber_id, address)
|
243
257
|
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscribers/auth-token")
|
244
258
|
.to_return(
|
245
259
|
status: 201,
|
@@ -247,12 +261,12 @@ module GdsApi
|
|
247
261
|
)
|
248
262
|
end
|
249
263
|
|
250
|
-
def
|
264
|
+
def stub_email_alert_api_subscriber_verification_email_invalid
|
251
265
|
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscribers/auth-token")
|
252
266
|
.to_return(status: 422)
|
253
267
|
end
|
254
268
|
|
255
|
-
def
|
269
|
+
def stub_email_alert_api_subscriber_verification_email_no_subscriber
|
256
270
|
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscribers/auth-token")
|
257
271
|
.to_return(status: 404)
|
258
272
|
end
|
@@ -307,7 +321,6 @@ module GdsApi
|
|
307
321
|
alias_method :email_alert_api_creates_a_subscription, :stub_email_alert_api_creates_a_subscription
|
308
322
|
alias_method :email_alert_api_creates_an_existing_subscription, :stub_email_alert_api_creates_an_existing_subscription
|
309
323
|
alias_method :email_alert_api_refuses_to_create_subscription, :stub_email_alert_api_refuses_to_create_subscription
|
310
|
-
alias_method :email_alert_api_creates_an_auth_token, :stub_email_alert_api_creates_an_auth_token
|
311
324
|
alias_method :email_alert_api_has_subscriber_list_by_slug, :stub_email_alert_api_has_subscriber_list_by_slug
|
312
325
|
alias_method :email_alert_api_does_not_have_subscriber_list_by_slug, :stub_email_alert_api_does_not_have_subscriber_list_by_slug
|
313
326
|
|
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: 62.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: 2019-12-
|
11
|
+
date: 2019-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|