addressfinder 1.10.1 → 1.11.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
  SHA256:
3
- metadata.gz: 85227fdfa94c38218cb23aa0f2d637270f5fba6f1e3101c1303404de467e4c72
4
- data.tar.gz: 44987ff360e797b67691494785388fcdd51c12f08cbc925eb445ac3251a20102
3
+ metadata.gz: 46f5a02e06b4bdc77c39d7b925ac71f901572519461ce39f9d60a89ce7e1643c
4
+ data.tar.gz: 72415086c4e0e7b200f12727616b68a9604b559318759e98d3b431f71ca5407a
5
5
  SHA512:
6
- metadata.gz: 132e29b1da5bad8864aa136edfbb37cae2925610a767465cd3c027b70ec61492b9c55ed884e628b85fa87191d86c128153ba5f7476c8728ac09e866e131d7fc9
7
- data.tar.gz: 6b64c5fd1de404b594e3e077b62bb3104e0aa9cf17e2f50a6ae2c688e449ce5dfd7cf214f677d8add6e32477d4dc562ab8cbc2a49031b9b37310aa3bdf1acfaf
6
+ metadata.gz: 6936156c02c1ed2996aabd83da48d5ac3952fb4ad65c06a4403be957139f9b2dc87146cc9e685b2669c91bba4f96f7dd7b0a7611d481a3628455602d7c1b97ce
7
+ data.tar.gz: 46540a8561ef184f0a8b092123166a078ccde5875b30f8688df7f5c98f2c45c5c72bbbf43a59913d59bcf1c946b6d66bc5bcdb141ae941825d7068290a847d35
data/CHANGELOG.md CHANGED
@@ -1,89 +1,94 @@
1
- # AddressFinder 1.10.0 (August 2023) #
1
+ # Addressfinder 1.11.0 (May 2024) #
2
+
3
+ * Add a batch capability with concurrency for Email Verification
4
+ * Increase minimum version of Ruby to version 2.7
5
+
6
+ # Addressfinder 1.10.0 (August 2023) #
2
7
 
3
8
  * Add support for Email Verification
4
9
  * Add support for Phone Verification
5
10
  * Add support for Bulk Email Verification
6
11
  * Add support for Bulk Phone Verification
7
12
 
8
- # AddressFinder 1.9.1 (October 2022) #
13
+ # Addressfinder 1.9.1 (October 2022) #
9
14
 
10
15
  * Add missing kwarg `**` for ruby 3
11
16
 
12
- # AddressFinder 1.9.0 (July 2022) #
17
+ # Addressfinder 1.9.0 (July 2022) #
13
18
 
14
19
  * Add support for Ruby 3.x
15
20
  * Update gem dependencies
16
21
 
17
- # AddressFinder 1.8.1 (October 2021) #
22
+ # Addressfinder 1.8.1 (October 2021) #
18
23
 
19
24
  * Prevent NZ bulk and verification calls from using V2 module
20
25
 
21
- # AddressFinder 1.8.0 (October 2021) #
26
+ # Addressfinder 1.8.0 (October 2021) #
22
27
 
23
28
  * Create a V2 Module for verification (Australia)
24
29
  * Remove PAF support from V1 verification API (Australia)
25
30
  * Include API version number in configuration
26
31
 
27
- # AddressFinder 1.7.1 (June 2, 2021) #
32
+ # Addressfinder 1.7.1 (June 2, 2021) #
28
33
 
29
34
  * Add support for PAF verification
30
35
  * Rename cleanse to verification
31
36
 
32
- # AddressFinder 1.7.0 (May 4, 2020) #
37
+ # Addressfinder 1.7.0 (May 4, 2020) #
33
38
 
34
39
  * Add support for Address Autocomplete API (Australia only)
35
40
 
36
- # AddressFinder 1.6.2 (September 23, 2019) #
41
+ # Addressfinder 1.6.2 (September 23, 2019) #
37
42
 
38
43
  * Add support for an optional state_codes parameter in the Cleanse class
