addressfinder 1.15.0 → 1.16.0
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 +4 -4
- data/CHANGELOG.md +7 -1
- data/addressfinder.gemspec +4 -1
- data/lib/addressfinder/http.rb +2 -2
- data/lib/addressfinder/v1/phone/batch_verification.rb +72 -0
- data/lib/addressfinder/version.rb +1 -1
- data/lib/addressfinder.rb +5 -0
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0365876ccfbc2b618dd2e417b9d2fa238eaee83f8e1c0afa17230c3895f3542e'
|
4
|
+
data.tar.gz: a76840892fae1cdd10c646031edc4ff8f7675d499e0c21e7d7e7c73ebf63c35c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9fd2bc3220f84afdaa24c4075594dda01a846b8670ced3d5a4a019529e0995488b6981ccd8a28609ed759a3da9598cd0c81133f61a73519dd64f27b03809136
|
7
|
+
data.tar.gz: 386b3217887a2c3601a2290e2638f38989592cc33688eedde74df030afad8af7ed70ae867a39c8a9f65d03b4634b902b93175546f5f346aa0932ade795b89b68
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,13 @@
|
|
1
|
+
# Addressfinder 1.16.0 (September 2025) #
|
2
|
+
|
3
|
+
* Add CGI as dependency for Ruby 3.5+
|
4
|
+
* Add batch capability to Phone Numbers verification
|
5
|
+
* Don't enforce ssl as part of Net::HTTP configuration
|
6
|
+
|
1
7
|
# Addressfinder 1.15.0 (March 2025) #
|
2
8
|
|
3
9
|
* Automatically skip empty strings within Batch verification
|
4
|
-
* Mark unverified
|
10
|
+
* Mark unverified addresses as false within Batch verification
|
5
11
|
|
6
12
|
# Addressfinder 1.14.0 (February 2025) #
|
7
13
|
|
data/addressfinder.gemspec
CHANGED
@@ -20,12 +20,15 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.add_dependency 'multi_json', '~> 1.15'
|
21
21
|
gem.add_dependency "concurrent-ruby", "~> 1.2"
|
22
22
|
gem.add_dependency 'ostruct', '> 0.6'
|
23
|
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.5")
|
24
|
+
gem.add_dependency "cgi", "~> 0.5"
|
25
|
+
end
|
23
26
|
|
24
27
|
gem.add_development_dependency 'guard-rspec', '~> 4.7'
|
25
28
|
gem.add_development_dependency 'listen', '~> 3.7'
|
26
29
|
gem.add_development_dependency 'rake', '~> 13.0'
|
27
30
|
gem.add_development_dependency 'rspec', '~> 3.11'
|
28
|
-
gem.add_development_dependency 'webmock', '~>
|
31
|
+
gem.add_development_dependency 'webmock', '~> 3.25'
|
29
32
|
gem.add_development_dependency 'debug', '>= 1.0.0'
|
30
33
|
gem.add_development_dependency 'standard', '>= 1.35'
|
31
34
|
end
|
data/lib/addressfinder/http.rb
CHANGED
@@ -0,0 +1,72 @@
|
|
1
|
+
module AddressFinder
|
2
|
+
module V1
|
3
|
+
module Phone
|
4
|
+
class BatchVerification
|
5
|
+
attr_reader :phone_numbers, :results
|
6
|
+
|
7
|
+
# Verifies an array of phone numbers using concurrency to reduce the execution time.
|
8
|
+
# The results of the verification are stored in the `results` attribute, in the same order
|
9
|
+
# in which they were supplied.
|
10
|
+
#
|
11
|
+
# @param [Array<String>] phone_numbers
|
12
|
+
# @param [String] default_country_code
|
13
|
+
# @param [AddressFinder::HTTP] http HTTP connection helper
|
14
|
+
# @param [Integer] concurrency How many threads to use for verification
|
15
|
+
# @param [Hash] args Any additional arguments that will be passed onto the EV API
|
16
|
+
def initialize(phone_numbers:, default_country_code:, http:, concurrency: 5, **args)
|
17
|
+
@phone_numbers = phone_numbers
|
18
|
+
@concurrency = concurrency
|
19
|
+
@default_country_code = default_country_code
|
20
|
+
@http = http
|
21
|
+
@args = args
|
22
|
+
end
|
23
|
+
|
24
|
+
def perform
|
25
|
+
confirm_concurrency_level
|
26
|
+
verify_each_phone_number_concurrently
|
27
|
+
|
28
|
+
self
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
attr_reader :args, :concurrency, :http, :default_country_code
|
34
|
+
|
35
|
+
MAX_CONCURRENCY_LEVEL = 10
|
36
|
+
|
37
|
+
def confirm_concurrency_level
|
38
|
+
return unless @concurrency > MAX_CONCURRENCY_LEVEL
|
39
|
+
|
40
|
+
warn "WARNING: Concurrency level of #{@concurrency} is higher than the maximum of #{MAX_CONCURRENCY_LEVEL}. Using #{MAX_CONCURRENCY_LEVEL}."
|
41
|
+
@concurrency = MAX_CONCURRENCY_LEVEL
|
42
|
+
end
|
43
|
+
|
44
|
+
def verify_each_phone_number_concurrently
|
45
|
+
@results = Concurrent::Array.new(phone_numbers.length)
|
46
|
+
|
47
|
+
pool = Concurrent::FixedThreadPool.new(concurrency)
|
48
|
+
|
49
|
+
@phone_numbers.each_with_index do |phone_number, index_of_phone_number|
|
50
|
+
# Start a new thread for each task
|
51
|
+
pool.post do
|
52
|
+
@results[index_of_phone_number] = verify_phone_number(phone_number)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
## Shutdown the pool and wait for all tasks to complete
|
57
|
+
pool.shutdown
|
58
|
+
pool.wait_for_termination
|
59
|
+
end
|
60
|
+
|
61
|
+
# Verifies a single phone number, and writes the result into @results
|
62
|
+
def verify_phone_number(phone_number)
|
63
|
+
return if phone_number.empty?
|
64
|
+
|
65
|
+
AddressFinder::V1::Phone::Verification.new(phone_number: phone_number, default_country_code: default_country_code, http: http.clone, **args).perform.result
|
66
|
+
rescue AddressFinder::RequestRejectedError => e
|
67
|
+
OpenStruct.new(success: false, body: e.body, status: e.status)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
data/lib/addressfinder.rb
CHANGED
@@ -16,6 +16,7 @@ require "addressfinder/bulk"
|
|
16
16
|
require "addressfinder/v1/email/verification"
|
17
17
|
require "addressfinder/v1/email/batch_verification"
|
18
18
|
require "addressfinder/v1/phone/verification"
|
19
|
+
require "addressfinder/v1/phone/batch_verification"
|
19
20
|
require "addressfinder/errors"
|
20
21
|
require "addressfinder/util"
|
21
22
|
require "addressfinder/http"
|
@@ -96,6 +97,10 @@ module AddressFinder
|
|
96
97
|
AddressFinder::V1::Phone::Verification.new(**args.merge(http: AddressFinder::HTTP.new(configuration))).perform.result
|
97
98
|
end
|
98
99
|
|
100
|
+
def phone_verification_batch(args = {})
|
101
|
+
AddressFinder::V1::Phone::BatchVerification.new(**args.merge(http: AddressFinder::HTTP.new(configuration))).perform.results
|
102
|
+
end
|
103
|
+
|
99
104
|
def bulk(&block)
|
100
105
|
AddressFinder::Bulk.new(
|
101
106
|
http: AddressFinder::HTTP.new(configuration), verification_version: configuration.verification_version, default_country: configuration.default_country, &block
|
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.
|
4
|
+
version: 1.16.0
|
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: 2025-
|
15
|
+
date: 2025-09-01 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: multi_json
|
@@ -118,14 +118,14 @@ dependencies:
|
|
118
118
|
requirements:
|
119
119
|
- - "~>"
|
120
120
|
- !ruby/object:Gem::Version
|
121
|
-
version: '
|
121
|
+
version: '3.25'
|
122
122
|
type: :development
|
123
123
|
prerelease: false
|
124
124
|
version_requirements: !ruby/object:Gem::Requirement
|
125
125
|
requirements:
|
126
126
|
- - "~>"
|
127
127
|
- !ruby/object:Gem::Version
|
128
|
-
version: '
|
128
|
+
version: '3.25'
|
129
129
|
- !ruby/object:Gem::Dependency
|
130
130
|
name: debug
|
131
131
|
requirement: !ruby/object:Gem::Requirement
|
@@ -185,6 +185,7 @@ files:
|
|
185
185
|
- lib/addressfinder/v1/email/batch_verification.rb
|
186
186
|
- lib/addressfinder/v1/email/verification.rb
|
187
187
|
- lib/addressfinder/v1/nz/batch_verification.rb
|
188
|
+
- lib/addressfinder/v1/phone/batch_verification.rb
|
188
189
|
- lib/addressfinder/v1/phone/verification.rb
|
189
190
|
- lib/addressfinder/v2/au/batch_verification.rb
|
190
191
|
- lib/addressfinder/v2/au/verification.rb
|
@@ -209,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
210
|
- !ruby/object:Gem::Version
|
210
211
|
version: '0'
|
211
212
|
requirements: []
|
212
|
-
rubygems_version: 3.
|
213
|
+
rubygems_version: 3.3.27
|
213
214
|
signing_key:
|
214
215
|
specification_version: 4
|
215
216
|
summary: Provides easy access to Addressfinder APIs
|