gds-api-adapters 68.1.0 → 68.2.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/mapit.rb +4 -0
- data/lib/gds_api/test_helpers/local_links_manager.rb +10 -3
- data/lib/gds_api/test_helpers/mapit.rb +14 -0
- 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: 6ec0fa71b77c5c2e4b44a7738181d36c6089b99b7afdfd5a34696261bdc0152c
|
4
|
+
data.tar.gz: 811610b3bdd0bd041886d456536ff40ec6ec1afa304d406df3298c37e4f0cf5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0199c4107477873935dfd75c2949bdd2e91034d17e9927df1668c6e214a46d84b5bb9b14abfb2898dcdfc2161ee657a9a8615d0d8ae9dd96a782e9c318c1772
|
7
|
+
data.tar.gz: 3b108e03797549bcb7dcdb6b14dad018f8ef3e8d4fc4be605a5468cbff7501960be91a1f441628dc9cea88548cef4b37b53f19d17a5eb5c62568187c67d0ad8d
|
data/lib/gds_api/mapit.rb
CHANGED
@@ -5,13 +5,14 @@ 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:)
|
8
|
+
def stub_local_links_manager_has_a_link(authority_slug:, lgsl:, lgil:, url:, country_name: "England")
|
9
9
|
response = {
|
10
10
|
"local_authority" => {
|
11
11
|
"name" => authority_slug.capitalize,
|
12
12
|
"snac" => "00AG",
|
13
13
|
"tier" => "unitary",
|
14
14
|
"homepage_url" => "http://#{authority_slug}.example.com",
|
15
|
+
"country_name" => country_name,
|
15
16
|
},
|
16
17
|
"local_interaction" => {
|
17
18
|
"lgsl_code" => lgsl,
|
@@ -25,13 +26,14 @@ module GdsApi
|
|
25
26
|
.to_return(body: response.to_json, status: 200)
|
26
27
|
end
|
27
28
|
|
28
|
-
def stub_local_links_manager_has_no_link(authority_slug:, lgsl:, lgil:)
|
29
|
+
def stub_local_links_manager_has_no_link(authority_slug:, lgsl:, lgil:, country_name: "England")
|
29
30
|
response = {
|
30
31
|
"local_authority" => {
|
31
32
|
"name" => authority_slug.capitalize,
|
32
33
|
"snac" => "00AG",
|
33
34
|
"tier" => "unitary",
|
34
35
|
"homepage_url" => "http://#{authority_slug}.example.com",
|
36
|
+
"country_name" => country_name,
|
35
37
|
},
|
36
38
|
}
|
37
39
|
|
@@ -40,13 +42,14 @@ module GdsApi
|
|
40
42
|
.to_return(body: response.to_json, status: 200)
|
41
43
|
end
|
42
44
|
|
43
|
-
def stub_local_links_manager_has_no_link_and_no_homepage_url(authority_slug:, lgsl:, lgil:)
|
45
|
+
def stub_local_links_manager_has_no_link_and_no_homepage_url(authority_slug:, lgsl:, lgil:, country_name: "England")
|
44
46
|
response = {
|
45
47
|
"local_authority" => {
|
46
48
|
"name" => authority_slug.capitalize,
|
47
49
|
"snac" => "00AG",
|
48
50
|
"tier" => "unitary",
|
49
51
|
"homepage_url" => nil,
|
52
|
+
"country_name" => country_name,
|
50
53
|
},
|
51
54
|
}
|
52
55
|
|
@@ -82,6 +85,7 @@ module GdsApi
|
|
82
85
|
{
|
83
86
|
"name" => authority_slug.capitalize,
|
84
87
|
"homepage_url" => "http://#{authority_slug}.example.com",
|
88
|
+
"country_name" => "England",
|
85
89
|
"tier" => "unitary",
|
86
90
|
},
|
87
91
|
],
|
@@ -98,11 +102,13 @@ module GdsApi
|
|
98
102
|
{
|
99
103
|
"name" => district_slug.capitalize,
|
100
104
|
"homepage_url" => "http://#{district_slug}.example.com",
|
105
|
+
"country_name" => "England",
|
101
106
|
"tier" => "district",
|
102
107
|
},
|
103
108
|
{
|
104
109
|
"name" => county_slug.capitalize,
|
105
110
|
"homepage_url" => "http://#{county_slug}.example.com",
|
111
|
+
"country_name" => "England",
|
106
112
|
"tier" => "county",
|
107
113
|
},
|
108
114
|
],
|
@@ -131,6 +137,7 @@ module GdsApi
|
|
131
137
|
{
|
132
138
|
"name" => authority_slug.capitalize,
|
133
139
|
"homepage_url" => "",
|
140
|
+
"country_name" => "England",
|
134
141
|
"tier" => "unitary",
|
135
142
|
},
|
136
143
|
],
|
@@ -43,6 +43,20 @@ module GdsApi
|
|
43
43
|
.to_return(body: response.to_json, status: 200)
|
44
44
|
end
|
45
45
|
|
46
|
+
def stub_mapit_has_a_postcode_and_country_name(postcode, coords, country_name)
|
47
|
+
response = {
|
48
|
+
"wgs84_lat" => coords.first,
|
49
|
+
"wgs84_lon" => coords.last,
|
50
|
+
"postcode" => postcode,
|
51
|
+
"country_name" => country_name,
|
52
|
+
}
|
53
|
+
|
54
|
+
stub_request(:get, "#{MAPIT_ENDPOINT}/postcode/" + postcode.tr(" ", "+") + ".json")
|
55
|
+
.to_return(body: response.to_json, status: 200)
|
56
|
+
stub_request(:get, "#{MAPIT_ENDPOINT}/postcode/partial/" + postcode.split(" ").first + ".json")
|
57
|
+
.to_return(body: response.to_json, status: 200)
|
58
|
+
end
|
59
|
+
|
46
60
|
def stub_mapit_does_not_have_a_postcode(postcode)
|
47
61
|
stub_request(:get, "#{MAPIT_ENDPOINT}/postcode/" + postcode.tr(" ", "+") + ".json")
|
48
62
|
.to_return(body: { "code" => 404, "error" => "No Postcode matches the given query." }.to_json, status: 404)
|
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: 68.
|
4
|
+
version: 68.2.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-01-
|
11
|
+
date: 2021-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|