gds-api-adapters 87.0.0 → 88.0.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: e981660988eed87b9cc48de790fe7d569e3f87f23d517f02b3de113dca5b54cb
4
- data.tar.gz: 29cc9f3064a3af6ea39fa0c58552577b092aa52a3549e2d2a268e9a601e018f8
3
+ metadata.gz: 0fa52b3b12ddcdccdb616cec115476df62b8fc6867e57af88f5f548cb4329980
4
+ data.tar.gz: d17c3037dff01c916b918f540b148dce2ee32bca682892575cc40edc9fe4e98f
5
5
  SHA512:
6
- metadata.gz: 5d0c4b0d21493fa6f352bd86bdfe181f0994e8803b60fd7233cf43848dc87389ce313042c8aa1499684f87496231267eb61bb0bd069b5c208ca596d4a203064b
7
- data.tar.gz: 91ee52e953390ec47e4b6e507c5b6591476acb4de98fa683a39ef4423ba3c9cf5fd3b02ec245eebe199467f4d277934e868e22e1523fbdcb8e437f45919b460c
6
+ metadata.gz: ca21816f3109d107bf3997ccdd4024a9d0e9734196335585cffef04ee6f9d30e9a0b52dae76648671c766fb2a653499165ba2bcd92874e6112cfb8d2643f438a
7
+ data.tar.gz: 1012911579e99a24ce46ac7eb71d12c376ea42ba715240b61730ea262cb0a25de6767daef720f16780f8e59e935f09af5fe269d3e2ee567f8b877425c49e926b
@@ -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, options = {})
25
- response = put_json("#{endpoint}/routes", route: { incoming_path: path, route_type: type, handler: "backend", backend_id: backend_id })
26
- commit_routes if options[:commit]
27
- response
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
- response = put_json(
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, options = {})
48
- response = put_json("#{endpoint}/routes", route: { incoming_path: path, route_type: type, handler: "gone" })
49
- commit_routes if options[:commit]
50
- response
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, commit: 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
- response = delete_json(url)
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
@@ -5,11 +5,11 @@ module GdsApi
5
5
  module LocalLinksManager
6
6
  LOCAL_LINKS_MANAGER_ENDPOINT = Plek.find("local-links-manager")
7
7
 
8
- def stub_local_links_manager_has_a_link(authority_slug:, lgsl:, lgil:, url:, country_name: "England", status: "ok", snac: "00AG", local_custodian_code: nil)
8
+ def stub_local_links_manager_has_a_link(authority_slug:, lgsl:, lgil:, url:, country_name: "England", status: "ok", snac: "00AG", gss: "EE06000063", local_custodian_code: nil)
9
9
  response = {
10
10
  "local_authority" => {
11
11
  "name" => authority_slug.capitalize,
12
- "snac" => snac,
12
+ "gss" => gss,
13
13
  "tier" => "unitary",
14
14
  "homepage_url" => "http://#{authority_slug}.example.com",
15
15
  "country_name" => country_name,
@@ -22,6 +22,7 @@ module GdsApi
22
22
  "status" => status,
23
23
  },
24
24
  }
25
+ response["local_authority"]["snac"] = snac if snac
25
26
 
26
27
  stub_request(:get, "#{LOCAL_LINKS_MANAGER_ENDPOINT}/api/link")
27
28
  .with(query: { authority_slug: authority_slug, lgsl: lgsl, lgil: lgil })
@@ -34,17 +35,18 @@ module GdsApi
34
35
  end
35
36
  end
36
37
 
37
- def stub_local_links_manager_has_no_link(authority_slug:, lgsl:, lgil:, country_name: "England", snac: "00AG", local_custodian_code: nil)
38
+ def stub_local_links_manager_has_no_link(authority_slug:, lgsl:, lgil:, country_name: "England", snac: "00AG", gss: "EE06000063", local_custodian_code: nil)
38
39
  response = {
39
40
  "local_authority" => {
40
41
  "name" => authority_slug.capitalize,
41
- "snac" => snac,
42
+ "gss" => gss,
42
43
  "tier" => "unitary",
43
44
  "homepage_url" => "http://#{authority_slug}.example.com",
44
45
  "country_name" => country_name,
45
46
  "slug" => authority_slug,
46
47
  },
47
48
  }
49
+ response["local_authority"]["snac"] = snac if snac
48
50
 
49
51
  stub_request(:get, "#{LOCAL_LINKS_MANAGER_ENDPOINT}/api/link")
50
52
  .with(query: { authority_slug: authority_slug, lgsl: lgsl, lgil: lgil })
@@ -57,17 +59,18 @@ module GdsApi
57
59
  end
58
60
  end
59
61
 
60
- def stub_local_links_manager_has_no_link_and_no_homepage_url(authority_slug:, lgsl:, lgil:, country_name: "England", snac: "00AG", local_custodian_code: nil)
62
+ def stub_local_links_manager_has_no_link_and_no_homepage_url(authority_slug:, lgsl:, lgil:, country_name: "England", snac: "00AG", gss: "EE06000063", local_custodian_code: nil)
61
63
  response = {
62
64
  "local_authority" => {
63
65
  "name" => authority_slug.capitalize,
64
- "snac" => snac,
66
+ "gss" => gss,
65
67
  "tier" => "unitary",
66
68
  "homepage_url" => nil,
67
69
  "country_name" => country_name,
68
70
  "slug" => authority_slug,
69
71
  },
70
72
  }