39
44
 
40
- # AddressFinder 1.6.1 (January 14, 2019) #
45
+ # Addressfinder 1.6.1 (January 14, 2019) #
41
46
 
42
47
  * Add support for an optional census parameter in the Cleanse class
43
48
 
44
- # AddressFinder 1.6.0 (August 10, 2017) #
49
+ # Addressfinder 1.6.0 (August 10, 2017) #
45
50
 
46
51
  * Add support for a configurable number of request retries
47
52
 
48
- # AddressFinder 1.5.2 (December 21, 2015) #
53
+ # Addressfinder 1.5.2 (December 21, 2015) #
49
54
 
50
55
  * Update for the nested response format used in Address Cleanse Australia
51
56
  * Add an encoding helper which uses CGI::escape
52
57
 
53
- # AddressFinder 1.5.1 (November 25, 2015) #
58
+ # Addressfinder 1.5.1 (November 25, 2015) #
54
59
 
55
60
  * Update the ClientProxy #cleanse method to return result instead of an AddressFinder::Cleanse instance
56
61
 
57
- # AddressFinder 1.5.0 (November 24, 2015) #
62
+ # Addressfinder 1.5.0 (November 24, 2015) #
58
63
 
59
64
  * Add support for supplying `key` and `secret` override values in each API call
60
65
 
61
- # AddressFinder 1.4.0 (October 19, 2015) #
66
+ # Addressfinder 1.4.0 (October 19, 2015) #
62
67
 
63
68
  * Add support for Address Search API
64
69
  * Add support for Address Info API
65
70
 
66
- # AddressFinder 1.3.0 (October 16, 2015) #
71
+ # Addressfinder 1.3.0 (October 16, 2015) #
67
72
 
68
73
  * Add optional domain parameter to configuration and API calls
69
74
 
70
- # AddressFinder 1.2.0 (October 1, 2015) #
75
+ # Addressfinder 1.2.0 (October 1, 2015) #
71
76
 
72
77
  * Add support for Location Search API
73
78
  * Add support for Location Info API
74
79
 
75
- # AddressFinder 1.1.2 (September 23, 2015) #
80
+ # Addressfinder 1.1.2 (September 23, 2015) #
76
81
 
77
82
  * Minor bugfixes
78
83
 
79
- # AddressFinder 1.1.1 (September 14, 2015) #
84
+ # Addressfinder 1.1.1 (September 14, 2015) #
80
85
 
81
86
  * Minor bugfixes
82
87
 
83
- # AddressFinder 1.1.0 (September 11, 2015) #
88
+ # Addressfinder 1.1.0 (September 11, 2015) #
84
89
 
85
90
  * Support for bulk operations
86
91
 
87
- # AddressFinder 1.0.0 (September 10, 2015) #
92
+ # Addressfinder 1.0.0 (September 10, 2015) #
88
93
 
89
94
  * Support for address cleansing API
data/LICENSE.md CHANGED
@@ -1,13 +1,13 @@
1
- Copyright (c) 2015-present AddressFinder
1
+ Copyright (c) 2015-present Addressfinder
2
2
 
3
- The intellectual property rights in this plugin are owned by AddressFinder Limited of Wellington New Zealand (referred to below as “we”, “us” or “our”) or its third party licensors. The plugin may be accessed and used by AddressFinder customers only, subject to the following terms. If you are not, or are no longer, an AddressFinder customer you are not permitted to access or use the plugin in any way.
3
+ The intellectual property rights in this plugin are owned by Addressfinder Limited of Wellington New Zealand (referred to below as “we”, “us” or “our”) or its third party licensors. The plugin may be accessed and used by Addressfinder customers only, subject to the following terms. If you are not, or are no longer, an Addressfinder customer you are not permitted to access or use the plugin in any way.
4
4
 
