my_society-map_it 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (23) hide show
  1. data/Gemfile +3 -0
  2. data/README.md +7 -1
  3. data/Rakefile +10 -2
  4. data/lib/my_society/map_it.rb +93 -14
  5. data/lib/my_society/map_it/version.rb +1 -1
  6. data/my_society-map_it.gemspec +5 -0
  7. data/spec/cassettes/MySociety_MapIt_Postcode/gives_a_correct_gss_code_for_a_ward.yml +184 -0
  8. data/spec/cassettes/MySociety_MapIt_Postcode/gives_a_correct_lat/lng_for_a_postcode.yml +193 -0
  9. data/spec/cassettes/MySociety_MapIt_Postcode/gives_a_correct_ward.yml +184 -0
  10. data/spec/cassettes/MySociety_MapIt_Postcode/single_tier/correctly_identifies_a_single_tier_local_authority.yml +355 -0
  11. data/spec/cassettes/MySociety_MapIt_Postcode/single_tier/returns_the_correct_local_authority.yml +355 -0
  12. data/spec/cassettes/MySociety_MapIt_Postcode/single_tier/returns_the_correct_local_authority_gss_code.yml +355 -0
  13. data/spec/cassettes/MySociety_MapIt_Postcode/two_tier/correctly_identifies_a_two_tier_local_authority.yml +727 -0
  14. data/spec/cassettes/MySociety_MapIt_Postcode/two_tier/gives_a_correct_county_council.yml +365 -0
  15. data/spec/cassettes/MySociety_MapIt_Postcode/two_tier/gives_a_correct_county_council_gss_code.yml +365 -0
  16. data/spec/cassettes/MySociety_MapIt_Postcode/two_tier/gives_a_correct_district_council.yml +184 -0
  17. data/spec/cassettes/MySociety_MapIt_Postcode/two_tier/gives_a_correct_district_council_gss_code.yml +184 -0
  18. data/spec/cassettes/MySociety_MapIt_Postcode/two_tier/returns_a_hash_when_asked_for_a_local_authority.yml +727 -0
  19. data/spec/cassettes/MySociety_MapIt_Postcode/with_parish/returns_the_correct_parish.yml +184 -0
  20. data/spec/cassettes/MySociety_MapIt_Postcode/without_parish/returns_the_nil_for_a_parish.yml +179 -0
  21. data/spec/postcode_spec.rb +96 -0
  22. data/spec/spec_helper.rb +23 -0
  23. metadata +101 -5
data/Gemfile CHANGED
@@ -1,3 +1,6 @@
1
+ #ruby=1.9.3-p374
2
+ #ruby-gemset=mapit
3
+
1
4
  source 'https://rubygems.org'
2
5
 
3
6
  # Specify your gem's dependencies in my_society-map_it.gemspec
data/README.md CHANGED
@@ -22,9 +22,15 @@ Or install it yourself as:
22
22
 
23
23
  require 'my_society/map_it'
24
24
  p = MySociety::MapIt::Postcode.new 'SE1 1EY'
25
+ p.two_tier? # => false
25
26
  la = p.local_authority
26
27
  la.name # => "Southwark Borough Council"
27
-
28
+
29
+ p = MySociety::MapIt::Postcode.new 'B46 3LD'
30
+ p.two_tier? # => true
31
+ la = p.local_authority
32
+ la[:district].name # => "North Warwickshire Borough Council"
33
+ la[:county].name # => "Warwickshire County Council"
28
34
 
29
35
  ## Contributing
30
36
 
data/Rakefile CHANGED
@@ -1,2 +1,10 @@
1
- #!/usr/bin/env rake
2
- require "bundler/gem_tasks"
1
+ $:.unshift File.join( File.dirname(__FILE__), "lib")
2
+
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task :default => :spec
8
+
9
+ require 'bundler'
10
+ Bundler::GemHelper.install_tasks
@@ -18,23 +18,84 @@ module MySociety
18
18
  end
19
19
 
20
20
  module LocalAuthorityFinder
