addressfinder 1.2.0 → 1.3.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: dd55287eea55045c57b60b4a33a650c25aba42b0
4
- data.tar.gz: 88d85b667c45378a01c370d9b7453845ee1e403b
3
+ metadata.gz: 7d2d3c4923e027e17a94375f9ace07771fc20644
4
+ data.tar.gz: e17d6c8121c855971b817eaf1807805eeaa708b4
5
5
  SHA512:
6
- metadata.gz: 05ae9738123018521f49e009ffc0485574a246e2879459b9736170ece70b1923dd50aae07303c28a2e853dc54e7757be42df54a4690acf24dd79338f79fc97ac
7
- data.tar.gz: c591f3700cbc86b90cf447a16d79b49e1487a8e1db7b43e45f4b1dc314fb66271b1e8e086edab3118fc2b364f2b474bbed623c80a0dab636d0cb32bf15d8985a
6
+ metadata.gz: 58ea4d86be9dc5cab93385a9482247a88d934c0582f9b246f47abef938d97fe2de6bed37c14e110604d448dcf5edf405e0afdbcab66be338fef16d2da3005a3e
7
+ data.tar.gz: 3568aa198161346b55abe3e941e7ddf027134dcf54ec46e2bd6f46be4d1358ce356eb29e83a70e77776c9f6ef165ec5c973f6f40b5a37ea947940de4c16e9bb4
@@ -1,3 +1,7 @@
1
+ # AddressFinder 1.3.0 (October 16, 2015) #
2
+
3
+ * Add optional domain parameter to configuration and API calls
4
+
1
5
  # AddressFinder 1.2.0 (October 1, 2015) #
2
6
 
3
7
  * Add support for Location Search API
data/README.md CHANGED
@@ -39,6 +39,7 @@ AddressFinder.configure do |af|
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'
42
43
  end
