From 746f7715534dc8d8ea8b9f3f6295e734d9316459 Mon Sep 17 00:00:00 2001 From: Vincent Prigent Date: Fri, 21 Mar 2025 16:21:11 +1300 Subject: [PATCH 1/4] Delete .travis.yml --- .travis.yml | 6 ------ README.md | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ee76345..0000000 --- a/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: ruby -rvm: - - 2.2.7 - - 2.3.1 - - 2.4.1 - - 2.6.3 \ No newline at end of file diff --git a/README.md b/README.md index 183bb80..4d0b8a0 100644 --- a/README.md +++ b/README.md @@ -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/badge.svg)](https://github.com/AddressFinder/addressfinder-ruby/actions/workflows/ruby/badge.svg) A client library for accessing the [Addressfinder](https://addressfinder.nz/?utm_source=github&utm_medium=readme&utm_campaign=addressfinder_rubygem&utm_term=AddressFinder) APIs. From 64fe056b6b594310d960a08cb644dc4a6633bfe7 Mon Sep 17 00:00:00 2001 From: Vincent Prigent Date: Fri, 21 Mar 2025 16:35:19 +1300 Subject: [PATCH 2/4] Early return when bulk verification value is empty --- lib/addressfinder/v1/email/batch_verification.rb | 11 ++++++----- lib/addressfinder/v1/nz/batch_verification.rb | 11 ++++++----- lib/addressfinder/v2/au/batch_verification.rb | 11 ++++++----- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/lib/addressfinder/v1/email/batch_verification.rb b/lib/addressfinder/v1/email/batch_verification.rb index 943164e..b49f0ff 100644 --- a/lib/addressfinder/v1/email/batch_verification.rb +++ b/lib/addressfinder/v1/email/batch_verification.rb @@ -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 @@ -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 diff --git a/lib/addressfinder/v1/nz/batch_verification.rb b/lib/addressfinder/v1/nz/batch_verification.rb index 7f4a0a5..6d90305 100644 --- a/lib/addressfinder/v1/nz/batch_verification.rb +++ b/lib/addressfinder/v1/nz/batch_verification.rb @@ -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 @@ -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 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 diff --git a/lib/addressfinder/v2/au/batch_verification.rb b/lib/addressfinder/v2/au/batch_verification.rb index aafef25..3d60e8c 100644 --- a/lib/addressfinder/v2/au/batch_verification.rb +++ b/lib/addressfinder/v2/au/batch_verification.rb @@ -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 @@ -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 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 From 9e4619ee2d68cc377fafbb3164da89935ccfdd05 Mon Sep 17 00:00:00 2001 From: Vincent Prigent Date: Fri, 21 Mar 2025 17:06:23 +1300 Subject: [PATCH 3/4] Update changelog and fix build status badge in README - Add Addressfinder 1.15.0 release notes to CHANGELOG - Correct build status badge URL in README --- CHANGELOG.md | 4 ++++ README.md | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18319f1..b418eee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 4d0b8a0..bf44873 100644 --- a/README.md +++ b/README.md @@ -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://github.com/AddressFinder/addressfinder-ruby/actions/workflows/ruby/badge.svg)](https://github.com/AddressFinder/addressfinder-ruby/actions/workflows/ruby/badge.svg) +[![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) A client library for accessing the [Addressfinder](https://addressfinder.nz/?utm_source=github&utm_medium=readme&utm_campaign=addressfinder_rubygem&utm_term=AddressFinder) APIs. From 2ff0b31906a9fa58e00f2694134b795c1a4b7616 Mon Sep 17 00:00:00 2001 From: Vincent Prigent Date: Mon, 24 Mar 2025 12:05:33 +1300 Subject: [PATCH 4/4] Add fallback to false for address verification result which isn't verified --- lib/addressfinder/v1/nz/batch_verification.rb | 2 +- lib/addressfinder/v2/au/batch_verification.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/addressfinder/v1/nz/batch_verification.rb b/lib/addressfinder/v1/nz/batch_verification.rb index 6d90305..9cb3dbb 100644 --- a/lib/addressfinder/v1/nz/batch_verification.rb +++ b/lib/addressfinder/v1/nz/batch_verification.rb @@ -61,7 +61,7 @@ def verify_each_address_concurrently def verify_address(address) return if address.empty? - AddressFinder::Verification.new(q: address, http: http.clone, **args).perform.result + AddressFinder::Verification.new(q: address, http: http.clone, **args).perform.result || false rescue AddressFinder::RequestRejectedError => e OpenStruct.new(success: false, body: e.body, status: e.status) end diff --git a/lib/addressfinder/v2/au/batch_verification.rb b/lib/addressfinder/v2/au/batch_verification.rb index 3d60e8c..a9359ef 100644 --- a/lib/addressfinder/v2/au/batch_verification.rb +++ b/lib/addressfinder/v2/au/batch_verification.rb @@ -61,7 +61,7 @@ def verify_each_address_concurrently def verify_address(address) return if address.empty? - AddressFinder::V2::Au::Verification.new(q: address, http: http.clone, **args).perform.result + AddressFinder::V2::Au::Verification.new(q: address, http: http.clone, **args).perform.result || false rescue AddressFinder::RequestRejectedError => e OpenStruct.new(success: false, body: e.body, status: e.status) end