addressfinder 1.6.1 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/lib/addressfinder/cleanse.rb +2 -1
- data/lib/addressfinder/util.rb +8 -1
- data/lib/addressfinder/version.rb +1 -1
- data/spec/lib/addressfinder/cleanse_spec.rb +18 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: de05727d08ca624896115f6fe76ae68bb3dd36ed99195468153cf982c9af07a0
|
4
|
+
data.tar.gz: 30ba24d9f052a8884ec5772b8d0d492f1334636674ae29e265ddd3fb105d51dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 160bee2722353ec131681b401a1ddb92748cb606b4e0bf5d1572a924becf1475a61431ef8382f39df9e361a4133d300714ec029033a631285f62f646c3428e17
|
7
|
+
data.tar.gz: e1d026848279132f2cd4b2e1ba35061adee84fcac56e89b54fc336b7caff2386e4123a9f5686ea0792dc371fd6a2ba6fa35195d8dfd28a858de43e376cc423f5
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -5,13 +5,14 @@ module AddressFinder
|
|
5
5
|
|
6
6
|
attr_reader :result
|
7
7
|
|
8
|
-
def initialize(q:, country: nil, delivered: nil, post_box: nil, rural: nil, region_code: nil, census: nil, domain: nil, key: nil, secret: nil, http:)
|
8
|
+
def initialize(q:, country: nil, delivered: nil, post_box: nil, rural: nil, region_code: nil, state_codes: nil, census: nil, domain: nil, key: nil, secret: nil, http:)
|
9
9
|
@params = {}
|
10
10
|
@params['q'] = q
|
11
11
|
@params['delivered'] = delivered if delivered
|
12
12
|
@params['post_box'] = post_box if post_box
|
13
13
|
@params['rural'] = rural if rural
|
14
14
|
@params['region_code'] = region_code if region_code
|
15
|
+
@params['state_codes'] = state_codes if state_codes
|
15
16
|
@params['census'] = census if census
|
16
17
|
@params['domain'] = domain || config.domain if (domain || config.domain)
|
17
18
|
@params['format'] = 'json'
|
data/lib/addressfinder/util.rb
CHANGED
@@ -6,7 +6,14 @@ module AddressFinder
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def self.encode_and_join_params(params)
|
9
|
-
|
9
|
+
# URI.encode_www_form(params)
|
10
|
+
params.map do |k,v|
|
11
|
+
if v.is_a? Array
|
12
|
+
v.collect {|e| "#{k}[]=#{encode(e)}" }
|
13
|
+
else
|
14
|
+
"#{k}=#{encode(v)}"
|
15
|
+
end
|
16
|
+
end.join('&')
|
10
17
|
end
|
11
18
|
end
|
12
19
|
end
|
@@ -82,6 +82,24 @@ RSpec.describe AddressFinder::Cleanse do
|
|
82
82
|
it { expect(request_uri).to eq('/api/au/address/cleanse?q=186+willis+st&format=json&key=XXX&secret=YYY') }
|
83
83
|
end
|
84
84
|
|
85
|
+
context 'with a state codes as an array' do
|
86
|
+
let(:args){ {q: '186 willis st', country: 'au', state_codes: ['ACT','NSW'], http: http} }
|
87
|
+
|
88
|
+
it { expect(request_uri).to eq('/api/au/address/cleanse?q=186+willis+st&state_codes[]=ACT&state_codes[]=NSW&format=json&key=XXX&secret=YYY') }
|
89
|
+
end
|
90
|
+
|
91
|
+
context 'with a reserved character in the query' do
|
92
|
+
let(:args){ {q: '186=willis st', country: 'au', state_codes: ['ACT','NSW'], http: http} }
|
93
|
+
|
94
|
+
it { expect(request_uri).to eq('/api/au/address/cleanse?q=186%3Dwillis+st&state_codes[]=ACT&state_codes[]=NSW&format=json&key=XXX&secret=YYY') }
|
95
|
+
end
|
96
|
+
|
97
|
+
context 'with a state codes as a string' do
|
98
|
+
let(:args){ {q: '186 willis st', country: 'au', state_codes: 'ACT,NSW', http: http} }
|
99
|
+
|
100
|
+
it { expect(request_uri).to eq('/api/au/address/cleanse?q=186+willis+st&state_codes=ACT%2CNSW&format=json&key=XXX&secret=YYY') }
|
101
|
+
end
|
102
|
+
|
85
103
|
context 'with a key override' do
|
86
104
|
let(:args){ {q: '186 willis st', key: 'AAA', http: http} }
|
87
105
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: addressfinder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nigel Ramsay
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2019-
|
14
|
+
date: 2019-09-23 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: multi_json
|
@@ -155,8 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
155
|
- !ruby/object:Gem::Version
|
156
156
|
version: '0'
|
157
157
|
requirements: []
|
158
|
-
|
159
|
-
rubygems_version: 2.6.8
|
158
|
+
rubygems_version: 3.0.3
|
160
159
|
signing_key:
|
161
160
|
specification_version: 4
|
162
161
|
summary: Provides easy access to AddressFinder APIs
|