gds-api-adapters 81.0.1 → 81.0.4

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: 8fca55d695f003f76bfe73bdec79add86ab4a2b25efadedf0f25690f54c20d4f
4
- data.tar.gz: 12f119f94ca114d7b2c3ae3eab96554c2ec84d3cbac61c2bb8d0a502e006d022
3
+ metadata.gz: 66c70fc3c5113cb579afbccfbca8acc7254ad94f5364bc649dd965e43c06b0be
4
+ data.tar.gz: 9d06eab53ce1687a7cea9488d69d5a5625b34c0ce1a76f56e4cc30f5d1130e7a
5
5
  SHA512:
6
- metadata.gz: 126f6602485893e0a6fd0731ecc579f575d2d2516f0d47a4ee23029c2bcfd0ef20750b97f01fee5a70187587ea399c6e602be69b8ddca273af1cae831cd4808d
7
- data.tar.gz: 2bab839794240cfd0b23a04f36c0a4395377e5fd765f4548a844ce27ec868bf58055059046499ddd862dadbb3a6a9e360dd59f215e5eb1f469f8a17e6f7f3eba
6
+ metadata.gz: ba545b1ba297060debce12f44352d074c945985bdda877f150d436a460946b09134554c08b487c7be640894c4496c3aded73bddd67ca734226a9d480cba7eea5
7
+ data.tar.gz: 6f82e7bf9eeb166d9353e6104fb9a03fd9c8be1cd17f43eeb750f5e0aa763209b36ddc69c3184b61bb7e066fe02152d161b98ec0ff9cd20989e5206ee0b64db6
@@ -5,11 +5,11 @@ module GdsApi
5
5
  module LocalLinksManager
6
6
  LOCAL_LINKS_MANAGER_ENDPOINT = Plek.current.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", 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", local_custodian_code: nil)
9
9
  response = {
10
10
  "local_authority" => {
11
11
  "name" => authority_slug.capitalize,
12
- "snac" => "00AG",
12
+ "snac" => snac,
13
13
  "tier" => "unitary",
14
14
  "homepage_url" => "http://#{authority_slug}.example.com",
15
15
  "country_name" => country_name,
@@ -34,11 +34,11 @@ module GdsApi
34
34
  end
35
35
  end
36
36
 
37
- def stub_local_links_manager_has_no_link(authority_slug:, lgsl:, lgil:, country_name: "England", local_custodian_code: nil)
37
+ def stub_local_links_manager_has_no_link(authority_slug:, lgsl:, lgil:, country_name: "England", snac: "00AG", local_custodian_code: nil)
38
38
  response = {
39
39
  "local_authority" => {
40
40
  "name" => authority_slug.capitalize,
41
- "snac" => "00AG",
41
+ "snac" => snac,
42
42
  "tier" => "unitary",
43
43
  "homepage_url" => "http://#{authority_slug}.example.com",
44
44
  "country_name" => country_name,
@@ -57,11 +57,11 @@ module GdsApi
57
57
  end
58
58
  end
59
59
 
60
- def stub_local_links_manager_has_no_link_and_no_homepage_url(authority_slug:, lgsl:, lgil:, country_name: "England", local_custodian_code: nil)
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)
61
61
  response = {
62
62
  "local_authority" => {
63
63
  "name" => authority_slug.capitalize,
64
- "snac" => "00AG",
64
+ "snac" => snac,
65
65
  "tier" => "unitary",
66
66
  "homepage_url" => nil,
67
67
  "country_name" => country_name,
@@ -98,15 +98,16 @@ module GdsApi
98
98
  parameters
99
99
  end
100
100
 
101
- def stub_local_links_manager_has_a_local_authority(authority_slug, local_custodian_code: nil)
101
+ def stub_local_links_manager_has_a_local_authority(authority_slug, country_name: "England", snac: "00AG", local_custodian_code: nil)
102
102
  response = {
103
103
  "local_authorities" => [
104
104
  {
105
105
  "name" => authority_slug.capitalize,
106
106
  "homepage_url" => "http://#{authority_slug}.example.com",
107
- "country_name" => "England",
107
+ "country_name" => country_name,
108
108
  "tier" => "unitary",
109
109
  "slug" => authority_slug,
110
+ "snac" => snac,
110
111
  },
111
112
  ],
112
113
  }
@@ -122,7 +123,7 @@ module GdsApi
122
123
  end
123
124
  end
124
125
 
125
- def stub_local_links_manager_has_a_district_and_county_local_authority(district_slug, county_slug, local_custodian_code: nil)
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)
126
127
  response = {
127
128
  "local_authorities" => [
128
129
  {
@@ -131,6 +132,7 @@ module GdsApi
131
132
  "country_name" => "England",
132
133
  "tier" => "district",
133
134
  "slug" => district_slug,
135
+ "snac" => district_snac,
134
136
  },
135
137
  {
136
138
  "name" => county_slug.capitalize,
@@ -138,6 +140,7 @@ module GdsApi
138
140
  "country_name" => "England",
139
141
  "tier" => "county",
140
142
  "slug" => county_slug,
143
+ "snac" => county_snac,
141
144
  },
142
145
  ],
143
146
  }
@@ -177,15 +180,16 @@ module GdsApi
177
180
  .to_return(body: {}.to_json, status: 404)
178
181
  end
179
182
 
180
- def stub_local_links_manager_has_a_local_authority_without_homepage(authority_slug)
183
+ def stub_local_links_manager_has_a_local_authority_without_homepage(authority_slug, country_name: "England", snac: "00AG", local_custodian_code: nil)
181
184
  response = {
182
185
  "local_authorities" => [
183
186
  {
184
187
  "name" => authority_slug.capitalize,
185
188
  "homepage_url" => "",
186
- "country_name" => "England",
189
+ "country_name" => country_name,
187
190
  "tier" => "unitary",
188
191
  "slug" => authority_slug,
192
+ "snac" => snac,
189
193
  },
190
194
  ],
191
195
  }
@@ -193,6 +197,12 @@ module GdsApi
193
197
  stub_request(:get, "#{LOCAL_LINKS_MANAGER_ENDPOINT}/api/local-authority")
194
198
  .with(query: { authority_slug: authority_slug })
195
199
  .to_return(body: response.to_json, status: 200)
200
+
201
+ unless local_custodian_code.nil?
202
+ stub_request(:get, "#{LOCAL_LINKS_MANAGER_ENDPOINT}/api/local-authority")
203
+ .with(query: { local_custodian_code: local_custodian_code })
204
+ .to_return(body: response.to_json, status: 200)
205
+ end
196
206
  end
197
207
  end
198
208
  end
@@ -7,8 +7,8 @@ module GdsApi
7
7
  results = []
8
8
  locations.each do |l|
9
9
  results << {
10
- "latitude" => l["latitude"],
11
- "longitude" => l["longitude"],
10
+ "latitude" => l["latitude"] || 0,
11
+ "longitude" => l["longitude"] || 0,
12
12
  "postcode" => postcode,
13
13
  "local_custodian_code" => l["local_custodian_code"],
14
14
  }
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = "81.0.1".freeze
2
+ VERSION = "81.0.4".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: 81.0.1
4
+ version: 81.0.4
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: 2022-07-25 00:00:00.000000000 Z
11
+ date: 2022-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable