addressfinder 1.5.2 → 1.6.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: 05ba956f56eb4abdf67174b1c8dc8fa60e429855
4
- data.tar.gz: 473d3c098ab85f3255409d42fc114dbbddd278bf
3
+ metadata.gz: 9b79f5f19495e699810a70554f1b039b18593358
4
+ data.tar.gz: db666ffb8a6b4c80f83dc596d21a94134aa333cf
5
5
  SHA512:
6
- metadata.gz: 9056caa0b3632c4069dc0f78fea84c876fa3fda0438af6cd771bee2a09aab93087e912decf5eabf923b442994360ec09c063f62d014ea86dd959be1dbf031082
7
- data.tar.gz: 0d20f2503daaeed9e724231973414731e65bfa4aa468f37ad7dadd059b226832bdf0f1ac3eadd49fbc395dc746cf5887e092e98691e9aa09ff4473764c1cba24
6
+ metadata.gz: b0c51e33b40f79d5b60375c608d875818aba925c2aeb54835bfb37f01f3a2470b0a62dc5d5484c7d7499fb474ae34dd326d196b8d66e9253c570a160fa01551a
7
+ data.tar.gz: 8c3f3805a0db4e847fdf4a854d8b1c55c7c43973ef84d51b5123b3c7de10c74e6d846eaf67c5a9742cf5d75175c9d4ece5e7e461e9ddc0ef8e30f9b44ec13cf9
@@ -2,3 +2,5 @@ language: ruby
2
2
  rvm:
3
3
  - 2.1.2
4
4
  - 2.2.3
5
+ - 2.3.1
6
+ - 2.4.1
@@ -1,3 +1,7 @@
1
+ # AddressFinder 1.6.0 (August 10, 2017) #
2
+
3
+ * Add support for a configurable number of request retries
4
+
1
5
  # AddressFinder 1.5.2 (December 21, 2015) #
2
6
 