73
+ response["local_authority"]["snac"] = snac if snac
71
74
 
72
75
  stub_request(:get, "#{LOCAL_LINKS_MANAGER_ENDPOINT}/api/link")
73
76
  .with(query: { authority_slug: authority_slug, lgsl: lgsl, lgil: lgil })
@@ -98,7 +101,7 @@ module GdsApi
98
101
  parameters
99
102
  end
100
103
 
101
- def stub_local_links_manager_has_a_local_authority(authority_slug, country_name: "England", snac: "00AG", local_custodian_code: nil)
104
+ def stub_local_links_manager_has_a_local_authority(authority_slug, country_name: "England", snac: "00AG", gss: "EE06000063", local_custodian_code: nil)
102
105
  response = {
103
106
  "local_authorities" => [
104
107
  {
@@ -107,10 +110,11 @@ module GdsApi
107
110
  "country_name" => country_name,
108
111
  "tier" => "unitary",
109
112
  "slug" => authority_slug,
110
- "snac" => snac,
113
+ "gss" => gss,
111
114
  },
112
115
  ],
113
116
  }
117
+ response["local_authorities"][0]["snac"] = snac if snac
114
118
 
115
119
  stub_request(:get, "#{LOCAL_LINKS_MANAGER_ENDPOINT}/api/local-authority")
116
120
  .with(query: { authority_slug: authority_slug })
@@ -123,7 +127,7 @@ module GdsApi
123
127
  end
124
128
  end
125
129
 
126
- def stub_local_links_manager_has_a_district_and_county_local_authority(district_slug, county_slug, district_snac: "00AG", county_snac: "00LC", local_custodian_code: nil)
130
+ def stub_local_links_manager_has_a_district_and_county_local_authority(district_slug, county_slug, district_snac: "00AG", county_snac: "00LC", district_gss: "EE06000063", county_gss: "EE06000064", local_custodian_code: nil)
127
131
  response = {
128
132
  "local_authorities" => [
129
133
  {
@@ -132,7 +136,7 @@ module GdsApi
132
136
  "country_name" => "England",
133
137
  "tier" => "district",
134
138
  "slug" => district_slug,
135
- "snac" => district_snac,
139
+ "gss" => district_gss,
136
140
  },
137
141
  {
138
142
  "name" => county_slug.capitalize,
@@ -140,10 +144,12 @@ module GdsApi
140
144
  "country_name" => "England",
141
145
  "tier" => "county",
142
146
  "slug" => county_slug,
143
- "snac" => county_snac,
147
+ "gss" => county_gss,
144
148
  },
145
149
  ],
146
150
  }
151
+ response["local_authorities"][0]["snac"] = district_snac if district_snac
152
+ response["local_authorities"][1]["snac"] = county_snac if county_snac
147
153
 
148
154
  stub_request(:get, "#{LOCAL_LINKS_MANAGER_ENDPOINT}/api/local-authority")
149
155
  .with(query: { authority_slug: district_slug })
@@ -180,7 +186,7 @@ module GdsApi
180
186
  .to_return(body: {}.to_json, status: 404)
181
187
  end
182
188
 
183
- def stub_local_links_manager_has_a_local_authority_without_homepage(authority_slug, country_name: "England", snac: "00AG", local_custodian_code: nil)
189
+ def stub_local_links_manager_has_a_local_authority_without_homepage(authority_slug, country_name: "England", snac: "00AG", gss: "EE06000063", local_custodian_code: nil)
184
190
  response = {
185
191
  "local_authorities" => [
186
192
  {
@@ -189,10 +195,11 @@ module GdsApi
189
195
  "country_name" => country_name,
190
196
  "tier" => "unitary",
191
197
  "slug" => authority_slug,
192
- "snac" => snac,
198
+ "gss" => gss,
193
199
  },
194
200
  ],
195
201
  }
202
+ response["local_authorities"][0]["snac"] = snac if snac
196
203
 
197
204
  stub_request(:get, "#{LOCAL_LINKS_MANAGER_ENDPOINT}/api/local-authority")
198
205
  .with(query: { authority_slug: authority_slug })
@@ -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
- route = {
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
- redirect = {
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
- route = {
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
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = "87.0.0".freeze
2
+ VERSION = "88.0.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: 87.0.0
4
+ version: 88.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: 2023-03-29 00:00:00.000000000 Z
11
+ date: 2023-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -417,7 +417,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
417
417
  - !ruby/object:Gem::Version
418
418
  version: '0'
419
419
  requirements: []
420
- rubygems_version: 3.4.10
420
+ rubygems_version: 3.4.13
421
421
  signing_key:
422
422
  specification_version: 4
423
423
  summary: Adapters to work with GDS APIs