addressfinder 1.10.0 → 1.10.1

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
  SHA256:
3
- metadata.gz: 8d84bdab006a12ff6f18d90d33986cf03172e1d8fedc52ffca604795631b8420
4
- data.tar.gz: 933d6673ee1271440c17801ac410047a44761d6e1539de3f7c211cec9ee16bd7
3
+ metadata.gz: 85227fdfa94c38218cb23aa0f2d637270f5fba6f1e3101c1303404de467e4c72
4
+ data.tar.gz: 44987ff360e797b67691494785388fcdd51c12f08cbc925eb445ac3251a20102
5
5
  SHA512:
6
- metadata.gz: 27b217ad366baf5b6e46d02ab14410a30133d7adfefb06292a92daedc271266ed7139d83be5d14cdee4a3e1128ee18d6604049cd41405f243496bfc24dc13cf6
7
- data.tar.gz: 26861692d4d8936ae1f5a581390afb2d04cc1f9a870b43488e6f0e76d4bb33caacdbe92e28ee13e8b92960d1dc5bb410d0a01ffdba6fe83c4917214afbbbdf57
6
+ metadata.gz: 132e29b1da5bad8864aa136edfbb37cae2925610a767465cd3c027b70ec61492b9c55ed884e628b85fa87191d86c128153ba5f7476c8728ac09e866e131d7fc9
7
+ data.tar.gz: 6b64c5fd1de404b594e3e077b62bb3104e0aa9cf17e2f50a6ae2c688e449ce5dfd7cf214f677d8add6e32477d4dc562ab8cbc2a49031b9b37310aa3bdf1acfaf
@@ -11,13 +11,14 @@ Gem::Specification.new do |gem|
11
11
  gem.summary = 'Provides easy access to AddressFinder APIs'
12
12
  gem.homepage = 'https://github.com/AddressFinder/addressfinder-ruby'
13
13
 
14
- gem.files = `git ls-files`.split($/)
14
+ gem.files = `git ls-files`.split($/).select{|f| f.match(%r{^lib|\.gemspec$|\.md$})}
15
15
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
16
  gem.test_files = gem.files.grep(%r{^(spec|features)/})
17
17
  gem.require_paths = ['lib']
18
18
 
19
- gem.required_ruby_version = '>= 2.1'
19
+ gem.required_ruby_version = '>= 2.6'
20
20
  gem.add_dependency 'multi_json', '~> 1.15'
21
+
21
22
  gem.add_development_dependency 'guard-rspec', '~> 4.7'
22
23
  gem.add_development_dependency 'listen', '~> 3.7'
23
24
  gem.add_development_dependency 'rake', '~> 13.0'
@@ -1,3 +1,3 @@
1
1
  module AddressFinder
2
- VERSION = '1.10.0'
2
+ VERSION = '1.10.1'
3
3
  end
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.10.0
4
+ version: 1.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nigel Ramsay
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2023-08-30 00:00:00.000000000 Z
15
+ date: 2023-09-13 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: multi_json
@@ -109,18 +109,10 @@ executables: []
109
109
  extensions: []
110
110
  extra_rdoc_files: []
111
111
  files:
112
- - ".github/workflows/ruby.yml"
113
- - ".gitignore"
114
- - ".travis.yml"
115
112
  - CHANGELOG.md
116
- - Dockerfile
117
- - Gemfile
118
- - Guardfile
119
113
  - LICENSE.md
120
114
  - README.md
121
- - Rakefile
122
115
  - addressfinder.gemspec
123
- - docker-compose.yml
124
116
  - lib/addressfinder.rb
125
117
  - lib/addressfinder/address_autocomplete.rb
126
118
  - lib/addressfinder/address_info.rb
@@ -138,19 +130,6 @@ files:
138
130
  - lib/addressfinder/v2/au/verification.rb
139
131
  - lib/addressfinder/verification.rb
140
132
  - lib/addressfinder/version.rb