5
- If you are an AddressFinder customer (referred to below as “you” or “your”), the following terms apply in relation to your access and use of the plugin (and your access or use of the plugin confirms your acceptance of the following terms). If you do not accept the following terms you are not permitted to access or use the plugin in any way.
5
+ If you are an Addressfinder customer (referred to below as “you” or “your”), the following terms apply in relation to your access and use of the plugin (and your access or use of the plugin confirms your acceptance of the following terms). If you do not accept the following terms you are not permitted to access or use the plugin in any way.
6
6
  * In these terms, “Terms and Conditions” means the applicable Terms and Conditions that you entered into, being either https://addressfinder.nz/legal/terms/ or https://addressfinder.com.au/legal/terms/, and “Services” and “Subscription Term” have the meaning given in the Terms and Conditions.
7
7
  * All rights, title and interest (including, without limitation, all intellectual property rights) in and to the plugin are owned by us or our third party licensors. Provided that you comply with these terms, and the Terms and Conditions, we grant you the right during your Subscription Term to: (a) access and use the plugin solely in connection with the Services and then only in combination with websites that you own or control; and (b) view the source code and configurations of the plugin solely for the purpose of evaluating the plugin in relation to its use in connection with the Services, and for no other purpose. This right is non-exclusive, non-transferable and may be revoked by us at any time. You are not granted any other rights or licences in relation to the plugin.
8
8
  * You must never copy, modify, publish, merge, distribute, resell, lease, transfer or sub-license, or create derivative works from, all or any part of the plugin. You must never access or use the plugin for any purpose related to building a product or service which competes with the Services or the plugin or has similar features or functionality. You must comply with all instructions or restrictions that we provide to you in relation to the plugin (including, without limitation, that we may post on this page from time to time).
9
9
  * The plugin is provided to you on an "as is" and "as available" basis and your use of it is at your sole risk. To the maximum extent permitted by law, we do not represent or warrant that the plugin will be secure, reliable, uninterrupted, always available, free of errors, omissions, inaccuracies, viruses or other destructive code, or that it will be fit for your purposes or for use in any specific technical environment or that any problems can or will be corrected. To the maximum extent permitted by law, we give no warranties in relation to the plugin. To avoid doubt, to the maximum extent permitted by law, we disclaim and exclude all implied representations, warranties and conditions (including any warranties of fitness for purpose, merchantability, title and non-infringement). Certain legislation may imply warranties or conditions, impose obligations or give statutory guarantees (together, Statutory Provisions) which cannot be excluded, restricted or modified except to a limited extent. These terms must be read subject to applicable Statutory Provisions. If the Statutory Provisions apply, notwithstanding any other provision of these terms, to the extent to which we are entitled to do so, we limit our liability in respect of any claim to: (a) in the case of goods, at our option: the replacement of the goods or the supply of equivalent goods; the repair of the goods; the payment of the cost of replacing the goods or acquiring equivalent goods; or the payment of having the goods repaired; and (b) in the case of services, at our option: the supply of the services again; or the payment of the cost of having the services supplied again. If you entered into our New Zealand Terms and Conditions, you represent to us that you are acquiring the right to use the plugin for the purposes of a business and so you agree that the provisions of the Consumer Guarantees Act 1993 do not apply to the plugin.
