gds-api-adapters 87.1.0 → 88.1.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 +13 -0
- data/lib/gds_api/router.rb +18 -20
- data/lib/gds_api/test_helpers/email_alert_api.rb +18 -0
- data/lib/gds_api/test_helpers/router.rb +6 -23
- 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: 79fe1575665027a5ad13f85d14e744690c101f68b96eb07bdcaddda05cb64e8a
|
4
|
+
data.tar.gz: 660f4807575e2cf6027eac405bcf0dbe5b07d176a8416be908d44c6a785f1af9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a50caa040385b76a6238df0f1f13ffce44a2b807434b6cc51f280109b3f15ae9d756cbf93c2ea3c7ae7b9790ae3a314aae1e28ed85bf6be24414edf7911d7af
|
7
|
+
data.tar.gz: 68e20ea7f52cb1451d1cdb847125c3278901381d6346941e74a13fdf21dafd58bd74a3363348c2f573b5f046eddc3e271de06a569374304eff3887c0fdd0e8d4
|
@@ -260,6 +260,19 @@ class GdsApi::EmailAlertApi < GdsApi::Base
|
|
260
260
|
)
|
261
261
|
end
|
262
262
|
|
263
|
+
# Migrate all users from one existing subscriber list to another existing subscriber list
|
264
|
+
#
|
265
|
+
# @param [string] to_slug Identifier for the successor subscription list
|
266
|
+
# @param [string] from_slug Identifier for the source subscription list
|
267
|
+
|
268
|
+
def bulk_migrate(from_slug:, to_slug:)
|
269
|
+
post_json(
|
270
|
+
"#{endpoint}/subscriber-lists/bulk-migrate",
|
271
|
+
from_slug: from_slug,
|
272
|
+
to_slug: to_slug,
|
273
|
+
)
|
274
|
+
end
|
275
|
+
|
263
276
|
# Update subscriber list details, such as title
|
264
277
|
# @param [Hash] params A hash of detail paramaters that can be updated. For example title.
|
265
278
|
# For allowed parameters see:
|
data/lib/gds_api/router.rb
CHANGED
@@ -21,14 +21,20 @@ class GdsApi::Router < GdsApi::Base
|
|
21
21
|
get_json("#{endpoint}/routes?incoming_path=#{CGI.escape(path)}")
|
22
22
|
end
|
23
23
|
|
24
|
-
def add_route(path, type, backend_id
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
def add_route(path, type, backend_id)
|
25
|
+
put_json(
|
26
|
+
"#{endpoint}/routes",
|
27
|
+
route: {
|
28
|
+
incoming_path: path,
|
29
|
+
route_type: type,
|
30
|
+
handler: "backend",
|
31
|
+
backend_id: backend_id,
|
32
|
+
},
|
33
|
+
)
|
28
34
|
end
|
29
35
|
|
30
36
|
def add_redirect_route(path, type, destination, redirect_type = "permanent", options = {})
|
31
|
-
|
37
|
+
put_json(
|
32
38
|
"#{endpoint}/routes",
|
33
39
|
route: {
|
34
40
|
incoming_path: path,
|
@@ -39,27 +45,19 @@ class GdsApi::Router < GdsApi::Base
|
|
39
45
|
segments_mode: options[:segments_mode],
|
40
46
|
},
|
41
47
|
)
|
42
|
-
|
43
|
-
commit_routes if options[:commit]
|
44
|
-
response
|
45
48
|
end
|
46
49
|
|
47
|
-
def add_gone_route(path, type
|
48
|
-
|
49
|
-
|
50
|
-
|
50
|
+
def add_gone_route(path, type)
|
51
|
+
put_json(
|
52
|
+
"#{endpoint}/routes",
|
53
|
+
route: { incoming_path: path, route_type: type, handler: "gone" },
|
54
|
+
)
|
51
55
|
end
|
52
56
|
|
53
|
-
def delete_route(path, hard_delete: false
|
57
|
+
def delete_route(path, hard_delete: false)
|
54
58
|
url = "#{endpoint}/routes?incoming_path=#{CGI.escape(path)}"
|
55
59
|
url += "&hard_delete=true" if hard_delete
|
56
60
|
|
57
|
-
|
58
|
-
commit_routes if commit
|
59
|
-
response
|
60
|
-
end
|
61
|
-
|
62
|
-
def commit_routes
|
63
|
-
post_json("#{endpoint}/routes/commit", {})
|
61
|
+
delete_json(url)
|
64
62
|
end
|
65
63
|
end
|
@@ -456,6 +456,24 @@ module GdsApi
|
|
456
456
|
.to_return(status: 422)
|
457
457
|
end
|
458
458
|
|
459
|
+
def stub_email_alert_api_bulk_migrate(from_slug:, to_slug:)
|
460
|
+
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/bulk-migrate")
|
461
|
+
.with(body: { from_slug: from_slug, to_slug: to_slug }.to_json)
|
462
|
+
.to_return(status: 202)
|
463
|
+
end
|
464
|
+
|
465
|
+
def stub_email_alert_api_bulk_migrate_bad_request(from_slug:, to_slug:)
|
466
|
+
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/bulk-migrate")
|
467
|
+
.with(body: { from_slug: from_slug, to_slug: to_slug }.to_json)
|
468
|
+
.to_return(status: 422)
|
469
|
+
end
|
470
|
+
|
471
|
+
def stub_email_alert_api_bulk_migrate_not_found(from_slug:, to_slug:)
|
472
|
+
stub_request(:post, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/bulk-migrate")
|
473
|
+
.with(body: { from_slug: from_slug, to_slug: to_slug }.to_json)
|
474
|
+
.to_return(status: 404)
|
475
|
+
end
|
476
|
+
|
459
477
|
def stub_update_subscriber_list_details(slug:, params:)
|
460
478
|
stub_request(:patch, "#{EMAIL_ALERT_API_ENDPOINT}/subscriber-lists/#{slug}")
|
461
479
|
.with(body: params.to_json)
|
@@ -32,7 +32,6 @@ module GdsApi
|
|
32
32
|
def stub_all_router_registration
|
33
33
|
stub_request(:put, %r{\A#{ROUTER_API_ENDPOINT}/backends/[a-z0-9-]+\z})
|
34
34
|
stub_request(:put, "#{ROUTER_API_ENDPOINT}/routes")
|
35
|
-
stub_request(:post, "#{ROUTER_API_ENDPOINT}/routes/commit")
|
36
35
|
end
|
37
36
|
|
38
37
|
def stub_router_backend_registration(backend_id, backend_url)
|
@@ -43,22 +42,18 @@ module GdsApi
|
|
43
42
|
end
|
44
43
|
|
45
44
|
def stub_route_registration(path, type, backend_id)
|
46
|
-
|
45
|
+
stub_route_put({
|
47
46
|
route: {
|
48
47
|
incoming_path: path,
|
49
48
|
route_type: type,
|
50
49
|
handler: "backend",
|
51
50
|
backend_id: backend_id,
|
52
51
|
},
|
53
|
-
}
|
54
|
-
|
55
|
-
register_stub = stub_route_put(route)
|
56
|
-
commit_stub = stub_router_commit
|
57
|
-
[register_stub, commit_stub]
|
52
|
+
})
|
58
53
|
end
|
59
54
|
|
60
55
|
def stub_redirect_registration(path, type, destination, redirect_type, segments_mode = nil)
|
61
|
-
|
56
|
+
stub_route_put({
|
62
57
|
route: {
|
63
58
|
incoming_path: path,
|
64
59
|
route_type: type,
|
@@ -67,29 +62,17 @@ module GdsApi
|
|
67
62
|
redirect_type: redirect_type,
|
68
63
|
segments_mode: segments_mode,
|
69
64
|
},
|
70
|
-
}
|
71
|
-
|
72
|
-
register_stub = stub_route_put(redirect)
|
73
|
-
commit_stub = stub_router_commit
|
74
|
-
[register_stub, commit_stub]
|
65
|
+
})
|
75
66
|
end
|
76
67
|
|
77
68
|
def stub_gone_route_registration(path, type)
|
78
|
-
|
69
|
+
stub_route_put({
|
79
70
|
route: {
|
80
71
|
incoming_path: path,
|
81
72
|
route_type: type,
|
82
73
|
handler: "gone",
|
83
74
|
},
|
84
|
-
}
|
85
|
-
|
86
|
-
register_stub = stub_route_put(route)
|
87
|
-
commit_stub = stub_router_commit
|
88
|
-
[register_stub, commit_stub]
|
89
|
-
end
|
90
|
-
|
91
|
-
def stub_router_commit
|
92
|
-
stub_http_request(:post, "#{ROUTER_API_ENDPOINT}/routes/commit")
|
75
|
+
})
|
93
76
|
end
|
94
77
|
|
95
78
|
private
|
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: 88.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: 2023-05-
|
11
|
+
date: 2023-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|