141
- - spec/lib/addressfinder/address_autocomplete_spec.rb
142
- - spec/lib/addressfinder/address_info_spec.rb
143
- - spec/lib/addressfinder/address_search_spec.rb
144
- - spec/lib/addressfinder/bulk_spec.rb
145
- - spec/lib/addressfinder/location_info_spec.rb
146
- - spec/lib/addressfinder/location_search_spec.rb
147
- - spec/lib/addressfinder/util_spec.rb
148
- - spec/lib/addressfinder/v1/email/verification_spec.rb
149
- - spec/lib/addressfinder/v1/phone/verification_spec.rb
150
- - spec/lib/addressfinder/v2/au/verification_spec.rb
151
- - spec/lib/addressfinder/verification_spec.rb
152
- - spec/lib/addressfinder_spec.rb
153
- - spec/spec_helper.rb
154
133
  homepage: https://github.com/AddressFinder/addressfinder-ruby
155
134
  licenses:
156
135
  - MIT
@@ -163,28 +142,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
163
142
  requirements:
164
143
  - - ">="
165
144
  - !ruby/object:Gem::Version
166
- version: '2.1'
145
+ version: '2.6'
167
146
  required_rubygems_version: !ruby/object:Gem::Requirement
168
147
  requirements:
169
148
  - - ">="
170
149
  - !ruby/object:Gem::Version
171
150
  version: '0'
172
151
  requirements: []
173
- rubygems_version: 3.1.4
152
+ rubygems_version: 3.2.33
174
153
  signing_key:
175
154
  specification_version: 4
176
155
  summary: Provides easy access to AddressFinder APIs
