postcodeinfo-client-ruby 0.1.3 → 0.2.0
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/CHANGELOG.md +7 -0
- data/README.md +6 -0
- data/VERSION +1 -1
- data/lib/postcodeinfo/postcode.rb +6 -0
- data/postcodeinfo-client-ruby.gemspec +4 -3
- data/spec/postcode_spec.rb +6 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 527672be20e565777754f5e2ac69c69a6e124894
|
4
|
+
data.tar.gz: 31f55d5883abb8cd37a52c3a09448ec4513bb673
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13db41921fa9f26cbc3f3244fe9b380436b933a01cae4bb1274cd322091c0572dca4593cb101fe77c629d99480725e0c5ea79693431675ca3bcc62a27cb28328
|
7
|
+
data.tar.gz: cf47d238ea0034c98a5fdcbb458e22db61a0d881555706a2e52ec4959b5e12bb37d74578826d8068395e0ccc553bd71658460dd0504cc8346167099ccd3305ed
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
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.
|
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.
|
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-
|
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",
|
data/spec/postcode_spec.rb
CHANGED
@@ -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.
|
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-
|
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
|