postcodeapi 1.0.0 → 1.1.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: 0adcfaf4b849d49bf515845c3a3d5c6e8620e266
4
- data.tar.gz: 9bccd22ec1ea0511ab9d24d78b42cafe26cc99a9
3
+ metadata.gz: 086780903cb3fcc7b346d4b7590f8fa4248ace1e
4
+ data.tar.gz: c2856c4476339f2ca47b347d19ac3b888b7d6a3d
5
5
  SHA512:
6
- metadata.gz: 8982568a9ea504197b9245353bacd46156407cfe6bf0faefbd1e92315ef93b4151bb503f211f4fea49dfc5d028847a01942162dc92158be404a53898c3f8f7cf
7
- data.tar.gz: 48ee999cccb8903dc06206036cd2f1141934a50c38f6e6bf3e06c0b82d727e127ca4a5649311c19a656c946ea7274324a0ef49cfdd7013b4eb85a78fa154d456
6
+ metadata.gz: 94393668ff6c3db3b09b6b3a56f96448eac1d74d49878f9a8655b0140f895050802e57c0e62b9d88bb091e9748d3acddc90c9b7bb68d7ae37835d61f2d218769
7
+ data.tar.gz: 23c03337847c5d51492d7a20ecbf677b510c637586a8dd2c86e5a5d852b44eedcfad4cfe15bf5588ccae45365bff268985964a8c5b2643151326a50182e96947
data/.travis.yml CHANGED
@@ -2,13 +2,11 @@ language: ruby
2
2
  script: "bundle exec rspec spec/"
3
3
 
4
4
  rvm:
5
- - 1.9.3
6
- - 2.0.0
7
- - 2.1.0
5
+ - 2.1.6
6
+ - 2.2.2
8
7
  - ruby-head
9
8
 
10
9
  matrix:
11
10
  allow_failures:
12
- - rvm: 1.9.3
13
11
  - rvm: ruby-head
14
12
 
@@ -8,6 +8,7 @@ module Postcode
8
8
  end
9
9
 
10
10
  def postcode(postcode, house_number = nil, options = {})
11
+ postcode = sanitize(postcode)
11
12
  uri = URI.parse([BASE_URI, postcode, house_number].compact.join('/'))
12
13
 
13
14
  req = Net::HTTP::Get.new(uri.path)
@@ -19,5 +20,9 @@ module Postcode
19
20
 
20
21
  Hashie::Mash.new(JSON.parse(res.body))
21
22
  end
23
+
24
+ def sanitize(postcode)
25
+ postcode.gsub(/\s+/, '').upcase
26
+ end
22
27
  end
23
28
  end
@@ -1,3 +1,3 @@
1
1
  module Postcode
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -40,6 +40,13 @@ describe Postcode::API do
40
40
  result.resource.latitude.should eq(51.9401)
41
41
  result.resource.longitude.should eq(5.61531)
42
42
  end
43
+
44
+ it 'sanitizes input before lookup' do
45
+ result = api.postcode('5041 eb')
46
+
47
+ result.success.should be_true
48
+ result.resource.postcode.should eq("5041EB")
49
+ end
43
50
  end
44
51
 
45
52
  context "with postcode and house number" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postcodeapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ariejan de Vroom
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-29 00:00:00.000000000 Z
11
+ date: 2015-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  requirements: []
109
109
  rubyforge_project:
110
- rubygems_version: 2.2.1
110
+ rubygems_version: 2.4.5
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: Wrapper around the postcodeapi.nu API.