Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .travis.yml

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Addressfinder 1.15.0 (March 2025) #

* Automatically skip empty strings within Bulk verification

# Addressfinder 1.14.0 (February 2025) #

* Add support for Ruby 3.4
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Addressfinder Ruby Gem

[![Gem Version](https://badge.fury.io/rb/addressfinder.svg)](http://badge.fury.io/rb/addressfinder)
[![Build Status](https://travis-ci.com/github/AddressFinder/addressfinder-ruby.svg)](https://travis-ci.com/github/AddressFinder/addressfinder-ruby)
[![Build Status](https://github.com/addressfinder/addressfinder-ruby/actions/workflows/ruby.yml/badge.svg?branch=master)](https://github.com/addressfinder/addressfinder-ruby/actions/workflows/ruby.yml/badge.svg?branch=master)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️


A client library for accessing the [Addressfinder](https://addressfinder.nz/?utm_source=github&utm_medium=readme&utm_campaign=addressfinder_rubygem&utm_term=AddressFinder) APIs.

Expand Down
11 changes: 6 additions & 5 deletions lib/addressfinder/v1/email/batch_verification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def verify_each_email_concurrently
@emails.each_with_index do |email, index_of_email|
# Start a new thread for each task
pool.post do
verify_email(email, index_of_email)
@results[index_of_email] = verify_email(email)
end
end

Expand All @@ -57,11 +57,12 @@ def verify_each_email_concurrently
end

# Verifies a single email addresses, and writes the result into @results
def verify_email(email, index_of_email)
@results[index_of_email] =
AddressFinder::V1::Email::Verification.new(email: email, http: http.clone, **args).perform.result
def verify_email(email)
return if email.empty?

AddressFinder::V1::Email::Verification.new(email: email, http: http.clone, **args).perform.result
rescue AddressFinder::RequestRejectedError => e
@results[index_of_email] = OpenStruct.new(success: false, body: e.body, status: e.status)
OpenStruct.new(success: false, body: e.body, status: e.status)
end
end
end
Expand Down
11 changes: 6 additions & 5 deletions lib/addressfinder/v1/nz/batch_verification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def verify_each_address_concurrently
addresses.each_with_index do |address, index_of_address|
# Start a new thread for each task
pool.post do
verify_address(address, index_of_address)
@results[index_of_address] = verify_address(address)
end
end

Expand All @@ -58,11 +58,12 @@ def verify_each_address_concurrently
end

# Verifies a single address, and writes the result into @results
def verify_address(address, index_of_address)
@results[index_of_address] =
AddressFinder::Verification.new(q: address, http: http.clone, **args).perform.result
def verify_address(address)
return if address.empty?

AddressFinder::Verification.new(q: address, http: http.clone, **args).perform.result || false
rescue AddressFinder::RequestRejectedError => e
@results[index_of_address] = OpenStruct.new(success: false, body: e.body, status: e.status)
OpenStruct.new(success: false, body: e.body, status: e.status)
end
end
end
Expand Down
11 changes: 6 additions & 5 deletions lib/addressfinder/v2/au/batch_verification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def verify_each_address_concurrently
addresses.each_with_index do |address, index_of_address|
# Start a new thread for each task
pool.post do
verify_address(address, index_of_address)
@results[index_of_address] = verify_address(address)
end
end

Expand All @@ -58,11 +58,12 @@ def verify_each_address_concurrently
end

# Verifies a single address, and writes the result into @results
def verify_address(address, index_of_address)
@results[index_of_address] =
AddressFinder::V2::Au::Verification.new(q: address, http: http.clone, **args).perform.result
def verify_address(address)
return if address.empty?

AddressFinder::V2::Au::Verification.new(q: address, http: http.clone, **args).perform.result || false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both AU and NZ verification classes here will assign result only if the address is matched.
This means there's not way of knowing if an address is verified and has returned no result or if there's simply no address to verify.
Because of how we currently bulk verify addresses, an empty value within the column gets sent to the API, and results in an error within our reporting.

rescue AddressFinder::RequestRejectedError => e
@results[index_of_address] = OpenStruct.new(success: false, body: e.body, status: e.status)
OpenStruct.new(success: false, body: e.body, status: e.status)
end
end
end
Expand Down