43
44
  ```
44
45
 
@@ -5,8 +5,8 @@ Gem::Specification.new do |gem|
5
5
  gem.name = "addressfinder"
6
6
  gem.version = AddressFinder::VERSION
7
7
  gem.licenses = ['MIT']
8
- gem.authors = ["Nigel Ramsay"]
9
- gem.email = ["nigel@abletech.nz"]
8
+ gem.authors = ["Nigel Ramsay", "Naiki Pohe", "Sean Arnold"]
9
+ gem.email = ["nigel.ramsay@abletech.co.nz", "naiki.pohe@abletech.co.nz", "seanarnie@gmail.com"]
10
10
  gem.description = %q{Ruby client library for AddressFinder}
11
11
  gem.summary = %q{Provides easy access to AddressFinder APIs}
12
12
  gem.homepage = "https://github.com/AbleTech/addressfinder-ruby"
@@ -17,11 +17,9 @@ Gem::Specification.new do |gem|
17
17
  gem.require_paths = ["lib"]
18
18
 
19
19
  gem.required_ruby_version = '~> 2.1'
20
- gem.add_runtime_dependency 'multi_json', '~> 1.0'
21
-
20
+ gem.add_dependency 'multi_json', '~> 1.11'
22
21
  gem.add_development_dependency 'rspec', '~> 3.3'
23
- gem.add_development_dependency 'guard-rspec', '~> 4.5'
24
- gem.add_development_dependency 'bundler', '~> 0'
25
- gem.add_development_dependency 'rake', '~> 0'
26
- gem.add_development_dependency 'webmock', '~> 0'
22
+ gem.add_development_dependency 'guard-rspec', '~> 4.6'
23
+ gem.add_development_dependency 'rake', '~> 10.4'
24
+ gem.add_development_dependency 'webmock', '~> 1.21'
27
25
  end
@@ -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, http:)
8
+ def initialize(q:, country: nil, delivered: nil, post_box: nil, rural: nil, region_code: nil, domain: 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['domain'] = domain || config.domain if (domain || config.domain)
15
16
  @params['format'] = 'json'
16
17
  @params['key'] = config.api_key
17
18
  @params['secret'] = config.api_secret
@@ -29,7 +30,7 @@ module AddressFinder
29
30
 
30
31
  private
31
32
 
32
- attr_reader :request_uri, :params, :result, :country, :http
33
+ attr_reader :request_uri, :params, :country, :http
33
34
  attr_accessor :response_body, :response_status
34
35
  attr_writer :result
35
36
 
@@ -10,6 +10,7 @@ module AddressFinder
10
10
  attr_accessor :proxy_password
11
11
  attr_accessor :timeout
12
12
  attr_accessor :default_country
13
+ attr_accessor :domain
13
14
 
14
15
  def initialize
15
16
  self.hostname = 'api.addressfinder.io'
@@ -10,6 +10,7 @@ module AddressFinder
10
10
  @country = params.delete(:country) || config.default_country
11
11
 
12
12
  @params = params
13
+ @params['domain'] = params['domain'] || config.domain if (params['domain'] || config.domain)
13
14
  @params['key'] = config.api_key
14
15
  @params['secret'] = config.api_secret
15
16
  end
@@ -10,6 +10,7 @@ module AddressFinder
10
10
  @country = params.delete(:country) || config.default_country
11
11
 
12
12
  @params = params
13
+ @params['domain'] = params['domain'] || config.domain if (params['domain'] || config.domain)
13
14
  @params['key'] = config.api_key
14
15
  @params['secret'] = config.api_secret
15
16
  end
@@ -1,3 +1,3 @@
1
1
  module AddressFinder
2
- VERSION = '1.2.0'
2
+ VERSION = '1.3.0'
3
3
  end
@@ -32,6 +32,23 @@ RSpec.describe AddressFinder::Cleanse do
32
32
 
33
33
  it { expect(request_uri).to eq('/api/au/address/cleanse?q=186%20willis%20st&format=json&key=XXX&secret=YYY') }
34
34
  end
35
+
36
+ context 'with a domain given' do
37
+ let(:args){ {q: '123', domain: 'testdomain.com', http: http} }
38
+
39
+ it { expect(request_uri).to eq('/api/nz/address/cleanse?q=123&domain=testdomain.com&format=json&key=XXX&secret=YYY') }
40
+
41
+ context 'given in the AF configuration' do
42
+
43
+ let(:args){ {q: '123', http: http} }
44
+
45
+ it 'should use the config domain if set' do
46
+ AddressFinder.configuration.domain = 'anotherdomain.com'
47
+ expect(request_uri).to eq('/api/nz/address/cleanse?q=123&domain=anotherdomain.com&format=json&key=XXX&secret=YYY')
48
+ AddressFinder.configuration.domain = nil # set back to nil after
49
+ end
50
+ end
51
+ end
35
52
  end
36
53
 
37
54
  describe '#build_result' do
@@ -26,6 +26,23 @@ RSpec.describe AddressFinder::LocationInfo do
26
26
 
27
27
  it { expect(request_uri).to eq('/api/au/location/info.json?pxid=123&key=XXX&secret=YYY') }
28
28
  end
29
+
30
+ context 'with a domain given' do
31
+ let(:args){ {pxid: '123', domain: 'testdomain.com'} }
32
+
33
+ it { expect(request_uri).to eq('/api/au/location/info.json?pxid=123&domain=testdomain.com&key=XXX&secret=YYY') }
34
+
35
+ context 'given in the AF configuration' do
36
+
37
+ let(:args){ {pxid: '123'} }
38
+
39
+ it 'should use the config domain if set' do
40
+ AddressFinder.configuration.domain = 'anotherdomain.com'
41
+ expect(request_uri).to eq('/api/au/location/info.json?pxid=123&domain=anotherdomain.com&key=XXX&secret=YYY')
42
+ AddressFinder.configuration.domain = nil # set back to nil after
43
+ end
44
+ end
45
+ end
29
46
  end
30
47
 
31
48
  describe '#build_result' do
@@ -32,6 +32,23 @@ RSpec.describe AddressFinder::LocationSearch do
32
32
 
33
33
  it { expect(request_uri).to eq('/api/au/location.json?q=willis%20st&key=XXX&secret=YYY') }
34
34
  end
35
+
36
+ context 'with a domain given' do
37
+ let(:args){ {q: '123', domain: 'testdomain.com'} }
38
+
39
+ it { expect(request_uri).to eq('/api/nz/location.json?q=123&domain=testdomain.com&key=XXX&secret=YYY') }
40
+
41
+ context 'given in the AF configuration' do
42
+
43
+ let(:args){ {q: '123'} }
44
+
45
+ it 'should use the config domain if set' do
46
+ AddressFinder.configuration.domain = 'anotherdomain.com'
47
+ expect(request_uri).to eq('/api/nz/location.json?q=123&domain=anotherdomain.com&key=XXX&secret=YYY')
48
+ AddressFinder.configuration.domain = nil # set back to nil after
49
+ end
50
+ end
51
+ end
35
52
  end
36
53
 
37
54
  describe '#build_result' do
metadata CHANGED
@@ -1,14 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: addressfinder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nigel Ramsay
8
+ - Naiki Pohe
9
+ - Sean Arnold
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
11
- date: 2015-09-30 00:00:00.000000000 Z
13
+ date: 2015-10-15 00:00:00.000000000 Z
12
14
  dependencies:
13
15
  - !ruby/object:Gem::Dependency
14
16
  name: multi_json
@@ -16,14 +18,14 @@ dependencies:
16
18
  requirements:
17
19
  - - "~>"
18
20
  - !ruby/object:Gem::Version
19
- version: '1.0'
21
+ version: '1.11'
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
23
25
  requirements:
24
26
  - - "~>"
25
27
  - !ruby/object:Gem::Version
26
- version: '1.0'
28
+ version: '1.11'
27
29
  - !ruby/object:Gem::Dependency
28
30
  name: rspec
29
31
  requirement: !ruby/object:Gem::Requirement
@@ -44,59 +46,47 @@ dependencies:
44
46
  requirements:
45
47
  - - "~>"
46
48
  - !ruby/object:Gem::Version
47
- version: '4.5'
49
+ version: '4.6'
48
50
  type: :development
49
51
  prerelease: false
50
52
  version_requirements: !ruby/object:Gem::Requirement
51
53
  requirements:
52
54
  - - "~>"
53
55
  - !ruby/object:Gem::Version
54
- version: '4.5'
55
- - !ruby/object:Gem::Dependency
56
- name: bundler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '0'
56
+ version: '4.6'
69
57
  - !ruby/object:Gem::Dependency
70
58
  name: rake
71
59
  requirement: !ruby/object:Gem::Requirement
72
60
  requirements:
73
61
  - - "~>"
74
62
  - !ruby/object:Gem::Version
75
- version: '0'
63
+ version: '10.4'
76
64
  type: :development
77
65
  prerelease: false
78
66
  version_requirements: !ruby/object:Gem::Requirement
79
67
  requirements:
80
68
  - - "~>"
81
69
  - !ruby/object:Gem::Version
82
- version: '0'
70
+ version: '10.4'
83
71
  - !ruby/object:Gem::Dependency
84
72
  name: webmock
85
73
  requirement: !ruby/object:Gem::Requirement
86
74
  requirements:
87
75
  - - "~>"
88
76
  - !ruby/object:Gem::Version
89
- version: '0'
77
+ version: '1.21'
90
78
  type: :development
91
79
  prerelease: false
92
80
  version_requirements: !ruby/object:Gem::Requirement
93
81
  requirements:
94
82
  - - "~>"
95
83
  - !ruby/object:Gem::Version
96
- version: '0'
84
+ version: '1.21'
97
85
  description: Ruby client library for AddressFinder
98
86
  email:
99
- - nigel@abletech.nz
87
+ - nigel.ramsay@abletech.co.nz
88
+ - naiki.pohe@abletech.co.nz
89
+ - seanarnie@gmail.com
100
90
  executables: []
101
91
  extensions: []
102
92
  extra_rdoc_files: []
@@ -142,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
132
  version: '0'
143
133
  requirements: []
144
134
  rubyforge_project:
145
- rubygems_version: 2.4.7
135
+ rubygems_version: 2.4.2
146
136
  signing_key:
147
137
  specification_version: 4
148
138
  summary: Provides easy access to AddressFinder APIs