21
- LOCAL_AUTHORITY_TYPE_CODES = %w(
22
- DIS MTD UTA LBO CTY LGD COI
23
- ).map { |c| c.freeze }.freeze
21
+ DISTRICT_TYPE_CODES = %w(
22
+ DIS LGD
23
+ ).freeze
24
+
25
+ UNITARY_TYPE_CODES = %w(
26
+ UTA MTD LBO COI
27
+ ).freeze
28
+
29
+ COUNTY_TYPE_CODES = %w(
30
+ CTY
31
+ ).freeze
32
+
33
+ COUNTY_WARD_TYPE_CODES = %w(
34
+ CED
35
+ )
36
+
37
+ PARISH_TYPE_CODES = %w(
38
+ CPC COP
39
+ )
40
+
41
+ WARD_TYPE_CODES = %w(
42
+ DIW LBW LGW MTW UTW
43
+ )
44
+
45
+ def district
46
+ detect(DISTRICT_TYPE_CODES)
47
+ end
48
+
49
+ def parish
50
+ detect(PARISH_TYPE_CODES)
51
+ end
52
+
53
+ def county
54
+ return if district.nil?
55
+ detect(COUNTY_TYPE_CODES)
56
+ end
57
+
58
+ def county_ward
59
+ return if county.nil?
60
+ detect(COUNTY_WARD_TYPE_CODES)
61
+ end
62
+
63
+ def unitary
64
+ detect(UNITARY_TYPE_CODES)
65
+ end
66
+
67
+ def ward
68
+ detect(WARD_TYPE_CODES)
69
+ end
24
70
 
25
71
  def local_authority
26
- local_authority_info = to_point.to_hash.values.sort_by { |a|
27
- LOCAL_AUTHORITY_TYPE_CODES.index(a['type']) || -1
28
- }.detect do |la|
29
- LOCAL_AUTHORITY_TYPE_CODES.include? la['type']
30
- end
31
-
32
- return if local_authority_info.nil?
33
-
34
- LocalAuthority.new local_authority_info
72
+ if district.nil?
73
+ unitary
74
+ else
75
+ {
76
+ :district => district,
77
+ :county => county
78
+ }
79
+ end
35
80
  rescue
36
81
  nil
37
82
  end
83
+
84
+ def detect(type)
85
+ la = to_point.to_hash.values.detect do |la|
86
+ type.include? la['type']
87
+ end
88
+
89
+ return if la.nil?
90
+
91
+ LocalAuthority.new la
92
+ rescue
93
+ nil
94
+ end
95
+
96
+ def two_tier?
97
+ local_authority.kind_of? Hash
98
+ end
38
99
  end
39
100
 
40
101
  class LocalAuthority
@@ -58,6 +119,14 @@ module MySociety
58
119
  def id
59
120
  attributes['id']
60
121
  end
122
+
123
+ def snac
124
+ attributes['codes']['ons'] rescue nil
125
+ end
126
+
127
+ def gss
128
+ attributes['codes']['gss'] rescue nil
129
+ end
61
130
 
62
131
  def uri
63
132
  [ MySociety::MapIt.base_url, 'area', id ].join '/'
@@ -88,7 +157,7 @@ module MySociety
88
157
  end
89
158
 
90
159
  def uri
91
- "#{MySociety::MapIt.base_url}/point/#{coordinate_system}/#{x},#{y}"
160
+ "#{MySociety::MapIt.base_url}/point/#{coordinate_system}/#{y},#{x}"
92
161
  end
93
162
 
94
163
  def to_point
@@ -117,7 +186,17 @@ module MySociety
117
186
 
118
187
  def to_point
119
188
  h = to_hash.dup
120
- Point.new h['wgs84_lon'], h['wgs84_lat'], Point::SYSTEM_WGS84
189
+ Point.new h['wgs84_lat'], h['wgs84_lon'], Point::SYSTEM_WGS84
190
+ end
191
+
192
+ def easting_northing
193
+ h = to_hash.dup
194
+ if h['coordsyst'] == "G"
195
+ coordsyst = Point::SYSTEM_BRITISH_NATIONAL_GRID
196
+ else h['coordsyst'] == "I"
197
+ coordsyst = Point::SYSTEM_IRISH_NATIONAL_GRID
198
+ end
199
+ Point.new h['northing'], h['easting'], coordsyst
121
200
  end
122
201
  end
123
202
  end
@@ -1,5 +1,5 @@
1
1
  module MySociety
2
2
  module MapIt
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
@@ -14,4 +14,9 @@ Gem::Specification.new do |gem|
14
14
  gem.name = "my_society-map_it"
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = MySociety::MapIt::VERSION
17
+
18
+ gem.add_development_dependency "rspec"
19
+ gem.add_development_dependency "simplecov-rcov"
20
+ gem.add_development_dependency "fakeweb"
21
+ gem.add_development_dependency "vcr"
17
22
  end
@@ -0,0 +1,184 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://mapit.mysociety.org/postcode/B463LD
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ accept:
11
+ - ! '*/*'
12
+ user-agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ expires:
20
+ - Tue, 15 Oct 2013 13:20:51 GMT
21
+ vary:
22
+ - Cookie,Accept-Encoding
23
+ etag:
24
+ - ! '"40eca97e347e9ac2c1ce9caca6bfb5a2;gzip"'
25
+ cache-control:
26
+ - max-age=2419200
27
+ access-control-allow-origin:
28
+ - ! '*'
29
+ last-modified:
30
+ - Tue, 17 Sep 2013 13:20:51 GMT
31
+ content-type:
32
+ - application/json; charset=utf-8
33
+ x-url:
34
+ - /postcode/B463LD
35
+ transfer-encoding:
36
+ - chunked
37
+ date:
38
+ - Tue, 17 Sep 2013 14:44:15 GMT
39
+ age:
40
+ - '5004'
41
+ connection:
42
+ - keep-alive
43
+ body:
44
+ encoding: US-ASCII
45
+ string: ! '{"wgs84_lat": 52.496789409955881, "coordsyst": "G", "shortcuts":
46
+ {"WMC": 66024, "ward": {"county": 15881, "district": 7606}, "council": {"county":
47
+ 2243, "district": 2458}}, "wgs84_lon": -1.706805276569471, "postcode": "B46
48
+ 3LD", "easting": 420002, "areas": {"40352": {"parent_area": null, "generation_high":
49
+ 20, "all_names": {}, "id": 40352, "codes": {"ons": "E02006473"}, "name": "North
50
+ Warwickshire 006", "country": "E", "type_name": "Middle Layer Super Output
51
+ Area (Full)", "generation_low": 13, "country_name": "England", "type": "OMF"},
52
+ "11809": {"parent_area": null, "generation_high": 20, "all_names": {}, "id":
53
+ 11809, "codes": {"ons": "05", "gss": "E15000005", "unit_id": "41426"}, "name":
54
+ "West Midlands", "country": "E", "type_name": "European region", "generation_low":
55
+ 1, "country_name": "England", "type": "EUR"}, "2243": {"parent_area": null,
56
+ "generation_high": 20, "all_names": {}, "id": 2243, "codes": {"ons": "44",
57
+ "gss": "E10000031", "unit_id": "10049"}, "name": "Warwickshire County Council",
58
+ "country": "E", "type_name": "County council", "generation_low": 1, "country_name":
59
+ "England", "type": "CTY"}, "900001": {"parent_area": null, "generation_high":
60
+ 20, "all_names": {}, "id": 900001, "codes": {}, "name": "European Parliament",
61
+ "country": "", "type_name": "European Parliament", "generation_low": 1, "country_name":
62
+ "-", "type": "EUP"}, "66024": {"parent_area": null, "generation_high": 20,
63
+ "all_names": {}, "id": 66024, "codes": {"gss": "E14000854", "unit_id": "24700"},
64
+ "name": "North Warwickshire", "country": "E", "type_name": "UK Parliament
65
+ constituency", "generation_low": 13, "country_name": "England", "type": "WMC"},
66
+ "15881": {"parent_area": 2243, "generation_high": 20, "all_names": {}, "id":
67
+ 15881, "codes": {"unit_id": "10112"}, "name": "Coleshill", "country": "E",
68
+ "type_name": "County council electoral division", "generation_low": 3, "country_name":
69
+ "England", "type": "CED"}, "97162": {"parent_area": null, "generation_high":
70
+ 20, "all_names": {}, "id": 97162, "codes": {"ons": "E01031021"}, "name": "North
71
+ Warwickshire 006C", "country": "E", "type_name": "Lower Layer Super Output
72
+ Area (Full)", "generation_low": 13, "country_name": "England", "type": "OLF"},
73
+ "131540": {"parent_area": null, "generation_high": 20, "all_names": {}, "id":
74
+ 131540, "codes": {"ons": "E01031021"}, "name": "North Warwickshire 006C",
75
+ "country": "E", "type_name": "Lower Layer Super Output Area (Generalised)",
76
+ "generation_low": 13, "country_name": "England", "type": "OLG"}, "7606": {"parent_area":
77
+ 2458, "generation_high": 20, "all_names": {}, "id": 7606, "codes": {"ons":
78
+ "44UBGC", "gss": "E05007463", "unit_id": "10113"}, "name": "Coleshill South",
79
+ "country": "E", "type_name": "District council ward", "generation_low": 1,
80
+ "country_name": "England", "type": "DIW"}, "55160": {"parent_area": 2458,
81
+ "generation_high": 20, "all_names": {}, "id": 55160, "codes": {"ons": "44UB010",
82
+ "gss": "E04009636", "unit_id": "10183"}, "name": "Coleshill", "country": "E",
83
+ "type_name": "Civil parish/community", "generation_low": 12, "country_name":
84
+ "England", "type": "CPC"}, "47546": {"parent_area": null, "generation_high":
85
+ 20, "all_names": {}, "id": 47546, "codes": {"ons": "E02006473"}, "name": "North
86
+ Warwickshire 006", "country": "E", "type_name": "Middle Layer Super Output
87
+ Area (Generalised)", "generation_low": 13, "country_name": "England", "type":
88
+ "OMG"}, "2458": {"parent_area": null, "generation_high": 20, "all_names":
89
+ {}, "id": 2458, "codes": {"ons": "44UB", "gss": "E07000218", "unit_id": "10124"},
90
+ "name": "North Warwickshire Borough Council", "country": "E", "type_name":
91
+ "District council", "generation_low": 1, "country_name": "England", "type":
92
+ "DIS"}, "900000": {"parent_area": null, "generation_high": 19, "all_names":
93
+ {}, "id": 900000, "codes": {}, "name": "House of Commons", "country": "",
94
+ "type_name": "UK Parliament", "generation_low": 1, "country_name": "-", "type":
95
+ "WMP"}}, "northing": 288805}'
96
+ http_version: '1.1'
97
+ recorded_at: Tue, 17 Sep 2013 14:44:15 GMT
98
+ - request:
99
+ method: get
100
+ uri: http://mapit.mysociety.org/point/4326/-1.706805276569471,52.49678940995588
101
+ body:
102
+ encoding: US-ASCII
103
+ string: ''
104
+ headers:
105
+ accept:
106
+ - ! '*/*'
107
+ user-agent:
108
+ - Ruby
109
+ response:
110
+ status:
111
+ code: 200
112
+ message: OK
113
+ headers:
114
+ expires:
115
+ - Tue, 15 Oct 2013 13:20:51 GMT
116
+ vary:
117
+ - Cookie,Accept-Encoding
118
+ etag:
119
+ - ! '"dd54c79a7ffa9ada97f196e2b607b2e1;gzip"'
120
+ cache-control:
121
+ - max-age=2419200
122
+ access-control-allow-origin:
123
+ - ! '*'
124
+ last-modified:
125
+ - Tue, 17 Sep 2013 13:20:51 GMT
126
+ content-type:
127
+ - application/json; charset=utf-8
128
+ x-url:
129
+ - /point/4326/-1.706805276569471,52.49678940995588
130
+ transfer-encoding:
131
+ - chunked
132
+ date:
133
+ - Tue, 17 Sep 2013 14:44:15 GMT
134
+ age:
135
+ - '5003'
136
+ connection:
137
+ - keep-alive
138
+ body:
139
+ encoding: US-ASCII
140
+ string: ! '{"40352": {"parent_area": null, "generation_high": 20, "all_names":
141
+ {}, "id": 40352, "codes": {"ons": "E02006473"}, "name": "North Warwickshire
142
+ 006", "country": "E", "type_name": "Middle Layer Super Output Area (Full)",
143
+ "generation_low": 13, "country_name": "England", "type": "OMF"}, "11809":
144
+ {"parent_area": null, "generation_high": 20, "all_names": {}, "id": 11809,
145
+ "codes": {"ons": "05", "gss": "E15000005", "unit_id": "41426"}, "name": "West
146
+ Midlands", "country": "E", "type_name": "European region", "generation_low":
147
+ 1, "country_name": "England", "type": "EUR"}, "2243": {"parent_area": null,
148
+ "generation_high": 20, "all_names": {}, "id": 2243, "codes": {"ons": "44",
149
+ "gss": "E10000031", "unit_id": "10049"}, "name": "Warwickshire County Council",
150
+ "country": "E", "type_name": "County council", "generation_low": 1, "country_name":
151
+ "England", "type": "CTY"}, "66024": {"parent_area": null, "generation_high":
152
+ 20, "all_names": {}, "id": 66024, "codes": {"gss": "E14000854", "unit_id":
153
+ "24700"}, "name": "North Warwickshire", "country": "E", "type_name": "UK Parliament
154
+ constituency", "generation_low": 13, "country_name": "England", "type": "WMC"},
155
+ "15881": {"parent_area": 2243, "generation_high": 20, "all_names": {}, "id":
156
+ 15881, "codes": {"unit_id": "10112"}, "name": "Coleshill", "country": "E",
157
+ "type_name": "County council electoral division", "generation_low": 3, "country_name":
158
+ "England", "type": "CED"}, "97162": {"parent_area": null, "generation_high":
159
+ 20, "all_names": {}, "id": 97162, "codes": {"ons": "E01031021"}, "name": "North
160
+ Warwickshire 006C", "country": "E", "type_name": "Lower Layer Super Output
161
+ Area (Full)", "generation_low": 13, "country_name": "England", "type": "OLF"},
162
+ "131540": {"parent_area": null, "generation_high": 20, "all_names": {}, "id":
163
+ 131540, "codes": {"ons": "E01031021"}, "name": "North Warwickshire 006C",
164
+ "country": "E", "type_name": "Lower Layer Super Output Area (Generalised)",
165
+ "generation_low": 13, "country_name": "England", "type": "OLG"}, "7606": {"parent_area":
166
+ 2458, "generation_high": 20, "all_names": {}, "id": 7606, "codes": {"ons":
167
+ "44UBGC", "gss": "E05007463", "unit_id": "10113"}, "name": "Coleshill South",
168
+ "country": "E", "type_name": "District council ward", "generation_low": 1,
169
+ "country_name": "England", "type": "DIW"}, "55160": {"parent_area": 2458,
170
+ "generation_high": 20, "all_names": {}, "id": 55160, "codes": {"ons": "44UB010",
171
+ "gss": "E04009636", "unit_id": "10183"}, "name": "Coleshill", "country": "E",
172
+ "type_name": "Civil parish/community", "generation_low": 12, "country_name":
173
+ "England", "type": "CPC"}, "47546": {"parent_area": null, "generation_high":
174
+ 20, "all_names": {}, "id": 47546, "codes": {"ons": "E02006473"}, "name": "North
175
+ Warwickshire 006", "country": "E", "type_name": "Middle Layer Super Output
176
+ Area (Generalised)", "generation_low": 13, "country_name": "England", "type":
177
+ "OMG"}, "2458": {"parent_area": null, "generation_high": 20, "all_names":
178
+ {}, "id": 2458, "codes": {"ons": "44UB", "gss": "E07000218", "unit_id": "10124"},
179
+ "name": "North Warwickshire Borough Council", "country": "E", "type_name":
180
+ "District council", "generation_low": 1, "country_name": "England", "type":
181
+ "DIS"}}'
182
+ http_version: '1.1'
183
+ recorded_at: Tue, 17 Sep 2013 14:44:15 GMT
184
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,193 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://mapit.mysociety.org/postcode/B463LD
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ accept:
11
+ - ! '*/*'
12
+ user-agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ expires:
20
+ - Tue, 15 Oct 2013 13:20:51 GMT
21
+ vary:
22
+ - Cookie,Accept-Encoding
23
+ etag:
24
+ - ! '"40eca97e347e9ac2c1ce9caca6bfb5a2;gzip"'
25
+ cache-control:
26
+ - max-age=2419200
27
+ access-control-allow-origin:
28
+ - ! '*'
29
+ last-modified:
30
+ - Tue, 17 Sep 2013 13:20:51 GMT
31
+ content-type:
32
+ - application/json; charset=utf-8
33
+ x-url:
34
+ - /postcode/B463LD
35
+ transfer-encoding:
36
+ - chunked
37
+ date:
38
+ - Tue, 17 Sep 2013 14:44:15 GMT
39
+ age:
40
+ - '5004'
41
+ connection:
42
+ - keep-alive
43
+ body:
44
+ encoding: US-ASCII
45
+ string: ! '{"wgs84_lat": 52.496789409955881, "coordsyst": "G", "shortcuts":
46
+ {"WMC": 66024, "ward": {"county": 15881, "district": 7606}, "council": {"county":
47
+ 2243, "district": 2458}}, "wgs84_lon": -1.706805276569471, "postcode": "B46
48
+ 3LD", "easting": 420002, "areas": {"40352": {"parent_area": null, "generation_high":
49
+ 20, "all_names": {}, "id": 40352, "codes": {"ons": "E02006473"}, "name": "North
50
+ Warwickshire 006", "country": "E", "type_name": "Middle Layer Super Output
51
+ Area (Full)", "generation_low": 13, "country_name": "England", "type": "OMF"},
52
+ "11809": {"parent_area": null, "generation_high": 20, "all_names": {}, "id":
53
+ 11809, "codes": {"ons": "05", "gss": "E15000005", "unit_id": "41426"}, "name":
54
+ "West Midlands", "country": "E", "type_name": "European region", "generation_low":
55
+ 1, "country_name": "England", "type": "EUR"}, "2243": {"parent_area": null,
56
+ "generation_high": 20, "all_names": {}, "id": 2243, "codes": {"ons": "44",
57
+ "gss": "E10000031", "unit_id": "10049"}, "name": "Warwickshire County Council",
58
+ "country": "E", "type_name": "County council", "generation_low": 1, "country_name":
59
+ "England", "type": "CTY"}, "900001": {"parent_area": null, "generation_high":
60
+ 20, "all_names": {}, "id": 900001, "codes": {}, "name": "European Parliament",
61
+ "country": "", "type_name": "European Parliament", "generation_low": 1, "country_name":
62
+ "-", "type": "EUP"}, "66024": {"parent_area": null, "generation_high": 20,
63
+ "all_names": {}, "id": 66024, "codes": {"gss": "E14000854", "unit_id": "24700"},
64
+ "name": "North Warwickshire", "country": "E", "type_name": "UK Parliament
65
+ constituency", "generation_low": 13, "country_name": "England", "type": "WMC"},
66
+ "15881": {"parent_area": 2243, "generation_high": 20, "all_names": {}, "id":
67
+ 15881, "codes": {"unit_id": "10112"}, "name": "Coleshill", "country": "E",
68
+ "type_name": "County council electoral division", "generation_low": 3, "country_name":
69
+ "England", "type": "CED"}, "97162": {"parent_area": null, "generation_high":
70
+ 20, "all_names": {}, "id": 97162, "codes": {"ons": "E01031021"}, "name": "North
71
+ Warwickshire 006C", "country": "E", "type_name": "Lower Layer Super Output
72
+ Area (Full)", "generation_low": 13, "country_name": "England", "type": "OLF"},
73
+ "131540": {"parent_area": null, "generation_high": 20, "all_names": {}, "id":
74
+ 131540, "codes": {"ons": "E01031021"}, "name": "North Warwickshire 006C",
75
+ "country": "E", "type_name": "Lower Layer Super Output Area (Generalised)",
76
+ "generation_low": 13, "country_name": "England", "type": "OLG"}, "7606": {"parent_area":
77
+ 2458, "generation_high": 20, "all_names": {}, "id": 7606, "codes": {"ons":
78
+ "44UBGC", "gss": "E05007463", "unit_id": "10113"}, "name": "Coleshill South",
79
+ "country": "E", "type_name": "District council ward", "generation_low": 1,
80
+ "country_name": "England", "type": "DIW"}, "55160": {"parent_area": 2458,
81
+ "generation_high": 20, "all_names": {}, "id": 55160, "codes": {"ons": "44UB010",
82
+ "gss": "E04009636", "unit_id": "10183"}, "name": "Coleshill", "country": "E",
83
+ "type_name": "Civil parish/community", "generation_low": 12, "country_name":
84
+ "England", "type": "CPC"}, "47546": {"parent_area": null, "generation_high":
85
+ 20, "all_names": {}, "id": 47546, "codes": {"ons": "E02006473"}, "name": "North
86
+ Warwickshire 006", "country": "E", "type_name": "Middle Layer Super Output
87
+ Area (Generalised)", "generation_low": 13, "country_name": "England", "type":
88
+ "OMG"}, "2458": {"parent_area": null, "generation_high": 20, "all_names":
89
+ {}, "id": 2458, "codes": {"ons": "44UB", "gss": "E07000218", "unit_id": "10124"},
90
+ "name": "North Warwickshire Borough Council", "country": "E", "type_name":
91
+ "District council", "generation_low": 1, "country_name": "England", "type":
92
+ "DIS"}, "900000": {"parent_area": null, "generation_high": 19, "all_names":
93
+ {}, "id": 900000, "codes": {}, "name": "House of Commons", "country": "",
94
+ "type_name": "UK Parliament", "generation_low": 1, "country_name": "-", "type":
95
+ "WMP"}}, "northing": 288805}'
96
+ http_version: '1.1'
97
+ recorded_at: Tue, 17 Sep 2013 14:44:15 GMT
98
+ - request:
99
+ method: get
100
+ uri: http://mapit.mysociety.org/postcode/B463LD
101
+ body:
102
+ encoding: US-ASCII
103
+ string: ''
104
+ headers:
105
+ accept:
106
+ - ! '*/*'
107
+ user-agent:
108
+ - Ruby
109
+ response:
110
+ status:
111
+ code: 200
112
+ message: OK
113
+ headers:
114
+ expires:
115
+ - Tue, 15 Oct 2013 13:20:51 GMT
116
+ vary:
117
+ - Cookie,Accept-Encoding
118
+ etag:
119
+ - ! '"40eca97e347e9ac2c1ce9caca6bfb5a2;gzip"'
120
+ cache-control:
121
+ - max-age=2419200
122
+ access-control-allow-origin:
123
+ - ! '*'
124
+ last-modified:
125
+ - Tue, 17 Sep 2013 13:20:51 GMT
126
+ content-type:
127
+ - application/json; charset=utf-8
128
+ x-url:
129
+ - /postcode/B463LD
130
+ transfer-encoding:
131
+ - chunked
132
+ date:
133
+ - Tue, 17 Sep 2013 14:44:15 GMT
134
+ age:
135
+ - '5004'
136
+ connection:
137
+ - keep-alive
138
+ body:
139
+ encoding: US-ASCII
140
+ string: ! '{"wgs84_lat": 52.496789409955881, "coordsyst": "G", "shortcuts":
141
+ {"WMC": 66024, "ward": {"county": 15881, "district": 7606}, "council": {"county":
142
+ 2243, "district": 2458}}, "wgs84_lon": -1.706805276569471, "postcode": "B46
143
+ 3LD", "easting": 420002, "areas": {"40352": {"parent_area": null, "generation_high":
144
+ 20, "all_names": {}, "id": 40352, "codes": {"ons": "E02006473"}, "name": "North
145
+ Warwickshire 006", "country": "E", "type_name": "Middle Layer Super Output
146
+ Area (Full)", "generation_low": 13, "country_name": "England", "type": "OMF"},
147
+ "11809": {"parent_area": null, "generation_high": 20, "all_names": {}, "id":
148
+ 11809, "codes": {"ons": "05", "gss": "E15000005", "unit_id": "41426"}, "name":
149
+ "West Midlands", "country": "E", "type_name": "European region", "generation_low":
150
+ 1, "country_name": "England", "type": "EUR"}, "2243": {"parent_area": null,
151
+ "generation_high": 20, "all_names": {}, "id": 2243, "codes": {"ons": "44",
152
+ "gss": "E10000031", "unit_id": "10049"}, "name": "Warwickshire County Council",
153
+ "country": "E", "type_name": "County council", "generation_low": 1, "country_name":
154
+ "England", "type": "CTY"}, "900001": {"parent_area": null, "generation_high":
155
+ 20, "all_names": {}, "id": 900001, "codes": {}, "name": "European Parliament",
156
+ "country": "", "type_name": "European Parliament", "generation_low": 1, "country_name":
157
+ "-", "type": "EUP"}, "66024": {"parent_area": null, "generation_high": 20,
158
+ "all_names": {}, "id": 66024, "codes": {"gss": "E14000854", "unit_id": "24700"},
159
+ "name": "North Warwickshire", "country": "E", "type_name": "UK Parliament
160
+ constituency", "generation_low": 13, "country_name": "England", "type": "WMC"},
161
+ "15881": {"parent_area": 2243, "generation_high": 20, "all_names": {}, "id":
162
+ 15881, "codes": {"unit_id": "10112"}, "name": "Coleshill", "country": "E",
163
+ "type_name": "County council electoral division", "generation_low": 3, "country_name":
164
+ "England", "type": "CED"}, "97162": {"parent_area": null, "generation_high":
165
+ 20, "all_names": {}, "id": 97162, "codes": {"ons": "E01031021"}, "name": "North
166
+ Warwickshire 006C", "country": "E", "type_name": "Lower Layer Super Output
167
+ Area (Full)", "generation_low": 13, "country_name": "England", "type": "OLF"},
168
+ "131540": {"parent_area": null, "generation_high": 20, "all_names": {}, "id":
169
+ 131540, "codes": {"ons": "E01031021"}, "name": "North Warwickshire 006C",
170
+ "country": "E", "type_name": "Lower Layer Super Output Area (Generalised)",
171
+ "generation_low": 13, "country_name": "England", "type": "OLG"}, "7606": {"parent_area":
172
+ 2458, "generation_high": 20, "all_names": {}, "id": 7606, "codes": {"ons":
173
+ "44UBGC", "gss": "E05007463", "unit_id": "10113"}, "name": "Coleshill South",
174
+ "country": "E", "type_name": "District council ward", "generation_low": 1,
175
+ "country_name": "England", "type": "DIW"}, "55160": {"parent_area": 2458,
176
+ "generation_high": 20, "all_names": {}, "id": 55160, "codes": {"ons": "44UB010",
177
+ "gss": "E04009636", "unit_id": "10183"}, "name": "Coleshill", "country": "E",
178
+ "type_name": "Civil parish/community", "generation_low": 12, "country_name":
179
+ "England", "type": "CPC"}, "47546": {"parent_area": null, "generation_high":
180
+ 20, "all_names": {}, "id": 47546, "codes": {"ons": "E02006473"}, "name": "North
181
+ Warwickshire 006", "country": "E", "type_name": "Middle Layer Super Output
182
+ Area (Generalised)", "generation_low": 13, "country_name": "England", "type":
183
+ "OMG"}, "2458": {"parent_area": null, "generation_high": 20, "all_names":
184
+ {}, "id": 2458, "codes": {"ons": "44UB", "gss": "E07000218", "unit_id": "10124"},
185
+ "name": "North Warwickshire Borough Council", "country": "E", "type_name":
186
+ "District council", "generation_low": 1, "country_name": "England", "type":
187
+ "DIS"}, "900000": {"parent_area": null, "generation_high": 19, "all_names":
188
+ {}, "id": 900000, "codes": {}, "name": "House of Commons", "country": "",
189
+ "type_name": "UK Parliament", "generation_low": 1, "country_name": "-", "type":
190
+ "WMP"}}, "northing": 288805}'
191
+ http_version: '1.1'
192
+ recorded_at: Tue, 17 Sep 2013 14:44:15 GMT
193
+ recorded_with: VCR 2.4.0