177
- test_files:
178
- - spec/lib/addressfinder/address_autocomplete_spec.rb
179
- - spec/lib/addressfinder/address_info_spec.rb
180
- - spec/lib/addressfinder/address_search_spec.rb
181
- - spec/lib/addressfinder/bulk_spec.rb
182
- - spec/lib/addressfinder/location_info_spec.rb
183
- - spec/lib/addressfinder/location_search_spec.rb
184
- - spec/lib/addressfinder/util_spec.rb
185
- - spec/lib/addressfinder/v1/email/verification_spec.rb
186
- - spec/lib/addressfinder/v1/phone/verification_spec.rb
187
- - spec/lib/addressfinder/v2/au/verification_spec.rb
188
- - spec/lib/addressfinder/verification_spec.rb
189
- - spec/lib/addressfinder_spec.rb
190
- - spec/spec_helper.rb
156
+ test_files: []
@@ -1,31 +0,0 @@
1
- name: Ruby
2
-
3
- on:
4
- push:
5
- branches: [ "master" ]
6
- pull_request:
7
- branches: [ "master" ]
8
-
9
- permissions:
10
- contents: read
11
-
12
- jobs:
13
- test:
14
-
15
- runs-on: ubuntu-latest
16
- strategy:
17
- matrix:
18
- ruby-version: ['2.6', '2.7', '3.0', '3.1']
19
-
20
- steps:
21
- - uses: actions/checkout@v3
22
- - name: Set up Ruby
23
- # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
24
- # change this to (see https://github.com/ruby/setup-ruby#versioning):
25
- # uses: ruby/setup-ruby@v1
26
- uses: ruby/setup-ruby@0a29871fe2b0200a17a4497bae54fe5df0d973aa # v1.115.3
27
- with:
28
- ruby-version: ${{ matrix.ruby-version }}
29
- bundler-cache: true # runs 'bundle install' and caches installed gems automatically
30
- - name: Run tests
31
- run: bundle exec rake
data/.gitignore DELETED
@@ -1,11 +0,0 @@
1
- *.gem
2
- *.rbc
3
- /.config
4
- /coverage/
5
- /spec/reports/
6
-
7
- # for a library or gem, you might want to ignore these files since the code is
8
- # intended to run in multiple environments; otherwise, check them in:
9
- Gemfile.lock
10
- .ruby-version
11
- .ruby-gemset
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.7
4
- - 2.3.1
5
- - 2.4.1
6
- - 2.6.3
data/Dockerfile DELETED
@@ -1,28 +0,0 @@
1
- # Use the barebones version of Ruby 2.7.x
2
- FROM ruby:2.7
3
-
4
- # Install dependencies:
5
- # - build-essential: To ensure certain gems can be compiled
6
- # - nodejs: Compile assets
7
- # - bundler: ensure most recent version is installed
8
- RUN apt-get update && apt-get install -qq -y build-essential --fix-missing --no-install-recommends
9
- RUN gem install bundler
10
-
11
- # Set an environment variable to store where the app is installed to inside
12
- # of the Docker image.
13
- ENV LANG C.UTF-8
14
- ENV BUNDLE_PATH /bundle
15
- ENV INSTALL_PATH /addressfinder-ruby
16
- RUN mkdir -p $INSTALL_PATH
17
-
18
- # Create address verification directories
19
- RUN mkdir -p $INSTALL_PATH/verification/originals
20
- RUN mkdir -p $INSTALL_PATH/verification/verified
21
-
22
- # This sets the context of where commands will be ran in and is documented
23
- # on Docker's website extensively.
24
- WORKDIR $INSTALL_PATH
25
-
26
- ADD . $INSTALL_PATH
27
-
28
- RUN bundle install
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
data/Guardfile DELETED
@@ -1,5 +0,0 @@
1
- guard :rspec, cmd: 'bundle exec rspec' do
2
- watch(%r{^spec/.+_spec\.rb$})
3
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
- watch('spec/spec_helper.rb') { "spec" }
5
- end
data/Rakefile DELETED
@@ -1,7 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new
5
-
6
- task :default => :spec
7
- task :test => :spec
data/docker-compose.yml DELETED
@@ -1,11 +0,0 @@
1
- version: '3'
2
- services:
3
- ruby:
4
- build: .
5
- volumes:
6
- - .:/addressfinder-ruby
7
- - bundle-cache:/bundle
8
- command: bundle exec rspec
9
-
10
- volumes:
11
- bundle-cache: {}
@@ -1,95 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.describe AddressFinder::AddressAutocomplete do
4
- before do
5
- AddressFinder.configure do |af|
6
- af.api_key = 'XXX'
7
- af.api_secret = 'YYY'
8
- af.default_country = 'au'
9
- end
10
- end
11
-
12
- describe '#build_request' do
13
- let(:locator){ AddressFinder::AddressAutocomplete.new(params: args, http: http) }
14
- let(:http){ AddressFinder::HTTP.new(AddressFinder.configuration) }
15
-
16
- subject(:request_uri){ locator.send(:build_request) }
17
-
18
- context 'with minimal arguments' do
19
- let(:args){ {q: '186 willis'} }
20
-
21
- it { expect(request_uri).to eq('/api/au/address/autocomplete.json?q=186+willis&key=XXX&secret=YYY') }
22
- end
23
-
24
- context 'with more arguments' do
25
- let(:args){ {q: '186 willis st', au_paf: 1, max: 10} }
26
-
27
- it { expect(request_uri).to eq('/api/au/address/autocomplete.json?q=186+willis+st&au_paf=1&max=10&key=XXX&secret=YYY') }
28
- end
29
-
30
- context 'with a country override' do
31
- let(:args){ {q: '186 willis st', country: 'au'} }
32
-
33
- it { expect(request_uri).to eq('/api/au/address/autocomplete.json?q=186+willis+st&key=XXX&secret=YYY') }
34
- end
35
-
36
- context 'with a key override' do
37
- let(:args){ {q: '186 willis st', key: 'AAA'} }
38
-
39
- it { expect(request_uri).to eq('/api/au/address/autocomplete.json?q=186+willis+st&key=AAA&secret=YYY') }
40
- end
41
-
42
- context 'with a secret override' do
43
- let(:args){ {q: '186 willis st', secret: 'BBB'} }
44
-
45
- it { expect(request_uri).to eq('/api/au/address/autocomplete.json?q=186+willis+st&secret=BBB&key=XXX') }
46
- end
47
- end
48
-
49
- describe '#validate_params' do
50
- let(:locator){ AddressFinder::AddressAutocomplete.new(params: args, http: http) }
51
- let(:http){ AddressFinder::HTTP.new(AddressFinder.configuration) }
52
-
53
- subject(:validate_params){ locator.send(:validate_params) }
54
-
55
- context 'with wrong country' do
56
- let(:args){ {q: '186 willis st', country: 'nz'} }
57
-
58
- it { expect{validate_params}.to raise_error(AddressFinder::RequestRejectedError) }
59
- end
60
-
61
- context 'with correct country' do
62
- let(:args){ {q: '186 willis st', country: 'au'} }
63
-
64
- it { expect{validate_params}.not_to raise_error }
65
- end
66
- end
67
-
68
- describe '#build_result' do
69
- let(:locator){ AddressFinder::AddressSearch.new(params: {q: 'ignored'}, http: nil) }
70
-
71
- before do
72
- locator.send('response_body=', body)
73
- locator.send('response_status=', status)
74
- locator.send(:build_result)
75
- end
76
-
77
- subject(:results){ locator.results }
78
-
79
- context 'with completions' do
80
- let(:body){ '{"completions":[{"a":"184 William Jones Drive, Otangarei, Whangarei 0112","pxid":"2-.9.2U.F.F.2I","v":1},{"a":"184 Williams Street, Kaiapoi 7630","pxid":"2-.3.1q.2.4G.4c","v":0},{"a":"184 Willis Street, Te Aro, Wellington 6011","pxid":"2-.F.1W.p.1D.1W","v":0}],"paid":true}' }
81
- let(:status){ '200' }
82
-
83
- it { expect(results.size).to eq(3) }
84
- it { expect(results.first.class).to eq(AddressFinder::AddressSearch::Result) }
85
- it { expect(results.first.a).to eq("184 William Jones Drive, Otangarei, Whangarei 0112") }
86
- end
87
-
88
- context 'with no completions' do
89
- let(:body){ '{"completions":[],"paid":true}' }
90
- let(:status){ '200' }
91
-
92
- it { expect(results).to eq([]) }
93
- end
94
- end
95
- end
@@ -1,62 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.describe AddressFinder::AddressInfo do
4
- before do
5
- AddressFinder.configure do |af|
6
- af.api_key = 'XXX'
7
- af.api_secret = 'YYY'
8
- af.default_country = 'au'
9
- end
10
- end
11
-
12
- describe '#build_request' do
13
- let(:locator){ AddressFinder::AddressInfo.new(params: args, http: http) }
14
- let(:http){ AddressFinder::HTTP.new(AddressFinder.configuration) }
15
-
16
- subject(:request_uri){ locator.send(:build_request) }
17
-
18
- context 'with a simple PXID' do
19
- let(:args){ {pxid: '123'} }
20
-
21
- it { expect(request_uri).to eq('/api/au/address/info.json?pxid=123&key=XXX&secret=YYY') }
22
- end
23
-
24
- context 'with a country override' do
25
- let(:args){ {pxid: '123', country: 'nz'} }
26
-
27
- it { expect(request_uri).to eq('/api/nz/address/info.json?pxid=123&key=XXX&secret=YYY') }
28
- end
29
-
30
- context 'with a key override' do
31
- let(:args){ {pxid: '123', key:'AAA'} }
32
-
33
- it { expect(request_uri).to eq('/api/au/address/info.json?pxid=123&key=AAA&secret=YYY') }
34
- end
35
-
36
- context 'with a secret override' do
37
- let(:args){ {pxid: '123', secret: 'BBB'} }
38
-
39
- it { expect(request_uri).to eq('/api/au/address/info.json?pxid=123&secret=BBB&key=XXX') }
40
- end
41
- end
42
-
43
- describe '#build_result' do
44
- let(:locator){ AddressFinder::AddressInfo.new(params: {q: 'ignored'}, http: nil) }
45
-
46
- before do
47
- locator.send('response_body=', body)
48
- locator.send('response_status=', status)
49
- end
50
-
51
- subject(:result){ locator.send(:build_result) }
52
-
53
- context 'with a successful result' do
54
- let(:body){ '{"pxid":"2-.9.2U.F.F.2I","number":"184","container_only":"false","x":"174.314855382547","y":"-35.6946659390092","postcode":"0112","a":"184 William Jones Drive, Otangarei, Whangarei 0112","postal":"184 William Jones Drive, Otangarei, Whangarei 0112","mailtown":"Whangarei","post_suburb":"Otangarei","ta":"Whangarei District","sufi":932755,"street_type":"drive","city":"Whangarei","suburb":"Otangarei","region":"Northland Region","street":"William Jones Drive","postal_line_1":"184 William Jones Drive","postal_line_2":"Otangarei","postal_line_3":"Whangarei 0112","meshblock":"93700","dpid":"681856"}' }
55
- let(:status){ '200' }
56
-
57
- it { expect(result.class).to eq(AddressFinder::AddressInfo::Result) }
58
- it { expect(result.a).to eq("184 William Jones Drive, Otangarei, Whangarei 0112") }
59
- it { expect(result.pxid).to eq("2-.9.2U.F.F.2I") }
60
- end
61
- end
62
- end
@@ -1,76 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.describe AddressFinder::AddressSearch 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
- end
10
- end
11
-
12
- describe '#build_request' do
13
- let(:locator){ AddressFinder::AddressSearch.new(params: args, http: http) }
14
- let(:http){ AddressFinder::HTTP.new(AddressFinder.configuration) }
15
-
16
- subject(:request_uri){ locator.send(:build_request) }
17
-
18
- context 'with minimal arguments' do
19
- let(:args){ {q: '186 willis'} }
20
-
21
- it { expect(request_uri).to eq('/api/nz/address.json?q=186+willis&key=XXX&secret=YYY') }
22
- end
23
-
24
- context 'with more arguments' do
25
- let(:args){ {q: '186 willis st', delivered: 1, max: 10} }
26
-
27
- it { expect(request_uri).to eq('/api/nz/address.json?q=186+willis+st&delivered=1&max=10&key=XXX&secret=YYY') }
28
- end
29
-
30
- context 'with a country override' do
31
- let(:args){ {q: '186 willis st', country: 'au'} }
32
-
33
- it { expect(request_uri).to eq('/api/au/address.json?q=186+willis+st&key=XXX&secret=YYY') }
34
- end
35
-
36
- context 'with a key override' do
37
- let(:args){ {q: '186 willis st', key: 'AAA'} }
38
-
39
- it { expect(request_uri).to eq('/api/nz/address.json?q=186+willis+st&key=AAA&secret=YYY') }
40
- end
41
-
42
- context 'with a secret override' do
43
- let(:args){ {q: '186 willis st', secret: 'BBB'} }
44
-
45
- it { expect(request_uri).to eq('/api/nz/address.json?q=186+willis+st&secret=BBB&key=XXX') }
46
- end
47
- end
48
-
49
- describe '#build_result' do
50
- let(:locator){ AddressFinder::AddressSearch.new(params: {q: 'ignored'}, http: nil) }
51
-
52
- before do
53
- locator.send('response_body=', body)
54
- locator.send('response_status=', status)
55
- locator.send(:build_result)
56
- end
57
-
58
- subject(:results){ locator.results }
59
-
60
- context 'with completions' do
61
- let(:body){ '{"completions":[{"a":"184 William Jones Drive, Otangarei, Whangarei 0112","pxid":"2-.9.2U.F.F.2I","v":1},{"a":"184 Williams Street, Kaiapoi 7630","pxid":"2-.3.1q.2.4G.4c","v":0},{"a":"184 Willis Street, Te Aro, Wellington 6011","pxid":"2-.F.1W.p.1D.1W","v":0}],"paid":true}' }
62
- let(:status){ '200' }
63
-
64
- it { expect(results.size).to eq(3) }
65
- it { expect(results.first.class).to eq(AddressFinder::AddressSearch::Result) }
66
- it { expect(results.first.a).to eq("184 William Jones Drive, Otangarei, Whangarei 0112") }
67
- end
68
-
69
- context 'with no completions' do
70
- let(:body){ '{"completions":[],"paid":true}' }
71
- let(:status){ '200' }
72
-
73
- it { expect(results).to eq([]) }
74
- end
75
- end
76
- end