3
7
  * Update for the nested response format used in Address Cleanse Australia
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/addressfinder.svg)](http://badge.fury.io/rb/addressfinder)
4
4
  [![Build Status](https://travis-ci.org/AbleTech/addressfinder-ruby.svg)](https://travis-ci.org/AbleTech/addressfinder-ruby)
5
5
 
6
- A client library for accessing the AddressFinder APIs.
6
+ A client library for accessing the [AddressFinder](https://addressfinder.nz/?utm_source=github&utm_medium=readme&utm_campaign=addressfinder_rubygem&utm_term=AddressFinder) APIs.
7
7
 
8
8
  ## Installation
9
9
 
@@ -19,40 +19,41 @@ Or install it yourself as:
19
19
 
20
20
  $ gem install addressfinder
21
21
 
22
- ## Usage
23
-
24
- ### Configuration
22
+ ## Configuration
25
23
 
26
- You should call the configure block on startup of your app. In a Ruby on Rails application this
27
- is normally performed in an initializer file. For example `./config/initializers/addressfinder.rb`
24
+ Use the configure block to set your `api_key` and `api_secret`.
28
25
 
29
26
  ```ruby
30
27
  AddressFinder.configure do |af|
31
- # Mandatory configuration
28
+ # Required
32
29
  af.api_key = 'XXXXXXXXXX'
33
30
  af.api_secret = 'YYYYYYYYYY'
34
- af.default_country = 'nz'
35
31
 
36
- # Optional configuration
37
- af.timeout = 10 # seconds
38
- af.proxy_host = 'corp.proxy.com'
32
+ # Optional
33
+ af.default_country = 'nz' # default: nz
34
+ af.timeout = 10 # default: 10 seconds
35
+ af.retries = 12 # default: 12
36
+ af.retry_delay = 5 # default: 5 seconds
37
+ af.domain = 'yourdomain.com'
38
+ af.proxy_host = 'yourproxy.com'
39
39
  af.proxy_port = 8080
40
40
  af.proxy_user = 'username'
41
41
  af.proxy_password = 'password'
42
- af.domain = 'myserver.mycompany.co.nz'
43
42
  end
44
43
  ```
45
44
 
46
- You can obtain your API key and secret from the AddressFinder Portal.
45
+ **_Don't know your key and secret?_**
46
+ *Login to the [AddressFinder portal](https://portal.addressfinder.io/?utm_source=github&utm_medium=readme&utm_campaign=addressfinder_rubygem&utm_term=AddressFinder%20Portal) to obtain your key and secret.*
47
47
 
48
- ### Address Cleansing
48
+ **_For Ruby on Rails:_**
49
+ *The configure block is best placed in an initializer file (`./config/initializers/addressfinder.rb`).*
50
+
51
+ ## Usage
49
52
 
50
- See the documentation on the available parameters and expected response here:
53
+ For available parameters and example responses, see the API documentation pages for [New Zealand](https://addressfinder.nz/docs?utm_source=github&utm_medium=readme&utm_campaign=addressfinder_rubygem&utm_term=New%20Zealand) or [Australia](https://addressfinder.com.au/docs?utm_source=github&utm_medium=readme&utm_campaign=addressfinder_rubygem&utm_term=Australia).
51
54
 
52
- https://addressfinder.nz/docs/address_cleanse_api/
53
- https://addressfinder.com.au/docs/address_cleanse_api/
54
55
 
55
- Usage example:
56
+ #### Address Verification
56
57
 
57
58
  ```ruby
58
59
  result = AddressFinder.cleanse(q: '186 Willis St, Wellington', country: 'nz')
@@ -64,102 +65,78 @@ else
64
65
  end
65
66
  ```
66
67
 
67
- ### Location Search
68
-
69
- See documentation on the available parameters and expected response here:
70
-
71
- https://addressfinder.nz/docs/location_api/
72
-
73
- Usage example:
68
+ #### Address Autocomplete
74
69
 
75
70
  ```ruby
76
71
  begin
77
- results = AddressFinder.location_search(q: 'Queen Street')
72
+ results = AddressFinder.address_search(q: '186 Willis Street')
78
73
  if results.any?
79
- $standout.puts "Success: #{results}"
74
+ $stdout.puts "Success: #{results}"
80
75
  else
81
- $standout.puts "Sorry, there were no location matches"
76
+ $stdout.puts "Sorry, there were no address matches"
82
77
  end
83
78
  rescue AddressFinder::RequestRejectedError => e
84
79
  response = JSON.parse(e.body)
85
- $standout.puts response['message']
80
+ $stdout.puts response['message']
86
81
  end
87
82
  ```
88
83
 
89
- ### Location Info
90
-
91
- See documentation on the available parameters and expected response here:
92
-
93
- https://addressfinder.nz/docs/location_info_api/
94
-
95
- Usage example:
84
+ #### Address Metadata
96
85
 
97
86
  ```ruby
98
87
  begin
99
- result = AddressFinder.location_info(pxid: '1-.B.3l')
88
+ result = AddressFinder.address_info(pxid: '1-.B.3l')
100
89
  if result
101
- $standout.puts "Success: #{result.a}"
90
+ $stdout.puts "Success: #{result.a}"
102
91
  else
103
- $standout.puts "Sorry, can't find that location"
92
+ $stdout.puts "Sorry, can't find that address"
104
93
  end
105
94
  rescue AddressFinder::RequestRejectedError => e
106
95
  response = JSON.parse(e.body)
107
- $standout.puts response['message']
96
+ $stdout.puts response['message']
108
97
  end
109
98
  ```
110
99
 
111
- ### Address Search
112
-
113
- See documentation on the available parameters and expected response here:
114
-
115
- https://addressfinder.nz/docs/address_api/
116
-
117
- Usage example:
100
+ #### Location Autocomplete
118
101
 
119
102
  ```ruby
120
103
  begin
121
- results = AddressFinder.address_search(q: '186 Willis Street')
104
+ results = AddressFinder.location_search(q: 'Queen Street')
122
105
  if results.any?
123
- $standout.puts "Success: #{results}"
106
+ $stdout.puts "Success: #{results}"
124
107
  else
125
- $standout.puts "Sorry, there were no address matches"
108
+ $stdout.puts "Sorry, there were no location matches"
126
109
  end
127
110
  rescue AddressFinder::RequestRejectedError => e
128
111
  response = JSON.parse(e.body)
129
- $standout.puts response['message']
112
+ $stdout.puts response['message']
130
113
  end
131
114
  ```
132
115
 
133
- ### Address Info
134
-
135
- See documentation on the available parameters and expected response here:
136
-
137
- https://addressfinder.nz/docs/address_info_api/
138
-
139
- Usage example:
116
+ #### Location Metadata
140
117
 
141
118
  ```ruby
142
119
  begin
143
- result = AddressFinder.address_info(pxid: '1-.B.3l')
120
+ result = AddressFinder.location_info(pxid: '1-.B.3l')
144
121
  if result
145
- $standout.puts "Success: #{result.a}"
122
+ $stdout.puts "Success: #{result.a}"
146
123
  else
147
- $standout.puts "Sorry, can't find that address"
124
+ $stdout.puts "Sorry, can't find that location"
148
125
  end
149
126
  rescue AddressFinder::RequestRejectedError => e
150
127
  response = JSON.parse(e.body)
151
- $standout.puts response['message']
128
+ $stdout.puts response['message']
152
129
  end
153
130
  ```
154
131
 
155
- ### Bulk Operations
132
+ ## Advanced Usage
156
133
 
157
- If you have a series of calls you need to make to AddressFinder, you can use the
158
- bulk method which re-uses the HTTP connection.
134
+ #### Bulk Operations
159
135
 
160
- The bulk method is only available for #cleanse operation.
136
+ If you have a series of API requests, you can use the
137
+ bulk method to re-use the HTTP connection.
161
138
 
162
- Usage example:
139
+ **Note:** The bulk method is currently only available for Address Verification (`#cleanse`).
163
140
 
164
141
  ```ruby
165
142
  AddressFinder.bulk do |af|
@@ -175,34 +152,22 @@ AddressFinder.bulk do |af|
175
152
  end
176
153
  ```
177
154
 
178
- ## Advanced Usage
179
-
180
- ### Key and Secret Override
181
-
182
- What if you want to use another acccount for a specific query using the AddressFinder gem in your ruby app?
183
-
184
- You can override the `api_key` and `api_secret` set in the AddressFinder.configure block in `./config/initializers/addressfinder.rb` when using the AddressFinder gem.
185
155
 
186
- Those AddressFinder methods accept `:key` and `:secret` arguments:
187
- - `#cleanse`,
188
- - `#location_search`,
189
- - `#location_info`,
190
- - `#address_search`
191
- - `#address_info`
156
+ #### Key and Secret override
192
157
 
193
- Usage example:
158
+ What if you want to use another account for a specific query? You can override the `api_key` and `api_secret`.
194
159
 
195
160
  ```ruby
196
161
  begin
197
162
  result = AddressFinder.address_info(pxid: '1-.B.3l', key: 'AAAAAAAAAAAAA', secret: 'BBBBBBBBBBBBB')
198
163
  if result
199
- $standout.puts "Success: #{result.a}"
164
+ $stdout.puts "Success: #{result.a}"
200
165
  else
201
- $standout.puts "Sorry, can't find that address"
166
+ $stdout.puts "Sorry, can't find that address"
202
167
  end
203
168
  rescue AddressFinder::RequestRejectedError => e
204
169
  response = JSON.parse(e.body)
205
- $standout.puts response['message']
170
+ $stdout.puts response['message']
206
171
  end
207
172
  ```
208
173
 
@@ -22,4 +22,5 @@ Gem::Specification.new do |gem|
22
22
  gem.add_development_dependency 'guard-rspec', '~> 4.6'
23
23
  gem.add_development_dependency 'rake', '~> 10.4'
24
24
  gem.add_development_dependency 'webmock', '~> 1.21'
25
+ gem.add_development_dependency 'listen', '~> 3.0.0'
25
26
  end
@@ -1,4 +1,3 @@
1
- require 'net/http'
2
1
  require 'multi_json'
3
2
  require 'addressfinder/version'
4
3
  require 'addressfinder/configuration'
@@ -10,6 +9,7 @@ require 'addressfinder/address_search'
10
9
  require 'addressfinder/bulk'
11
10
  require 'addressfinder/errors'
12
11
  require 'addressfinder/util'
12
+ require 'addressfinder/http'
13
13
 
14
14
  module AddressFinder
15
15
  class << self
@@ -28,41 +28,27 @@ module AddressFinder
28
28
  end
29
29
 
30
30
  def cleanse(args={})
31
- AddressFinder::Cleanse.new(args.merge(http: configure_http)).perform.result
31
+ AddressFinder::Cleanse.new(args.merge(http: AddressFinder::HTTP.new(configuration))).perform.result
32
32
  end
33
33
 
34
34
  def location_search(args={})
35
- AddressFinder::LocationSearch.new(params: args, http: configure_http).perform.results
35
+ AddressFinder::LocationSearch.new(params: args, http: AddressFinder::HTTP.new(configuration)).perform.results
36
36
  end
37
37
 
38
38
  def location_info(args={})
39
- AddressFinder::LocationInfo.new(params: args, http: configure_http).perform.result
39
+ AddressFinder::LocationInfo.new(params: args, http: AddressFinder::HTTP.new(configuration)).perform.result
40
40
  end
41
41
 
42
42
  def address_search(args={})
43
- AddressFinder::AddressSearch.new(params: args, http: configure_http).perform.results
43
+ AddressFinder::AddressSearch.new(params: args, http: AddressFinder::HTTP.new(configuration)).perform.results
44
44
  end
45
45
 
46
46
  def address_info(args={})
47
- AddressFinder::AddressInfo.new(params: args, http: configure_http).perform.result
47
+ AddressFinder::AddressInfo.new(params: args, http: AddressFinder::HTTP.new(configuration)).perform.result
48
48
  end
49
49
 
50
50
  def bulk(&block)
51
- # TODO include parameter http: configure_http
52
- AddressFinder::Bulk.new(&block).perform
53
- end
54
-
55
- private
56
-
57
- def configure_http
58
- http = Net::HTTP.new(configuration.hostname, configuration.port,
59
- configuration.proxy_host, configuration.proxy_port,
60
- configuration.proxy_user, configuration.proxy_password)
61
- http.open_timeout = configuration.timeout
62
- http.read_timeout = configuration.timeout
63
- http.use_ssl = true
64
-
65
- http
51
+ AddressFinder::Bulk.new(http: AddressFinder::HTTP.new(configuration), &block).perform
66
52
  end
67
53
  end
68
54
  end
@@ -1,24 +1,19 @@
1
1
  module AddressFinder
2
2
  class Bulk
3
- def initialize(&block)
3
+ def initialize(http:, &block)
4
4
  @block = block
5
+ @http_config = http
5
6
  end
6
7
 
7
8
  def perform
8
- Net::HTTP.start(config.hostname, config.port, use_ssl: true,
9
- open_timeout: config.timeout,
10
- read_timeout: config.timeout) do |http|
9
+ http_config.start do |http|
11
10
  block.call ClientProxy.new(http: http)
12
11
  end
13
12
  end
14
13
 
15
14
  private
16
15
 
17
- attr_reader :block
18
-
19
- def config
20
- @_config ||= AddressFinder.configuration
21
- end
16
+ attr_reader :block, :http_config
22
17
 
23
18
  class ClientProxy
24
19
  def initialize(http:)
@@ -11,11 +11,15 @@ module AddressFinder
11
11
  attr_accessor :timeout
12
12
  attr_accessor :default_country
13
13
  attr_accessor :domain
14
+ attr_accessor :retries
15
+ attr_accessor :retry_delay
14
16
 
15
17
  def initialize
16
18
  self.hostname = 'api.addressfinder.io'
17
19
  self.port = 443
18
20
  self.timeout = 10
21
+ self.retries = 12
22
+ self.retry_delay = 5
19
23
  self.default_country = 'nz'
20
24
  end
21
25
  end
@@ -0,0 +1,55 @@
1
+ require 'net/http'
2
+
3
+ module AddressFinder
4
+ class HTTP
5
+ attr_reader :config
6
+
7
+ def initialize(config)
8
+ @config = config
9
+ @connection_is_bad = false
10
+ end
11
+
12
+ def start(&block)
13
+ net_http.start do
14
+ block.call(self)
15
+ end
16
+ end
17
+
18
+ def request(args)
19
+ retries = 0
20
+ begin
21
+ re_establish_connection if @connection_is_bad
22
+ net_http.request(args)
23
+ rescue Net::ReadTimeout, Net::OpenTimeout, SocketError => error
24
+ if retries < config.retries
25
+ retries += 1
26
+ sleep(config.retry_delay)
27
+ @connection_is_bad = true if net_http.started?
28
+ retry
29
+ else
30
+ raise error
31
+ end
32
+ end
33
+ end
34
+
35
+ private
36
+
37
+ def re_establish_connection
38
+ @connection_is_bad = false
39
+ net_http.finish
40
+ net_http.start
41
+ end
42
+
43
+ def net_http
44
+ @net_http ||= begin
45
+ http = Net::HTTP.new(config.hostname, config.port, config.proxy_host,
46
+ config.proxy_port, config.proxy_user,
47
+ config.proxy_password)
48
+ http.open_timeout = config.timeout
49
+ http.read_timeout = config.timeout
50
+ http.use_ssl = true
51
+ http
52
+ end
53
+ end
54
+ end
55
+ end
@@ -1,3 +1,3 @@
1
1
  module AddressFinder
2
- VERSION = '1.5.2'
2
+ VERSION = '1.6.0'
3
3
  end
@@ -11,7 +11,7 @@ RSpec.describe AddressFinder::AddressInfo do
11
11
 
12
12
  describe '#build_request' do
13
13
  let(:locator){ AddressFinder::AddressInfo.new(params: args, http: http) }
14
- let(:http){ AddressFinder.send(:configure_http) }
14
+ let(:http){ AddressFinder::HTTP.new(AddressFinder.configuration) }
15
15
 
16
16
  subject(:request_uri){ locator.send(:build_request) }
17
17
 
@@ -11,7 +11,7 @@ RSpec.describe AddressFinder::AddressSearch do
11
11
 
12
12
  describe '#build_request' do
13
13
  let(:locator){ AddressFinder::AddressSearch.new(params: args, http: http) }
14
- let(:http){ AddressFinder.send(:configure_http) }
14
+ let(:http){ AddressFinder::HTTP.new(AddressFinder.configuration) }
15
15
 
16
16
  subject(:request_uri){ locator.send(:build_request) }
17
17
 
@@ -0,0 +1,57 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe AddressFinder::Bulk do
4
+ before do
5
+ AddressFinder.configure do |af|
6
+ af.api_key = 'XXX'
7
+ af.api_secret = 'YYY'
8
+ af.default_country = 'nz'
9
+ af.timeout = 5
10
+ af.retries = 5
11
+ end
12
+ end
13
+
14
+ describe '#perform' do
15
+ let(:http){ AddressFinder::HTTP.new(AddressFinder.configuration) }
16
+ let(:net_http){ http.send(:net_http) }
17
+
18
+ before do
19
+ WebMock.allow_net_connect!(net_http_connect_on_start: true)
20
+ allow(http).to receive(:sleep)
21
+ end
22
+
23
+ after do
24
+ WebMock.disable_net_connect!
25
+ end
26
+
27
+ context "with 3 requests in the provided block" do
28
+ let(:response){ double(:response, body: %Q({"success": true}), code: "200") }
29
+ let(:block){
30
+ Proc.new do |proxy|
31
+ proxy.cleanse(q: "1 Willis")
32
+ proxy.cleanse(q: "2 Willis")
33
+ proxy.cleanse(q: "3 Willis")
34
+ end
35
+ }
36
+
37
+ it "uses 1 http connection" do
38
+ expect(net_http).to receive(:do_start).once.and_call_original
39
+ expect(net_http).to receive(:transport_request).exactly(3).times.and_return(response)
40
+ expect(net_http).to receive(:do_finish).once.and_call_original
41
+ AddressFinder::Bulk.new(http: http, &block).perform
42
+ end
43
+
44
+ it "re-establishes the http connection and continues where we left off when a Net::OpenTimeout, Net::ReadTimeout or SocketError is raised" do
45
+ expect(http).to receive(:re_establish_connection).exactly(3).times.and_call_original
46
+ expect(net_http).to receive(:do_start).exactly(4).times.and_call_original
47
+ expect(net_http).to receive(:transport_request).once.and_return(response) # 1 Willis (success)
48
+ expect(net_http).to receive(:transport_request).once.and_raise(Net::OpenTimeout) # 2 Willis (error)
49
+ expect(net_http).to receive(:transport_request).once.and_raise(Net::ReadTimeout) # Retry 2 Willis (error)
50
+ expect(net_http).to receive(:transport_request).once.and_raise(SocketError) # Retry 2 Willis (error)
51
+ expect(net_http).to receive(:transport_request).exactly(2).and_return(response) # Retry 2 Willis (success) & 3 Willis (success)
52
+ expect(net_http).to receive(:do_finish).exactly(4).times.and_call_original
53
+ AddressFinder::Bulk.new(http: http, &block).perform
54
+ end
55
+ end
56
+ end
57
+ end
@@ -6,13 +6,62 @@ RSpec.describe AddressFinder::Cleanse do
6
6
  af.api_key = 'XXX'
7
7
  af.api_secret = 'YYY'
8
8
  af.default_country = 'nz'
9
+ af.timeout = 5
10
+ af.retries = 3
9
11
  end
10
12
  end
11
13
 
12
- describe '#build_request' do
13
- let(:cleanser){ AddressFinder::Cleanse.new(args) }
14
- let(:http){ AddressFinder.send(:configure_http) }
14
+ let(:cleanser){ AddressFinder::Cleanse.new(args) }
15
+ let(:http){ AddressFinder::HTTP.new(AddressFinder.configuration) }
16
+ let(:net_http){ http.send(:net_http) }
17
+
18
+ describe '#execute_request' do
19
+ let(:args){ {q: "186 Willis Street", http: http} }
20
+
21
+ before do
22
+ WebMock.allow_net_connect!(net_http_connect_on_start: true)
23
+ allow(http).to receive(:sleep)
24
+ allow(cleanser).to receive(:request_uri).and_return("/test/path")
25
+ expect(http).to_not receive(:re_establish_connection)
26
+ end
27
+
28
+ after do
29
+ WebMock.disable_net_connect!
30
+ end
31
+
32
+ subject(:execute_request){ cleanser.send(:execute_request) }
33
+
34
+ it "retries an errored request another time before succeeding" do
35
+ expect(net_http).to receive(:do_start).twice.and_call_original
36
+ expect(net_http).to receive(:transport_request).once.and_raise(Net::OpenTimeout)
37
+ expect(net_http).to receive(:transport_request).once.and_return(double(:response, body: "OK", code: "200"))
38
+ expect(net_http).to receive(:do_finish).twice.and_call_original
39
+ execute_request
40
+ end
41
+
42
+ it "re-raises a Net::OpenTimeout error after 3 retries" do
43
+ expect(net_http).to receive(:do_start).exactly(4).times.and_call_original
44
+ expect(net_http).to receive(:transport_request).exactly(4).times.and_raise(Net::OpenTimeout)
45
+ expect(net_http).to receive(:do_finish).exactly(4).times.and_call_original
46
+ expect{execute_request}.to raise_error(Net::OpenTimeout)
47
+ end
48
+
49
+ it "re-raises a Net::ReadTimeout error after 3 retries" do
50
+ expect(net_http).to receive(:do_start).exactly(4).times.and_call_original
51
+ expect(net_http).to receive(:transport_request).exactly(4).times.and_raise(Net::ReadTimeout)
52
+ expect(net_http).to receive(:do_finish).exactly(4).times.and_call_original
53
+ expect{execute_request}.to raise_error(Net::ReadTimeout)
54
+ end
15
55
 
56
+ it "re-raises a SocketError error after 3 retries" do
57
+ expect(net_http).to receive(:do_start).exactly(4).times.and_call_original
58
+ expect(net_http).to receive(:transport_request).exactly(4).times.and_raise(SocketError)
59
+ expect(net_http).to receive(:do_finish).exactly(4).times.and_call_original
60
+ expect{execute_request}.to raise_error(SocketError)
61
+ end
62
+ end
63
+
64
+ describe '#build_request' do
16
65
  subject(:request_uri){ cleanser.send(:build_request) }
17
66
 
18
67
  context 'with minimal arguments' do
@@ -64,7 +113,7 @@ RSpec.describe AddressFinder::Cleanse do
64
113
  end
65
114
 
66
115
  describe '#build_result' do
67
- let(:cleanser){ AddressFinder::Cleanse.new(q: 'ignored', http: nil) }
116
+ let(:args){ {q: 'ignored', http: nil} }
68
117
 
69
118
  before do
70
119
  cleanser.send('response_body=', body)
@@ -11,7 +11,7 @@ RSpec.describe AddressFinder::LocationInfo do
11
11
 
12
12
  describe '#build_request' do
13
13
  let(:locator){ AddressFinder::LocationInfo.new(params: args, http: http) }
14
- let(:http){ AddressFinder.send(:configure_http) }
14
+ let(:http){ AddressFinder::HTTP.new(AddressFinder.configuration) }
15
15
 
16
16
  subject(:request_uri){ locator.send(:build_request) }
17
17
 
@@ -11,7 +11,7 @@ RSpec.describe AddressFinder::LocationSearch do
11
11
 
12
12
  describe '#build_request' do
13
13
  let(:locator){ AddressFinder::LocationSearch.new(params: args, http: http) }
14
- let(:http){ AddressFinder.send(:configure_http) }
14
+ let(:http){ AddressFinder::HTTP.new(AddressFinder.configuration) }
15
15
 
16
16
  subject(:request_uri){ locator.send(:build_request) }
17
17
 
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.5.2
4
+ version: 1.6.0
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: 2015-12-21 00:00:00.000000000 Z
14
+ date: 2017-08-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: multi_json
@@ -83,6 +83,20 @@ dependencies:
83
83
  - - "~>"
84
84
  - !ruby/object:Gem::Version
85
85
  version: '1.21'
86
+ - !ruby/object:Gem::Dependency
87
+ name: listen
88
+ requirement: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - "~>"
91
+ - !ruby/object:Gem::Version
92
+ version: 3.0.0
93
+ type: :development
94
+ prerelease: false
95
+ version_requirements: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: 3.0.0
86
100
  description: Ruby client library for AddressFinder
87
101
  email:
88
102
  - nigel.ramsay@abletech.co.nz
@@ -109,12 +123,14 @@ files:
109
123
  - lib/addressfinder/cleanse.rb
110
124
  - lib/addressfinder/configuration.rb
111
125
  - lib/addressfinder/errors.rb
126
+ - lib/addressfinder/http.rb
112
127
  - lib/addressfinder/location_info.rb
113
128
  - lib/addressfinder/location_search.rb
114
129
  - lib/addressfinder/util.rb
115
130
  - lib/addressfinder/version.rb
116
131
  - spec/lib/addressfinder/address_info_spec.rb
117
132
  - spec/lib/addressfinder/address_search_spec.rb
133
+ - spec/lib/addressfinder/bulk_spec.rb
118
134
  - spec/lib/addressfinder/cleanse_spec.rb
119
135
  - spec/lib/addressfinder/location_info_spec.rb
120
136
  - spec/lib/addressfinder/location_search_spec.rb
@@ -147,6 +163,7 @@ summary: Provides easy access to AddressFinder APIs
147
163
  test_files:
148
164
  - spec/lib/addressfinder/address_info_spec.rb
149
165
  - spec/lib/addressfinder/address_search_spec.rb
166
+ - spec/lib/addressfinder/bulk_spec.rb
150
167
  - spec/lib/addressfinder/cleanse_spec.rb
151
168
  - spec/lib/addressfinder/location_info_spec.rb
152
169
  - spec/lib/addressfinder/location_search_spec.rb