10
- * To the maximum extent permitted by law, we and Our Related Parties will not be liable to you or any third party for any loss or damage to data, breach of security, loss of profit, revenue, opportunity or saving, or any incidental, indirect, special or consequential loss or damage. To the maximum extent permitted by law, the total aggregate liability of us and Our Related Parties (together) to you under or in connection with these terms or its subject matter is limited to NZ$10. These limitations and exclusions of liability apply however liability arises, whether in contract, in tort (including negligence), for breach of statutory duty or otherwise. You fully indemnify us from and against any claim, proceeding, damage, loss, liability, cost or expense (including legal costs on a solicitor and own client basis) arising from or connected to your use of plugin or breach of these terms. In these terms “Our Related Parties” means AddressFinder Pty Limited, ACN 606 672 333, any related company of us or AddressFinder Pty Limited (where “related company” has the meaning given in section 2(3) of the Companies Act 1993, and includes any company or similar entity which would be a related company within that definition if incorporated as a company in New Zealand) and our suppliers, contractors, directors, employees and agents.
10
+ * To the maximum extent permitted by law, we and Our Related Parties will not be liable to you or any third party for any loss or damage to data, breach of security, loss of profit, revenue, opportunity or saving, or any incidental, indirect, special or consequential loss or damage. To the maximum extent permitted by law, the total aggregate liability of us and Our Related Parties (together) to you under or in connection with these terms or its subject matter is limited to NZ$10. These limitations and exclusions of liability apply however liability arises, whether in contract, in tort (including negligence), for breach of statutory duty or otherwise. You fully indemnify us from and against any claim, proceeding, damage, loss, liability, cost or expense (including legal costs on a solicitor and own client basis) arising from or connected to your use of plugin or breach of these terms. In these terms “Our Related Parties” means Addressfinder Pty Limited, ACN 606 672 333, any related company of us or Addressfinder Pty Limited (where “related company” has the meaning given in section 2(3) of the Companies Act 1993, and includes any company or similar entity which would be a related company within that definition if incorporated as a company in New Zealand) and our suppliers, contractors, directors, employees and agents.
11
11
  * We may change these terms at any time by emailing you, by updating the Terms and Conditions and/or by displaying or referring to the replacement terms on this page. Your continued use of the plugin after you receive notice of any such changes will amount to your acceptance of those changes. If you don’t accept those changes you must immediately stop using the plugin.
12
12
  * Any waiver of any part of these terms must be in writing and signed by one of our authorised representatives. Any delay or failure by us to exercise any right does not prevent us from exercising that right, or any other right, on that or any other occasion.
