addressfinder 1.6.1 → 1.6.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 867dfc938d96ea86964d5855d4ad5427407b7685
4
- data.tar.gz: 7cae59337cb6014fecc96334a350e6315c2ab8cb
2
+ SHA256:
3
+ metadata.gz: de05727d08ca624896115f6fe76ae68bb3dd36ed99195468153cf982c9af07a0
4
+ data.tar.gz: 30ba24d9f052a8884ec5772b8d0d492f1334636674ae29e265ddd3fb105d51dd
5
5
  SHA512:
6
- metadata.gz: e0db8ca4d697a30774da34e3058ef5a4c3f24e0c82d5f8e393ff86fa87a70ff95d1849c2f28d0248b20230d694f2d32a95d0265c1fa9493f651d8996cea39402
7
- data.tar.gz: 15d086c393bdd02f3adc9adee36d562e8f7e8e380f95c888c87c77f934a4ea8ef6dc4a84d4d9310576007a57c2fc88e07e9fec19a2cbc6791fec3168f9ea7ef1
6
+ metadata.gz: 160bee2722353ec131681b401a1ddb92748cb606b4e0bf5d1572a924becf1475a61431ef8382f39df9e361a4133d300714ec029033a631285f62f646c3428e17
7
+ data.tar.gz: e1d026848279132f2cd4b2e1ba35061adee84fcac56e89b54fc336b7caff2386e4123a9f5686ea0792dc371fd6a2ba6fa35195d8dfd28a858de43e376cc423f5
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.2
4
3
  - 2.2.3
5
4
  - 2.3.1
6
5
  - 2.4.1
6
+ - 2.6.3
@@ -1,3 +1,7 @@
1
+ # AddressFinder 1.6.2 (September 23, 2019) #
2
+
3
+ * Add support for an optional state_codes parameter in the Cleanse class
4
+
1
5
  # AddressFinder 1.6.1 (January 14, 2019) #
2
6
 
3
7
  * Add support for an optional census parameter in the Cleanse class
@@ -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'
@@ -6,7 +6,14 @@ module AddressFinder
6
6
  end
7
7
 
8
8
  def self.encode_and_join_params(params)
9
- params.map{ |k,v| "#{k}=#{encode(v)}" }.join('&')
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
@@ -1,3 +1,3 @@
1
1
  module AddressFinder
2
- VERSION = '1.6.1'
2
+ VERSION = '1.6.2'
3
3
  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.1
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-01-14 00:00:00.000000000 Z
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
- rubyforge_project:
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