courtfinder-client 0.0.5 → 0.0.6
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 +4 -4
- data/courtfinder-client.gemspec +11 -10
- data/lib/courtfinder/client.rb +27 -15
- data/lib/courtfinder/client/version.rb +1 -1
- data/spec/client_spec.rb +12 -75
- data/spec/spec_helper.rb +18 -78
- data/spec/vcr/Courtfinder_Client_HousingPossession/_get/with_invalid_postcode/should_return_empty_array.yml +42 -0
- data/spec/vcr/Courtfinder_Client_HousingPossession/_get/with_valid_postcode/when_given_postcode_with_no_spaces/should_return_the_court_address.yml +117 -0
- data/spec/vcr/Courtfinder_Client_HousingPossession/_get/with_valid_postcode/when_given_postcode_with_spaces/should_return_the_court_address.yml +117 -0
- metadata +28 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: beae704d76c8fc0cac9c0dded79a61c1d85bb433
|
4
|
+
data.tar.gz: bb59fc51957b6139b3f8db4fdc86cb1c62a56785
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e5e61da5175c86d809fdf93b0cc56551c11212264024680f2771dd33355d63fc02b52c44f1637a5d16b5ed7d8a5cd9cf27f0d3f0661f7329150917e40c48597
|
7
|
+
data.tar.gz: 647038b4c6a06bc6432735ea0cbe5c44d8ca39c9351f4e6eee08a390c7b40c64f7206bf4b2058ac59c2871be7b1ad6fbcadf7d3c678b6384f93af7c15b9d8d61
|
data/courtfinder-client.gemspec
CHANGED
@@ -4,23 +4,24 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'courtfinder/client/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'courtfinder-client'
|
8
8
|
spec.version = Courtfinder::Client::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Aleksandar Simić']
|
10
|
+
spec.email = ['alex.simic@digital.justice.gov.uk']
|
11
11
|
spec.summary = %q{Courtfinder client gem}
|
12
12
|
spec.description = %q{https://courttribunalfinder.service.gov.uk/ API client}
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
13
|
+
spec.homepage = 'https://github.com/ministryofjustice/courtfinder-client'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.3'
|
23
|
+
spec.add_development_dependency 'rspec', '~> 3.1'
|
24
|
+
spec.add_development_dependency 'excon', '~> 0.41'
|
25
|
+
spec.add_development_dependency 'vcr', '~> 2.9'
|
26
|
+
spec.add_development_dependency 'webmock', '~> 1.20'
|
26
27
|
end
|
data/lib/courtfinder/client.rb
CHANGED
@@ -1,23 +1,24 @@
|
|
1
1
|
require 'courtfinder/client/version'
|
2
|
-
require '
|
2
|
+
require 'excon'
|
3
3
|
require 'json'
|
4
4
|
require 'uri'
|
5
5
|
|
6
6
|
module Courtfinder
|
7
|
-
SERVER = 'https://courttribunalfinder.service.gov.uk
|
7
|
+
SERVER = 'https://courttribunalfinder.service.gov.uk'
|
8
8
|
module Client
|
9
9
|
class HousingPossession
|
10
|
-
PATH='/search/results.json?
|
11
|
-
|
10
|
+
PATH='/search/results.json?aol=Housing+possession&postcode='
|
12
11
|
def get postcode
|
13
12
|
conn = nil
|
14
13
|
begin
|
15
14
|
endpoint = "#{Courtfinder::SERVER}#{PATH}#{URI.escape(postcode)}"
|
16
|
-
|
17
|
-
|
18
|
-
rescue
|
19
|
-
|
15
|
+
conn = Excon.get(endpoint, :read_timeout => 90)
|
16
|
+
check_for_error_code conn
|
17
|
+
rescue Excon::Errors::RequestTimeout
|
18
|
+
@json = { error: 'timeout' }
|
20
19
|
end
|
20
|
+
|
21
|
+
@json
|
21
22
|
end
|
22
23
|
|
23
24
|
def empty?
|
@@ -26,16 +27,27 @@ module Courtfinder
|
|
26
27
|
|
27
28
|
private
|
28
29
|
|
30
|
+
def check_for_error_code response
|
31
|
+
process response.body if response.status == 200
|
32
|
+
@json = { error: 'timeout' } if response.status == 400
|
33
|
+
@json = { error: "postcode couldn't be found" } if response.status == 500
|
34
|
+
end
|
35
|
+
|
29
36
|
def process data
|
30
37
|
begin
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
@json.each do |court|
|
35
|
-
unwanted_attributes.each {|attr| court.delete attr }
|
36
|
-
end
|
38
|
+
parsed = JSON.parse data
|
39
|
+
@json = (parsed.size > 1) ? [parsed[0]] : parsed
|
40
|
+
cleanup_court_data
|
37
41
|
rescue JSON::ParserError
|
38
|
-
@json =
|
42
|
+
@json = { error: 'invalid JSON returned' }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def cleanup_court_data
|
47
|
+
unwanted_attributes = ['areas_of_law', 'slug', 'dx_number',
|
48
|
+
'lon', 'lat', 'types', 'number', 'distance']
|
49
|
+
@json.each do |court|
|
50
|
+
unwanted_attributes.each {|attr| court.delete attr }
|
39
51
|
end
|
40
52
|
end
|
41
53
|
end
|
data/spec/client_spec.rb
CHANGED
@@ -1,10 +1,6 @@
|
|
1
|
-
require 'webmock/rspec'
|
2
|
-
require_relative 'support/helper'
|
3
1
|
require 'courtfinder/client'
|
4
2
|
|
5
3
|
describe Courtfinder::Client::HousingPossession do
|
6
|
-
before { WebMock.disable_net_connect! }
|
7
|
-
|
8
4
|
let(:result) do
|
9
5
|
[{ "name" => "Cambridge County Court and Family Court",
|
10
6
|
"address" =>
|
@@ -18,104 +14,45 @@ describe Courtfinder::Client::HousingPossession do
|
|
18
14
|
}
|
19
15
|
}]
|
20
16
|
end
|
17
|
+
|
21
18
|
let(:client) { Courtfinder::Client::HousingPossession.new }
|
22
19
|
|
23
20
|
def full_url postcode
|
24
21
|
"#{Courtfinder::SERVER}#{Courtfinder::Client::HousingPossession::PATH}#{postcode}"
|
25
22
|
end
|
26
23
|
|
27
|
-
def stub_with postcode
|
28
|
-
stub_request(:get, full_url(postcode))
|
29
|
-
.to_return(:body => fixture('result.json'),
|
30
|
-
:headers => {:content_type => 'application/json; charset=utf-8'})
|
31
|
-
end
|
32
|
-
|
33
|
-
def blank_result postcode
|
34
|
-
stub_request(:get, full_url(postcode))
|
35
|
-
.to_return(:status => 200,
|
36
|
-
:body => '[]',
|
37
|
-
:headers => {})
|
38
|
-
end
|
39
|
-
|
40
|
-
def error_result postcode
|
41
|
-
stub_request(:get, full_url(postcode))
|
42
|
-
.to_return(:status => 404,
|
43
|
-
:body => '',
|
44
|
-
:headers => {})
|
45
|
-
end
|
46
|
-
|
47
24
|
describe '.get' do
|
48
25
|
context 'with valid postcode' do
|
49
26
|
context 'when given postcode with no spaces' do
|
50
27
|
let(:postcode) { 'sg80lt' }
|
51
|
-
before { stub_with postcode }
|
52
28
|
|
53
|
-
it 'should return the court address' do
|
54
|
-
expect(client.get(postcode)).to
|
29
|
+
it 'should return the court address', :vcr do
|
30
|
+
expect(client.get(postcode)).to match result
|
55
31
|
end
|
56
32
|
end
|
57
33
|
|
58
34
|
context 'when given postcode with spaces' do
|
59
35
|
let(:postcode) { 'SG8 0LT' }
|
60
|
-
before { stub_with postcode }
|
61
36
|
|
62
|
-
it 'should return the court address' do
|
37
|
+
it 'should return the court address', :vcr do
|
63
38
|
expect(client.get(postcode)).to eql result
|
64
39
|
end
|
65
40
|
end
|
66
|
-
|
67
|
-
context 'when a timeout occurs' do
|
68
|
-
let(:postcode) { 'SG8 0LT' }
|
69
|
-
before do
|
70
|
-
stub_request(:get, full_url(postcode))
|
71
|
-
.to_raise(Timeout::Error)
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'should return a blank array' do
|
75
|
-
expect(client.get(full_url(postcode))).to eql []
|
76
|
-
end
|
77
|
-
end
|
78
41
|
end
|
79
42
|
|
80
|
-
context '
|
81
|
-
|
82
|
-
postcode = 'fake'
|
83
|
-
blank_result postcode
|
84
|
-
expect(client.get(postcode)).to eql []
|
85
|
-
end
|
86
|
-
|
87
|
-
it 'should not raise an error' do
|
88
|
-
postcode = 'break'
|
89
|
-
error_result postcode
|
90
|
-
expect { client.get(postcode) }.not_to raise_error
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
describe '.empty?' do
|
96
|
-
context 'when there are results returned' do
|
97
|
-
let(:postcode) { 'SG8 0LT' }
|
98
|
-
|
99
|
-
before do
|
100
|
-
stub_with postcode
|
101
|
-
client.get postcode
|
102
|
-
end
|
43
|
+
context 'with invalid postcode' do
|
44
|
+
let(:postcode) { 'fake' }
|
103
45
|
|
104
|
-
it 'should
|
105
|
-
expect(client.
|
46
|
+
it 'should return empty array', :vcr do
|
47
|
+
expect(client.get(postcode)).to match({ :error => "postcode couldn't be found" })
|
106
48
|
end
|
107
49
|
end
|
108
50
|
|
109
|
-
context 'when
|
110
|
-
let(:postcode) { '
|
111
|
-
|
112
|
-
before do
|
113
|
-
blank_result postcode
|
114
|
-
client.get postcode
|
115
|
-
end
|
51
|
+
context 'when a timeout happens' do
|
52
|
+
let(:postcode) { 'SW1H9AJ' }
|
116
53
|
|
117
|
-
it 'should
|
118
|
-
expect(client.
|
54
|
+
it 'should return an error', :vcr do
|
55
|
+
expect(client.get(postcode)).to match({ :error => 'timeout' })
|
119
56
|
end
|
120
57
|
end
|
121
58
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,89 +1,29 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
# will add to the boot time of your test suite on EVERY test run, even for an
|
9
|
-
# individual file that may not need all of that loaded. Instead, consider making
|
10
|
-
# a separate helper file that requires the additional dependencies and performs
|
11
|
-
# the additional setup, and require it from the spec files that actually need it.
|
12
|
-
#
|
13
|
-
# The `.rspec` file also contains a few flags that are not defaults but that
|
14
|
-
# users commonly want.
|
15
|
-
#
|
16
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
1
|
+
require 'webmock'
|
2
|
+
require 'webmock/rspec'
|
3
|
+
require 'vcr'
|
4
|
+
require_relative 'support/helper'
|
5
|
+
require 'courtfinder/client'
|
6
|
+
|
7
|
+
|
17
8
|
RSpec.configure do |config|
|
18
|
-
# rspec-expectations config goes here. You can use an alternate
|
19
|
-
# assertion/expectation library such as wrong or the stdlib/minitest
|
20
|
-
# assertions if you prefer.
|
21
9
|
config.expect_with :rspec do |expectations|
|
22
|
-
# This option will default to `true` in RSpec 4. It makes the `description`
|
23
|
-
# and `failure_message` of custom matchers include text for helper methods
|
24
|
-
# defined using `chain`, e.g.:
|
25
|
-
# be_bigger_than(2).and_smaller_than(4).description
|
26
|
-
# # => "be bigger than 2 and smaller than 4"
|
27
|
-
# ...rather than:
|
28
|
-
# # => "be bigger than 2"
|
29
10
|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
30
11
|
end
|
31
12
|
|
32
|
-
# rspec-mocks config goes here. You can use an alternate test double
|
33
|
-
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
34
13
|
config.mock_with :rspec do |mocks|
|
35
|
-
# Prevents you from mocking or stubbing a method that does not exist on
|
36
|
-
# a real object. This is generally recommended, and will default to
|
37
|
-
# `true` in RSpec 4.
|
38
14
|
mocks.verify_partial_doubles = true
|
39
15
|
end
|
40
16
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
# For more details, see:
|
53
|
-
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
54
|
-
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
55
|
-
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
56
|
-
config.disable_monkey_patching!
|
57
|
-
|
58
|
-
# This setting enables warnings. It's recommended, but in some cases may
|
59
|
-
# be too noisy due to issues in dependencies.
|
60
|
-
config.warnings = true
|
61
|
-
|
62
|
-
# Many RSpec users commonly either run the entire suite or an individual
|
63
|
-
# file, and it's useful to allow more verbose output when running an
|
64
|
-
# individual spec file.
|
65
|
-
if config.files_to_run.one?
|
66
|
-
# Use the documentation formatter for detailed output,
|
67
|
-
# unless a formatter has already been configured
|
68
|
-
# (e.g. via a command-line flag).
|
69
|
-
config.default_formatter = 'doc'
|
17
|
+
VCR.configure do |config|
|
18
|
+
config.default_cassette_options = { :record => :new_episodes }
|
19
|
+
config.configure_rspec_metadata!
|
20
|
+
config.cassette_library_dir = 'spec/vcr'
|
21
|
+
config.allow_http_connections_when_no_cassette = true
|
22
|
+
config.hook_into :excon
|
23
|
+
config.before_http_request do |request|
|
24
|
+
if request.uri == "#{Courtfinder::SERVER}#{Courtfinder::Client::HousingPossession::PATH}SW1H9AJ"
|
25
|
+
raise Excon::Errors::RequestTimeout.new('Boom')
|
26
|
+
end
|
27
|
+
end
|
70
28
|
end
|
71
|
-
|
72
|
-
# Print the 10 slowest examples and example groups at the
|
73
|
-
# end of the spec run, to help surface which specs are running
|
74
|
-
# particularly slow.
|
75
|
-
config.profile_examples = 10
|
76
|
-
|
77
|
-
# Run specs in random order to surface order dependencies. If you find an
|
78
|
-
# order dependency and want to debug it, you can fix the order by providing
|
79
|
-
# the seed, which is printed after each run.
|
80
|
-
# --seed 1234
|
81
|
-
config.order = :random
|
82
|
-
|
83
|
-
# Seed global randomization in this process using the `--seed` CLI option.
|
84
|
-
# Setting this allows you to use `--seed` to deterministically reproduce
|
85
|
-
# test failures related to randomization by passing the same `--seed` value
|
86
|
-
# as the one that triggered the failure.
|
87
|
-
Kernel.srand config.seed
|
88
|
-
=end
|
89
29
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://courttribunalfinder.service.gov.uk/search/results.json?aol=Housing+possession&postcode=fake
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- excon/0.41.0
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 500
|
15
|
+
message:
|
16
|
+
headers:
|
17
|
+
Server:
|
18
|
+
- nginx/1.4.6
|
19
|
+
Date:
|
20
|
+
- Mon, 24 Nov 2014 12:17:54 GMT
|
21
|
+
Content-Type:
|
22
|
+
- application/json
|
23
|
+
Content-Length:
|
24
|
+
- '94'
|
25
|
+
Connection:
|
26
|
+
- keep-alive
|
27
|
+
X-Frame-Options:
|
28
|
+
- SAMEORIGIN
|
29
|
+
Accept-Ranges:
|
30
|
+
- bytes
|
31
|
+
X-Varnish:
|
32
|
+
- '697574197'
|
33
|
+
Age:
|
34
|
+
- '0'
|
35
|
+
Via:
|
36
|
+
- 1.1 varnish
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"error":"MapIt doesn''t know this postcode: http://mapit.mysociety.org/postcode/partial/fake"}'
|
40
|
+
http_version:
|
41
|
+
recorded_at: Mon, 24 Nov 2014 12:17:54 GMT
|
42
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,117 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://courttribunalfinder.service.gov.uk/search/results.json?aol=Housing+possession&postcode=sg80lt
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- excon/0.41.0
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message:
|
16
|
+
headers:
|
17
|
+
Server:
|
18
|
+
- nginx/1.4.6
|
19
|
+
Date:
|
20
|
+
- Mon, 24 Nov 2014 12:17:53 GMT
|
21
|
+
Content-Type:
|
22
|
+
- application/json
|
23
|
+
Content-Length:
|
24
|
+
- '5941'
|
25
|
+
Connection:
|
26
|
+
- keep-alive
|
27
|
+
Vary:
|
28
|
+
- Accept-Encoding
|
29
|
+
X-Frame-Options:
|
30
|
+
- SAMEORIGIN
|
31
|
+
Accept-Ranges:
|
32
|
+
- bytes
|
33
|
+
X-Varnish:
|
34
|
+
- '697574194'
|
35
|
+
Age:
|
36
|
+
- '0'
|
37
|
+
Via:
|
38
|
+
- 1.1 varnish
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: '[{"distance": 14.32, "name": "Cambridge County Court and Family Court",
|
42
|
+
"address": {"town": "Cambridge", "address_lines": ["Cambridge County Court
|
43
|
+
and Family Court Hearing Centre", "197 East Road"], "type": "Postal", "postcode":
|
44
|
+
"CB1 1BA", "county": "Cambridgeshire"}, "lat": 52.2037125926829, "dx_number":
|
45
|
+
"97650 Cambridge 3", "areas_of_law": ["Forced marriage", "Adoption", "Money
|
46
|
+
claims", "Domestic violence", "Children", "Housing possession", "High court",
|
47
|
+
"Bankruptcy", "Divorce"], "lon": 0.132065389149123, "number": 162, "types":
|
48
|
+
["Family court", "County Court"], "slug": "cambridge-county-court-and-family-court"},
|
49
|
+
{"distance": 15.49, "name": "Bedford County Court and Family Court", "address":
|
50
|
+
{"town": "Bedford", "address_lines": ["Bedford County Court and Family Court
|
51
|
+
Hearing Centre", "P.O. Box 1405", "3 St Paul''s Square"], "type": "Postal",
|
52
|
+
"postcode": "MK40 9DN", "county": "Bedfordshire"}, "lat": 52.1350290338706,
|
53
|
+
"dx_number": "97590 Bedford 3", "areas_of_law": ["Children", "Divorce", "Domestic
|
54
|
+
violence", "Bankruptcy", "High court", "Money claims", "Housing possession"],
|
55
|
+
"lon": -0.467880322006416, "number": 124, "types": ["County Court", "Family
|
56
|
+
court"], "slug": "bedford-county-court-and-family-court"}, {"distance": 18.02,
|
57
|
+
"name": "Luton County Court and Family Court", "address": {"town": "Luton",
|
58
|
+
"address_lines": ["Luton County Court and Family Court Hearing Centre", "2nd
|
59
|
+
Floor", "Cresta House", "Alma Street"], "type": "Postal", "postcode": "LU1
|
60
|
+
2PU", "county": "Bedfordshire"}, "lat": 51.8811279872015, "dx_number": "97760
|
61
|
+
Luton 4", "areas_of_law": ["Money claims", "Domestic violence", "Housing possession",
|
62
|
+
"Forced marriage", "Adoption", "Bankruptcy", "High court", "Divorce", "Children"],
|
63
|
+
"lon": -0.418919711521327, "number": 258, "types": ["Family court", "County
|
64
|
+
Court"], "slug": "luton-county-court-and-family-court"}, {"distance": 18.75,
|
65
|
+
"name": "Hertford County Court and Family Court", "address": {"town": "Hertford",
|
66
|
+
"address_lines": ["Hertford County Court and Family Hearing Centre", "P.O.Box
|
67
|
+
373"], "type": "Postal", "postcode": "SG13 9HT", "county": "Hertfordshire"},
|
68
|
+
"lat": 51.796089552427, "dx_number": "97710 Hertford 2", "areas_of_law": ["Children",
|
69
|
+
"Divorce", "Forced marriage", "Domestic violence", "Bankruptcy", "Money claims",
|
70
|
+
"Housing possession", "Adoption"], "lon": -0.0765909721207512, "number": 221,
|
71
|
+
"types": ["County Court", "Family court"], "slug": "hertford-county-court-and-family-court"},
|
72
|
+
{"distance": 23.59, "name": "St Albans County Court", "address": {"town":
|
73
|
+
"St. Albans", "address_lines": ["St Albans County Court", "The Court Building",
|
74
|
+
"Bricket Road"], "type": "Postal", "postcode": "AL1 3JW", "county": "Hertfordshire"},
|
75
|
+
"lat": 51.7516188860504, "dx_number": "97770 St Albans 2", "areas_of_law":
|
76
|
+
["Bankruptcy", "Money claims", "Housing possession"], "lon": -0.335521986503323,
|
77
|
+
"number": 313, "types": ["County Court"], "slug": "st-albans-county-court"},
|
78
|
+
{"distance": 27.45, "name": "Milton Keynes County Court and Family Court",
|
79
|
+
"address": {"town": "Central Milton Keynes", "address_lines": ["Milton Keynes
|
80
|
+
County Court and Family Court Hearing Centre", "351 Silbury Boulevard", "Witan
|
81
|
+
Gate East"], "type": "Postal", "postcode": "MK9 2DT", "county": "Buckinghamshire"},
|
82
|
+
"lat": 52.0412079044384, "dx_number": "136266 Milton Keynes 6", "areas_of_law":
|
83
|
+
["Forced marriage", "Money claims", "Divorce", "Domestic violence", "Children",
|
84
|
+
"Adoption", "Housing possession", "Bankruptcy", "High court"], "lon": -0.765354379292703,
|
85
|
+
"number": 388, "types": ["County Court", "Family court"], "slug": "milton-keynes-county-court-and-family-court"},
|
86
|
+
{"distance": 30.24, "name": "Watford County Court and Family Court", "address":
|
87
|
+
{"town": "Watford", "address_lines": ["Watford County Court and Family Court
|
88
|
+
Hearing Centre", "3rd Floor", "Cassiobury House", "11-19 Station Road"], "type":
|
89
|
+
"Postal", "postcode": "WD17 1EZ", "county": "Hertfordshire"}, "lat": 51.663675400498,
|
90
|
+
"dx_number": "122740 Watford 5 ", "areas_of_law": ["Children", "Divorce",
|
91
|
+
"Forced marriage", "Domestic violence", "Money claims", "Housing possession",
|
92
|
+
"Adoption"], "lon": -0.398796389317627, "number": 362, "types": ["County Court",
|
93
|
+
"Family court"], "slug": "watford-county-court-and-family-court"}, {"distance":
|
94
|
+
31.55, "name": "Edmonton County Court and Family Court", "address": {"town":
|
95
|
+
"Edmonton", "address_lines": ["Hearing Centre", "Court House", "59 Fore Street"],
|
96
|
+
"type": "Postal", "postcode": "N18 2TN", "county": "London"}, "lat": 51.6107379724959,
|
97
|
+
"dx_number": "136686 Edmonton 3", "areas_of_law": ["Children", "Divorce",
|
98
|
+
"Domestic violence", "Money claims", "Housing possession"], "lon": -0.0660789741569261,
|
99
|
+
"number": 194, "types": ["County Court", "Family court"], "slug": "edmonton-county-court-and-family-court"},
|
100
|
+
{"distance": 32.34, "name": "Barnet Civil and Family Courts Centre", "address":
|
101
|
+
{"town": "London", "address_lines": ["Hearing Centre", "St Marys Court", "Regents
|
102
|
+
Park Road", "Finchley Central"], "type": "Postal", "postcode": "N3 1BQ", "county":
|
103
|
+
"London"}, "lat": 51.6004367904275, "dx_number": "122570 Finchley (Church
|
104
|
+
End)", "areas_of_law": ["Children", "Divorce", "Domestic violence", "Money
|
105
|
+
claims", "Housing possession", "Adoption"], "lon": -0.195606730619243, "number":
|
106
|
+
117, "types": ["Family court", "County Court"], "slug": "barnet-civil-and-family-courts-centre"},
|
107
|
+
{"distance": 34.19, "name": "Aylesbury County Court and Family Court", "address":
|
108
|
+
{"town": "Aylesbury", "address_lines": ["Aylesbury County Court and Family
|
109
|
+
Court Hearing Centre", "Walton Street"], "type": "Postal", "postcode": "HP21
|
110
|
+
7QZ", "county": "Buckinghamshire"}, "lat": 51.8107805904416, "dx_number":
|
111
|
+
"97820 Aylesbury 10", "areas_of_law": ["Children", "Divorce", "Forced marriage",
|
112
|
+
"Domestic violence", "Bankruptcy", "Money claims", "Housing possession", "Adoption"],
|
113
|
+
"lon": -0.808170859422031, "number": 113, "types": ["County Court", "Family
|
114
|
+
court"], "slug": "aylesbury-county-court-and-family-court"}]'
|
115
|
+
http_version:
|
116
|
+
recorded_at: Mon, 24 Nov 2014 12:17:53 GMT
|
117
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,117 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://courttribunalfinder.service.gov.uk/search/results.json?aol=Housing+possession&postcode=SG8%200LT
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- excon/0.41.0
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message:
|
16
|
+
headers:
|
17
|
+
Server:
|
18
|
+
- nginx/1.4.6
|
19
|
+
Date:
|
20
|
+
- Mon, 24 Nov 2014 12:17:54 GMT
|
21
|
+
Content-Type:
|
22
|
+
- application/json
|
23
|
+
Content-Length:
|
24
|
+
- '5941'
|
25
|
+
Connection:
|
26
|
+
- keep-alive
|
27
|
+
Vary:
|
28
|
+
- Accept-Encoding
|
29
|
+
X-Frame-Options:
|
30
|
+
- SAMEORIGIN
|
31
|
+
Accept-Ranges:
|
32
|
+
- bytes
|
33
|
+
X-Varnish:
|
34
|
+
- '697574195'
|
35
|
+
Age:
|
36
|
+
- '0'
|
37
|
+
Via:
|
38
|
+
- 1.1 varnish
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: '[{"distance": 14.32, "name": "Cambridge County Court and Family Court",
|
42
|
+
"address": {"town": "Cambridge", "address_lines": ["Cambridge County Court
|
43
|
+
and Family Court Hearing Centre", "197 East Road"], "type": "Postal", "postcode":
|
44
|
+
"CB1 1BA", "county": "Cambridgeshire"}, "lat": 52.2037125926829, "dx_number":
|
45
|
+
"97650 Cambridge 3", "areas_of_law": ["Forced marriage", "Adoption", "Money
|
46
|
+
claims", "Domestic violence", "Children", "Housing possession", "High court",
|
47
|
+
"Bankruptcy", "Divorce"], "lon": 0.132065389149123, "number": 162, "types":
|
48
|
+
["Family court", "County Court"], "slug": "cambridge-county-court-and-family-court"},
|
49
|
+
{"distance": 15.49, "name": "Bedford County Court and Family Court", "address":
|
50
|
+
{"town": "Bedford", "address_lines": ["Bedford County Court and Family Court
|
51
|
+
Hearing Centre", "P.O. Box 1405", "3 St Paul''s Square"], "type": "Postal",
|
52
|
+
"postcode": "MK40 9DN", "county": "Bedfordshire"}, "lat": 52.1350290338706,
|
53
|
+
"dx_number": "97590 Bedford 3", "areas_of_law": ["Children", "Divorce", "Domestic
|
54
|
+
violence", "Bankruptcy", "High court", "Money claims", "Housing possession"],
|
55
|
+
"lon": -0.467880322006416, "number": 124, "types": ["County Court", "Family
|
56
|
+
court"], "slug": "bedford-county-court-and-family-court"}, {"distance": 18.02,
|
57
|
+
"name": "Luton County Court and Family Court", "address": {"town": "Luton",
|
58
|
+
"address_lines": ["Luton County Court and Family Court Hearing Centre", "2nd
|
59
|
+
Floor", "Cresta House", "Alma Street"], "type": "Postal", "postcode": "LU1
|
60
|
+
2PU", "county": "Bedfordshire"}, "lat": 51.8811279872015, "dx_number": "97760
|
61
|
+
Luton 4", "areas_of_law": ["Money claims", "Domestic violence", "Housing possession",
|
62
|
+
"Forced marriage", "Adoption", "Bankruptcy", "High court", "Divorce", "Children"],
|
63
|
+
"lon": -0.418919711521327, "number": 258, "types": ["Family court", "County
|
64
|
+
Court"], "slug": "luton-county-court-and-family-court"}, {"distance": 18.75,
|
65
|
+
"name": "Hertford County Court and Family Court", "address": {"town": "Hertford",
|
66
|
+
"address_lines": ["Hertford County Court and Family Hearing Centre", "P.O.Box
|
67
|
+
373"], "type": "Postal", "postcode": "SG13 9HT", "county": "Hertfordshire"},
|
68
|
+
"lat": 51.796089552427, "dx_number": "97710 Hertford 2", "areas_of_law": ["Children",
|
69
|
+
"Divorce", "Forced marriage", "Domestic violence", "Bankruptcy", "Money claims",
|
70
|
+
"Housing possession", "Adoption"], "lon": -0.0765909721207512, "number": 221,
|
71
|
+
"types": ["County Court", "Family court"], "slug": "hertford-county-court-and-family-court"},
|
72
|
+
{"distance": 23.59, "name": "St Albans County Court", "address": {"town":
|
73
|
+
"St. Albans", "address_lines": ["St Albans County Court", "The Court Building",
|
74
|
+
"Bricket Road"], "type": "Postal", "postcode": "AL1 3JW", "county": "Hertfordshire"},
|
75
|
+
"lat": 51.7516188860504, "dx_number": "97770 St Albans 2", "areas_of_law":
|
76
|
+
["Bankruptcy", "Money claims", "Housing possession"], "lon": -0.335521986503323,
|
77
|
+
"number": 313, "types": ["County Court"], "slug": "st-albans-county-court"},
|
78
|
+
{"distance": 27.45, "name": "Milton Keynes County Court and Family Court",
|
79
|
+
"address": {"town": "Central Milton Keynes", "address_lines": ["Milton Keynes
|
80
|
+
County Court and Family Court Hearing Centre", "351 Silbury Boulevard", "Witan
|
81
|
+
Gate East"], "type": "Postal", "postcode": "MK9 2DT", "county": "Buckinghamshire"},
|
82
|
+
"lat": 52.0412079044384, "dx_number": "136266 Milton Keynes 6", "areas_of_law":
|
83
|
+
["Forced marriage", "Money claims", "Divorce", "Domestic violence", "Children",
|
84
|
+
"Adoption", "Housing possession", "Bankruptcy", "High court"], "lon": -0.765354379292703,
|
85
|
+
"number": 388, "types": ["County Court", "Family court"], "slug": "milton-keynes-county-court-and-family-court"},
|
86
|
+
{"distance": 30.24, "name": "Watford County Court and Family Court", "address":
|
87
|
+
{"town": "Watford", "address_lines": ["Watford County Court and Family Court
|
88
|
+
Hearing Centre", "3rd Floor", "Cassiobury House", "11-19 Station Road"], "type":
|
89
|
+
"Postal", "postcode": "WD17 1EZ", "county": "Hertfordshire"}, "lat": 51.663675400498,
|
90
|
+
"dx_number": "122740 Watford 5 ", "areas_of_law": ["Children", "Divorce",
|
91
|
+
"Forced marriage", "Domestic violence", "Money claims", "Housing possession",
|
92
|
+
"Adoption"], "lon": -0.398796389317627, "number": 362, "types": ["County Court",
|
93
|
+
"Family court"], "slug": "watford-county-court-and-family-court"}, {"distance":
|
94
|
+
31.55, "name": "Edmonton County Court and Family Court", "address": {"town":
|
95
|
+
"Edmonton", "address_lines": ["Hearing Centre", "Court House", "59 Fore Street"],
|
96
|
+
"type": "Postal", "postcode": "N18 2TN", "county": "London"}, "lat": 51.6107379724959,
|
97
|
+
"dx_number": "136686 Edmonton 3", "areas_of_law": ["Children", "Divorce",
|
98
|
+
"Domestic violence", "Money claims", "Housing possession"], "lon": -0.0660789741569261,
|
99
|
+
"number": 194, "types": ["County Court", "Family court"], "slug": "edmonton-county-court-and-family-court"},
|
100
|
+
{"distance": 32.34, "name": "Barnet Civil and Family Courts Centre", "address":
|
101
|
+
{"town": "London", "address_lines": ["Hearing Centre", "St Marys Court", "Regents
|
102
|
+
Park Road", "Finchley Central"], "type": "Postal", "postcode": "N3 1BQ", "county":
|
103
|
+
"London"}, "lat": 51.6004367904275, "dx_number": "122570 Finchley (Church
|
104
|
+
End)", "areas_of_law": ["Children", "Divorce", "Domestic violence", "Money
|
105
|
+
claims", "Housing possession", "Adoption"], "lon": -0.195606730619243, "number":
|
106
|
+
117, "types": ["Family court", "County Court"], "slug": "barnet-civil-and-family-courts-centre"},
|
107
|
+
{"distance": 34.19, "name": "Aylesbury County Court and Family Court", "address":
|
108
|
+
{"town": "Aylesbury", "address_lines": ["Aylesbury County Court and Family
|
109
|
+
Court Hearing Centre", "Walton Street"], "type": "Postal", "postcode": "HP21
|
110
|
+
7QZ", "county": "Buckinghamshire"}, "lat": 51.8107805904416, "dx_number":
|
111
|
+
"97820 Aylesbury 10", "areas_of_law": ["Children", "Divorce", "Forced marriage",
|
112
|
+
"Domestic violence", "Bankruptcy", "Money claims", "Housing possession", "Adoption"],
|
113
|
+
"lon": -0.808170859422031, "number": 113, "types": ["County Court", "Family
|
114
|
+
court"], "slug": "aylesbury-county-court-and-family-court"}]'
|
115
|
+
http_version:
|
116
|
+
recorded_at: Mon, 24 Nov 2014 12:17:54 GMT
|
117
|
+
recorded_with: VCR 2.9.3
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: courtfinder-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aleksandar Simić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -53,33 +53,47 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: excon
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0.41'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0.41'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: vcr
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.9'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.9'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
89
|
+
version: '1.20'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
96
|
+
version: '1.20'
|
83
97
|
description: https://courttribunalfinder.service.gov.uk/ API client
|
84
98
|
email:
|
85
99
|
- alex.simic@digital.justice.gov.uk
|
@@ -100,6 +114,9 @@ files:
|
|
100
114
|
- spec/spec_helper.rb
|
101
115
|
- spec/support/helper.rb
|
102
116
|
- spec/support/result.json
|
117
|
+
- spec/vcr/Courtfinder_Client_HousingPossession/_get/with_invalid_postcode/should_return_empty_array.yml
|
118
|
+
- spec/vcr/Courtfinder_Client_HousingPossession/_get/with_valid_postcode/when_given_postcode_with_no_spaces/should_return_the_court_address.yml
|
119
|
+
- spec/vcr/Courtfinder_Client_HousingPossession/_get/with_valid_postcode/when_given_postcode_with_spaces/should_return_the_court_address.yml
|
103
120
|
homepage: https://github.com/ministryofjustice/courtfinder-client
|
104
121
|
licenses:
|
105
122
|
- MIT
|
@@ -129,3 +146,6 @@ test_files:
|
|
129
146
|
- spec/spec_helper.rb
|
130
147
|
- spec/support/helper.rb
|
131
148
|
- spec/support/result.json
|
149
|
+
- spec/vcr/Courtfinder_Client_HousingPossession/_get/with_invalid_postcode/should_return_empty_array.yml
|
150
|
+
- spec/vcr/Courtfinder_Client_HousingPossession/_get/with_valid_postcode/when_given_postcode_with_no_spaces/should_return_the_court_address.yml
|
151
|
+
- spec/vcr/Courtfinder_Client_HousingPossession/_get/with_valid_postcode/when_given_postcode_with_spaces/should_return_the_court_address.yml
|