13
13
  * Any unlawful or unenforceable provision of these terms will be deemed to be amended to the minimum extent necessary to ensure that it is not unlawful or unenforceable and, as far as is possible, to ensure that it is consistent with the intent and effect of the provision. The remaining provisions will be enforceable as if such unlawful or unenforceable provision had not been included in these terms. If the provision is unable to be amended without materially altering the intent and effect of the provision, it will be severed, and the remaining provisions will be enforceable.
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # AddressFinder Ruby Gem
1
+ # Addressfinder Ruby Gem
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/addressfinder.svg)](http://badge.fury.io/rb/addressfinder)
4
4
  [![Build Status](https://travis-ci.com/github/AddressFinder/addressfinder-ruby.svg)](https://travis-ci.com/github/AddressFinder/addressfinder-ruby)
5
5
 
6
- A client library for accessing the [AddressFinder](https://addressfinder.nz/?utm_source=github&utm_medium=readme&utm_campaign=addressfinder_rubygem&utm_term=AddressFinder) APIs.
6
+ A client library for accessing the [Addressfinder](https://addressfinder.nz/?utm_source=github&utm_medium=readme&utm_campaign=addressfinder_rubygem&utm_term=AddressFinder) APIs.
7
7
 
8
8
  ## Installation
9
9
 
@@ -44,7 +44,7 @@ end
44
44
  ```
45
45
 
46
46
  **_Don't know your key and secret?_**
47
- *Login to the [AddressFinder portal](https://portal.addressfinder.io/?utm_source=github&utm_medium=readme&utm_campaign=addressfinder_rubygem&utm_term=AddressFinder%20Portal) to obtain your key and secret.*
47
+ *Login to the [Addressfinder portal](https://portal.addressfinder.io/?utm_source=github&utm_medium=readme&utm_campaign=addressfinder_rubygem&utm_term=AddressFinder%20Portal) to obtain your key and secret.*
48
48
 
49
49
  **_For Ruby on Rails:_**
50
50
  *The configure block is best placed in an initializer file (`./config/initializers/addressfinder.rb`).*
@@ -158,9 +158,12 @@ end
158
158
  ```
159
159
 
160
160
  #### Email Verification
161
+
162
+ This example shows how to request verification of a single email address.
163
+
161
164
  ```ruby
162
165
  begin
163
- result = AddressFinder.email_verification(email: 'john.doe')
166
+ result = AddressFinder.email_verification(email: 'john.doe', features: "domain,connection")
164
167
  $stdout.puts "This email address is verified: #{result.is_verified}"
165
168
  rescue AddressFinder::RequestRejectedError => e
166
169
  response = JSON.parse(e.body)
@@ -168,7 +171,28 @@ rescue AddressFinder::RequestRejectedError => e
168
171
  end
169
172
  ```
170
173
 
174
+ This example shows how to request verification of several email addresses:
175
+
176
+ ```ruby
177
+ emails = [
178
+ "bert@myemail.com",
179
+ "charlish@myemail.com",
180
+ "support@addressfinder.com",
181
+ "bad-email-address"
182
+ ]
183
+
184
+ results = AddressFinder.email_verification_batch(emails: emails, concurrency: 2, features: "provider,domain,connection")
185
+
186
+ results.each_with_index do |result, index|
187
+ puts "Email: #{emails[index]} - #{result.is_verified ? "Verified" : "Unverified"}"
188
+ end
189
+ ```
190
+
191
+ The emails will be verified concurrently, and returned in the same order in
192
+ which they were provided.
193
+
171
194
  #### Phone Verification
195
+
172
196
  ```ruby
173
197
  begin
174
198
  result = AddressFinder.phone_verification(phone_number: '1800 152 363', default_country_code: 'AU')
@@ -6,9 +6,9 @@ Gem::Specification.new do |gem|
6
6
  gem.version = AddressFinder::VERSION
7
7
  gem.licenses = ['MIT']
8
8
  gem.authors = ['Nigel Ramsay', 'Naiki Pohe', 'Sean Arnold', 'Alexandre Barret', 'Cassandre Guinut']
9
- gem.email = ['nigel.ramsay@addressfinder.nz', 'naiki.pohe@abletech.co.nz', 'seanarnie@gmail.com', 'alex@abletech.nz', 'cassandre.guinut@addressfinder.nz']
10
- gem.description = 'Ruby client library for AddressFinder'
11
- gem.summary = 'Provides easy access to AddressFinder APIs'
9
+ gem.email = ['nigel.ramsay@addressfinder.com', 'naiki.pohe@abletech.co.nz', 'seanarnie@gmail.com', 'alex@abletech.nz', 'cassandre.guinut@addressfinder.com']
10
+ gem.description = 'Ruby client library for Addressfinder'
11
+ gem.summary = 'Provides easy access to Addressfinder APIs'
12
12
  gem.homepage = 'https://github.com/AddressFinder/addressfinder-ruby'
13
13
 
14
14
  gem.files = `git ls-files`.split($/).select{|f| f.match(%r{^lib|\.gemspec$|\.md$})}
@@ -16,12 +16,15 @@ Gem::Specification.new do |gem|
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.6'
19
+ gem.required_ruby_version = '>= 2.7'
20
20
  gem.add_dependency 'multi_json', '~> 1.15'
21
+ gem.add_dependency "concurrent-ruby", "~> 1.2"
21
22
 
22
23
  gem.add_development_dependency 'guard-rspec', '~> 4.7'
23
24
  gem.add_development_dependency 'listen', '~> 3.7'
24
25
  gem.add_development_dependency 'rake', '~> 13.0'
25
26
  gem.add_development_dependency 'rspec', '~> 3.11'
26
27
  gem.add_development_dependency 'webmock', '~> 1.21'
28
+ gem.add_development_dependency 'debug', '>= 1.0.0'
29
+ gem.add_development_dependency 'standard', '>= 1.35'
27
30
  end
@@ -1,19 +1,20 @@
1
+ require "cgi"
2
+
1
3
  module AddressFinder
2
4
  class Util
3
-
4
5
  def self.encode(v)
5
- CGI::escape(v.to_s)
6
+ CGI.escape(v.to_s)
6
7
  end
7
8
 
8
9
  def self.encode_and_join_params(params)
9
10
  # URI.encode_www_form(params)
10
- params.map do |k,v|
11
+ params.map do |k, v|
11
12
  if v.is_a? Array
12
- v.collect {|e| "#{k}[]=#{encode(e)}" }
13
+ v.collect { |e| "#{k}[]=#{encode(e)}" }
13
14
  else
14
15
  "#{k}=#{encode(v)}"
15
16
  end
16
- end.join('&')
17
+ end.join("&")
17
18
  end
18
19
  end
19
20
  end
@@ -0,0 +1,69 @@
1
+ module AddressFinder
2
+ module V1
3
+ module Email
4
+ class BatchVerification
5
+ attr_reader :emails, :results
6
+
7
+ # Verifies an array of email addresses 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>] emails
12
+ # @param [AddressFinder::HTTP] http HTTP connection helper
13
+ # @param [Integer] concurrency How many threads to use for verification
14
+ # @param [Hash] args Any additional arguments that will be passed onto the EV API
15
+ def initialize(emails:, http:, concurrency: 5, **args)
16
+ @emails = emails
17
+ @concurrency = concurrency
18
+ @http = http
19
+ @args = args
20
+ end
21
+
22
+ def perform
23
+ confirm_concurrency_level
24
+ verify_each_email_concurrently
25
+
26
+ self
27
+ end
28
+
29
+ private
30
+
31
+ attr_reader :args, :concurrency, :http
32
+
33
+ MAX_CONCURRENCY_LEVEL = 10
34
+
35
+ def confirm_concurrency_level
36
+ return unless @concurrency > MAX_CONCURRENCY_LEVEL
37
+
38
+ warn "WARNING: Concurrency level of #{@concurrency} is higher than the maximum of #{MAX_CONCURRENCY_LEVEL}. Using #{MAX_CONCURRENCY_LEVEL}."
39
+ @concurrency = MAX_CONCURRENCY_LEVEL
40
+ end
41
+
42
+ def verify_each_email_concurrently
43
+ @results = Concurrent::Array.new(emails.length)
44
+
45
+ pool = Concurrent::FixedThreadPool.new(concurrency)
46
+
47
+ @emails.each_with_index do |email, index_of_email|
48
+ # Start a new thread for each task
49
+ pool.post do
50
+ verify_email(email, index_of_email)
51
+ end
52
+ end
53
+
54
+ ## Shutdown the pool and wait for all tasks to complete
55
+ pool.shutdown
56
+ pool.wait_for_termination
57
+ end
58
+
59
+ # Verifies a single email addresses, and writes the result into @results
60
+ def verify_email(email, index_of_email)
61
+ @results[index_of_email] =
62
+ AddressFinder::V1::Email::Verification.new(email: email, http: http.clone, **args).perform.result
63
+ rescue AddressFinder::RequestRejectedError => e
64
+ @results[index_of_email] = OpenStruct.new(success: false, body: e.body, status: e.status)
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -1,11 +1,11 @@
1
- require 'addressfinder/v1/base'
1
+ require "addressfinder/v1/base"
2
2
 
3
3
  module AddressFinder
4
4
  module V1
5
5
  module Email
6
6
  class Verification < AddressFinder::V1::Base
7
7
  attr_reader :result
8
-
8
+
9
9
  def initialize(email:, http:, **args)
10
10
  params = {email: email}.merge(args)
11
11
  super(params: params, path: "/api/email/v1/verification", http: http)
@@ -1,3 +1,3 @@
1
1
  module AddressFinder
2
- VERSION = '1.10.1'
2
+ VERSION = "1.11.0"
3
3
  end
data/lib/addressfinder.rb CHANGED
@@ -1,26 +1,33 @@
1
- require 'multi_json'
2
- require 'addressfinder/version'
3
- require 'addressfinder/configuration'
4
- require 'addressfinder/verification'
5
- require 'addressfinder/v2/au/verification'
6
- require 'addressfinder/location_info'
7
- require 'addressfinder/location_search'
8
- require 'addressfinder/address_info'
9
- require 'addressfinder/address_search'
10
- require 'addressfinder/address_autocomplete'
11
- require 'addressfinder/bulk'
12
- require 'addressfinder/v1/email/verification'
13
- require 'addressfinder/v1/phone/verification'
14
- require 'addressfinder/errors'
15
- require 'addressfinder/util'
16
- require 'addressfinder/http'
1
+ require "multi_json"
2
+ require "concurrent/executor/fixed_thread_pool"
3
+ require "concurrent/array"
4
+ require "addressfinder/version"
5
+ require "addressfinder/configuration"
6
+ require "addressfinder/verification"
7
+ require "addressfinder/v2/au/verification"
8
+ require "addressfinder/location_info"
9
+ require "addressfinder/location_search"
10
+ require "addressfinder/address_info"
11
+ require "addressfinder/address_search"
12
+ require "addressfinder/address_autocomplete"
13
+ require "addressfinder/bulk"
14
+ require "addressfinder/v1/email/verification"
15
+ require "addressfinder/v1/email/batch_verification"
16
+ require "addressfinder/v1/phone/verification"
17
+ require "addressfinder/errors"
18
+ require "addressfinder/util"
19
+ require "addressfinder/http"
17
20
 
18
21
  module AddressFinder
19
22
  class << self
20
- def configure(config_hash=nil)
21
- if config_hash
22
- config_hash.each do |k,v|
23
- configuration.send("#{k}=", v) rescue nil if configuration.respond_to?("#{k}=")
23
+ def configure(config_hash = nil)
24
+ config_hash&.each do |k, v|
25
+ if configuration.respond_to?(:"#{k}=")
26
+ begin
27
+ configuration.send(:"#{k}=", v)
28
+ rescue
29
+ nil
30
+ end
24
31
  end
25
32
  end
26
33
 
@@ -31,43 +38,47 @@ module AddressFinder
31
38
  @configuration ||= AddressFinder::Configuration.new
32
39
  end
33
40
 
34
- def cleanse(args={}) # We are keeping this method for backward compatibility
41
+ def cleanse(args = {}) # We are keeping this method for backward compatibility
35
42
  AddressFinder::Verification.new(**args.merge(http: AddressFinder::HTTP.new(configuration))).perform.result
36
43
  end
37
44
 
38
- def verification(args={})
39
- if (args[:country] || configuration.default_country) == 'au' && configuration.verification_version&.downcase == "v2"
45
+ def verification(args = {})
46
+ if (args[:country] || configuration.default_country) == "au" && configuration.verification_version&.downcase == "v2"
40
47
  AddressFinder::V2::Au::Verification.new(**args.merge(http: AddressFinder::HTTP.new(configuration))).perform.result
41
48
  else
42
49
  AddressFinder::Verification.new(**args.merge(http: AddressFinder::HTTP.new(configuration))).perform.result
43
50
  end
44
51
  end
45
52
 
46
- def location_search(args={})
53
+ def location_search(args = {})
47
54
  AddressFinder::LocationSearch.new(params: args, http: AddressFinder::HTTP.new(configuration)).perform.results
48
55
  end
49
56
 
50
- def location_info(args={})
57
+ def location_info(args = {})
51
58
  AddressFinder::LocationInfo.new(params: args, http: AddressFinder::HTTP.new(configuration)).perform.result
52
59
  end
53
60
 
54
- def address_search(args={})
61
+ def address_search(args = {})
55
62
  AddressFinder::AddressSearch.new(params: args, http: AddressFinder::HTTP.new(configuration)).perform.results
56
63
  end
57
64
 
58
- def address_autocomplete(args={})
65
+ def address_autocomplete(args = {})
59
66
  AddressFinder::AddressAutocomplete.new(params: args, http: AddressFinder::HTTP.new(configuration)).perform.results
60
67
  end
61
68
 
62
- def address_info(args={})
69
+ def address_info(args = {})
63
70
  AddressFinder::AddressInfo.new(params: args, http: AddressFinder::HTTP.new(configuration)).perform.result
64
71
  end
65
72
 
66
- def email_verification(args={})
73
+ def email_verification(args = {})
67
74
  AddressFinder::V1::Email::Verification.new(**args.merge(http: AddressFinder::HTTP.new(configuration))).perform.result
68
75
  end
69
76
 
70
- def phone_verification(args={})
77
+ def email_verification_batch(args = {})
78
+ AddressFinder::V1::Email::BatchVerification.new(**args.merge(http: AddressFinder::HTTP.new(configuration))).perform.results
79
+ end
80
+
81
+ def phone_verification(args = {})
71
82
  AddressFinder::V1::Phone::Verification.new(**args.merge(http: AddressFinder::HTTP.new(configuration))).perform.result
72
83
  end
73
84
 
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.1
4
+ version: 1.11.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: 2023-09-13 00:00:00.000000000 Z
15
+ date: 2024-05-05 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: multi_json
@@ -28,6 +28,20 @@ dependencies:
28
28
  - - "~>"
29
29
  - !ruby/object:Gem::Version
30
30
  version: '1.15'
31
+ - !ruby/object:Gem::Dependency
32
+ name: concurrent-ruby
33
+ requirement: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - "~>"
36
+ - !ruby/object:Gem::Version
37
+ version: '1.2'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - "~>"
43
+ - !ruby/object:Gem::Version
44
+ version: '1.2'
31
45
  - !ruby/object:Gem::Dependency
32
46
  name: guard-rspec
33
47
  requirement: !ruby/object:Gem::Requirement
@@ -98,13 +112,41 @@ dependencies:
98
112
  - - "~>"
99
113
  - !ruby/object:Gem::Version
100
114
  version: '1.21'
101
- description: Ruby client library for AddressFinder
115
+ - !ruby/object:Gem::Dependency
116
+ name: debug
117
+ requirement: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: 1.0.0
122
+ type: :development
123
+ prerelease: false
124
+ version_requirements: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: 1.0.0
129
+ - !ruby/object:Gem::Dependency
130
+ name: standard
131
+ requirement: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '1.35'
136
+ type: :development
137
+ prerelease: false
138
+ version_requirements: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: '1.35'
143
+ description: Ruby client library for Addressfinder
102
144
  email:
103
- - nigel.ramsay@addressfinder.nz
145
+ - nigel.ramsay@addressfinder.com
104
146
  - naiki.pohe@abletech.co.nz
105
147
  - seanarnie@gmail.com
106
148
  - alex@abletech.nz
107
- - cassandre.guinut@addressfinder.nz
149
+ - cassandre.guinut@addressfinder.com
108
150
  executables: []
109
151
  extensions: []
110
152
  extra_rdoc_files: []
@@ -125,6 +167,7 @@ files:
125
167
  - lib/addressfinder/location_search.rb
126
168
  - lib/addressfinder/util.rb
127
169
  - lib/addressfinder/v1/base.rb
170
+ - lib/addressfinder/v1/email/batch_verification.rb
128
171
  - lib/addressfinder/v1/email/verification.rb
129
172
  - lib/addressfinder/v1/phone/verification.rb
130
173
  - lib/addressfinder/v2/au/verification.rb
@@ -142,15 +185,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
142
185
  requirements:
143
186
  - - ">="
144
187
  - !ruby/object:Gem::Version
145
- version: '2.6'
188
+ version: '2.7'
146
189
  required_rubygems_version: !ruby/object:Gem::Requirement
147
190
  requirements:
148
191
  - - ">="
149
192
  - !ruby/object:Gem::Version
150
193
  version: '0'
151
194
  requirements: []
152
- rubygems_version: 3.2.33
195
+ rubygems_version: 3.4.6
153
196
  signing_key:
154
197
  specification_version: 4
155
- summary: Provides easy access to AddressFinder APIs
198
+ summary: Provides easy access to Addressfinder APIs
156
199
  test_files: []