gds-api-adapters 79.1.1 → 79.1.2

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: 56aec1e3622b0974b51878653be4dfc833cc7e4bb8668c788e19ba38666dbffe
4
- data.tar.gz: defee880c91c2c1ed568c5320a051ad938f6e1bb5a0d9a9e2f9ac705bc3c616a
3
+ metadata.gz: 659e2cb6bd909708fb12456695cc971240b79685ad35181bec90a365354c8dd9
4
+ data.tar.gz: 6e995ea0a6b68dc218a2eb05f0eabb9a413a4dbfffcc34745795cd20fdc6802b
5
5
  SHA512:
6
- metadata.gz: 2aa101d336e0151c5517bb15e7126489fd44cfbd9da7683f34a74865bf5f62ba051075feb990c22ed3cd34022ac5d5e120bb9924d3f116fc32ab1498bbda6db2
7
- data.tar.gz: 5d50b8fb50c41d00b1e99a500dffb3969a43d33d6df7bf7d6693a383ca1226e35b91b5d5072880a9b57cd41727225233d520110876efabbcd8f119ebf83e67df
6
+ metadata.gz: dde1459c2c812098ea2d830088970369ba1b9e87347b590d45a2e3be85551f8a833fb851e55c9f82079ebd749c1eda001d364ca07822005046f437b3101f61a6
7
+ data.tar.gz: d1a063b5239d0b4cf0e15c1fe90c1034358c5bd326942b2b778ea4b89923621f510816700af21eee0b71115f31e5dfa8997a982b29fbaeeefdb19a35b37a5f83
@@ -8,7 +8,7 @@ class GdsApi::LocationsApi < GdsApi::Base
8
8
  #
9
9
  # @return [Array] All local custodian codes for a specific postcode
10
10
  def local_custodian_code_for_postcode(postcode)
11
- response = get_json("#{endpoint}/locations?postcode=#{postcode}.json")
11
+ response = get_json("#{endpoint}/v1/locations?postcode=#{postcode}")
12
12
 
13
13
  return [] if response["results"].nil?
14
14
 
@@ -21,7 +21,7 @@ class GdsApi::LocationsApi < GdsApi::Base
21
21
  #
22
22
  # @return [Hash] The average coordinates (two fields, "latitude" and "longitude") for a specific postcode
23
23
  def coordinates_for_postcode(postcode)
24
- response = get_json("#{endpoint}/locations?postcode=#{postcode}.json")
24
+ response = get_json("#{endpoint}/v1/locations?postcode=#{postcode}")
25
25
 
26
26
  { "latitude" => response["average_latitude"], "longitude" => response["average_longitude"] } unless response["results"].nil?
27
27
  end
@@ -20,17 +20,17 @@ module GdsApi
20
20
  "results" => results,
21
21
  }
22
22
 
23
- stub_request(:get, "#{LOCATIONS_API_ENDPOINT}/locations?postcode=#{postcode}.json")
23
+ stub_request(:get, "#{LOCATIONS_API_ENDPOINT}/v1/locations?postcode=#{postcode}")
24
24
  .to_return(body: response.to_json, status: 200)
25
25
  end
26
26
 
27
27
  def stub_locations_api_has_no_location(postcode)
28
- stub_request(:get, "#{LOCATIONS_API_ENDPOINT}/locations?postcode=#{postcode}.json")
28
+ stub_request(:get, "#{LOCATIONS_API_ENDPOINT}/v1/locations?postcode=#{postcode}")
29
29
  .to_return(body: { "results" => nil }.to_json, status: 200)
30
30
  end
31
31
 
32
32
  def stub_locations_api_does_not_have_a_bad_postcode(postcode)
33
- stub_request(:get, "#{LOCATIONS_API_ENDPOINT}/locations?postcode=#{postcode}.json")
33
+ stub_request(:get, "#{LOCATIONS_API_ENDPOINT}/v1/locations?postcode=#{postcode}")
34
34
  .to_return(body: { "code" => 400, "error" => "Postcode '#{postcode}' is not valid." }.to_json, status: 400)
35
35
  end
36
36
  end
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = "79.1.1".freeze
2
+ VERSION = "79.1.2".freeze
3
3
  end
data/lib/gds_api.rb CHANGED
@@ -116,6 +116,13 @@ module GdsApi
116
116
  GdsApi::LocalLinksManager.new(Plek.find("local-links-manager"), options)
117
117
  end
118
118
 
119
+ # Creates a GdsApi::LocationsApi adapter
120
+ #
121
+ # @return [GdsApi::LocationsApi]
122
+ def self.locations_api(options = {})
123
+ GdsApi::LocationsApi.new(Plek.find("locations-api"), options)
124
+ end
125
+
119
126
  # Creates a GdsApi::Mapit adapter
120
127
  #
121
128
  # @return [GdsApi::Mapit]
@@ -202,11 +209,4 @@ module GdsApi
202
209
  def self.worldwide(options = {})
203
210
  GdsApi::Worldwide.new(Plek.new.website_root, options)
204
211
  end
205
-
206
- # Creates a GdsApi::LocationsApi adapter
207
- #
208
- # @return [GdsApi::LocationsApi]
209
- def self.locations_api(options = {})
210
- GdsApi::LocationsApi.new(Plek.find("locations-api"), options)
211
- end
212
212
  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: 79.1.1
4
+ version: 79.1.2
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-03-29 00:00:00.000000000 Z
11
+ date: 2022-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable