postcodeinfo-client-ruby 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1cc29fc252abb63673bcdbc1eac1e65c44f3afa
4
- data.tar.gz: c89795f10cbda5f945032d5df031525ea8a8dce6
3
+ metadata.gz: 527672be20e565777754f5e2ac69c69a6e124894
4
+ data.tar.gz: 31f55d5883abb8cd37a52c3a09448ec4513bb673
5
5
  SHA512:
6
- metadata.gz: 84bba1eac23473f8fba00e73bcf59ca43bdc099745f9dceb6e812fa0ffee55c213bd2284e5f1bef328d870ce0a11eb9641419f86b03abd7e0c2904444b13c854
7
- data.tar.gz: 8ca4410e0121c5677ed0fcfd4489be16b6fdc2581569d10e792b6bbf5b9ab035118d79f0d3d6ebcb18d51603cf3d2bc84ba1194bd0817dc826d70a2aefac6f52
6
+ metadata.gz: 13db41921fa9f26cbc3f3244fe9b380436b933a01cae4bb1274cd322091c0572dca4593cb101fe77c629d99480725e0c5ea79693431675ca3bcc62a27cb28328
7
+ data.tar.gz: cf47d238ea0034c98a5fdcbb458e22db61a0d881555706a2e52ec4959b5e12bb37d74578826d8068395e0ccc553bd71658460dd0504cc8346167099ccd3305ed
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ = v0.2
2
+
3
+ * Postcode endpoint now reports which country a postcode is in.
4
+
5
+ = v0.1.3
6
+
7
+ * all lat/long co-ordinates now rendered in GeoJson format
data/README.md CHANGED
@@ -55,6 +55,12 @@ postcode.local_authority
55
55
  name: "Barnet"
56
56
  }
57
57
 
58
+ postcode.country
59
+ => {
60
+ gss_code: "E92000001"
61
+ name: "England"
62
+ }
63
+
58
64
  postcode.addresses
59
65
  =>
60
66
  [{"uprn"=>"100121127903",
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.2.0
@@ -32,6 +32,11 @@ module PostcodeInfo
32
32
  @local_authority
33
33
  end
34
34
 
35
+ def country
36
+ lookup_info! if @info.nil?
37
+ @country
38
+ end
39
+
35
40
  def addresses
36
41
  @addresses ||= @client.addresses(@normalised)
37
42
  end
@@ -59,6 +64,7 @@ module PostcodeInfo
59
64
  def parse_info!
60
65
  set_coordinates!(@info)
61
66
  @local_authority = @info[:local_authority]
67
+ @country = @info[:country]
62
68
  @valid = true
63
69
  end
64
70
  end
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: postcodeinfo-client-ruby 0.1.3 ruby lib
5
+ # stub: postcodeinfo-client-ruby 0.2.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "postcodeinfo-client-ruby"
9
- s.version = "0.1.3"
9
+ s.version = "0.2.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Al Davidson"]
14
- s.date = "2015-07-16"
14
+ s.date = "2015-07-30"
15
15
  s.description = "Provides a convenient interface for looking up postcodes in an instance of the MoJ postcodeinfo API (https://github.com/ministryofjustice/postcodeinfo).\n Lets you check if a postcode is valid, and lookup:\n * all addresses with that postcode\n * the latitude/longitude of its centre point\n * the name & GSS code of the local authority under which it resides."
16
16
  s.email = "alistair.davidson@digital.justice.gov.uk"
17
17
  s.extra_rdoc_files = [
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  ".ruby-gemset",
25
25
  ".ruby-version",
26
26
  ".simplecov",
27
+ "CHANGELOG.md",
27
28
  "Gemfile",
28
29
  "Gemfile.lock",
29
30
  "LICENSE.MD",
@@ -174,7 +174,7 @@ describe PostcodeInfo::Postcode do
174
174
  end
175
175
 
176
176
  describe "parse_info!" do
177
- let(:stored_info){ {key: 'value', local_authority:'local authority'} }
177
+ let(:stored_info){ {key: 'value', local_authority:'local authority', country: 'country'} }
178
178
 
179
179
  before do
180
180
  postcode.send(:instance_variable_set, '@info', stored_info )
@@ -190,6 +190,11 @@ describe PostcodeInfo::Postcode do
190
190
  expect(postcode.local_authority).to eq('local authority')
191
191
  end
192
192
 
193
+ it 'stores the country in @country' do
194
+ postcode.send(:parse_info!)
195
+ expect(postcode.country).to eq('country')
196
+ end
197
+
193
198
  it 'sets the valid flag' do
194
199
  expect{postcode.send(:parse_info!)}.to change{postcode.send(:instance_variable_get, '@valid')}.to(true)
195
200
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postcodeinfo-client-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Al Davidson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-16 00:00:00.000000000 Z
11
+ date: 2015-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -140,6 +140,7 @@ files:
140
140
  - ".ruby-gemset"
141
141
  - ".ruby-version"
142
142
  - ".simplecov"
143
+ - CHANGELOG.md
143
144
  - Gemfile
144
145
  - Gemfile.lock
145
146
  - LICENSE.MD