zerobounce-sdk 1.1.0 → 1.1.1
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/.gitignore +5 -0
- data/Gemfile.lock +3 -1
- data/README.md +100 -7
- data/documentation.md +51 -7
- data/documentation_es.md +50 -6
- data/lib/zerobounce/base_request.rb +2 -2
- data/lib/zerobounce/configuration.rb +2 -0
- data/lib/zerobounce/mock_request.rb +5 -5
- data/lib/zerobounce/request.rb +11 -5
- data/lib/zerobounce/version.rb +1 -1
- data/lib/zerobounce.rb +85 -39
- data/zerobounce.gemspec +1 -0
- metadata +16 -4
- data/output.err +0 -737
- data/output.log +0 -250
data/lib/zerobounce.rb
CHANGED
@@ -11,7 +11,7 @@ require 'zerobounce/configuration'
|
|
11
11
|
|
12
12
|
# Validate an email address with Zerobounce.net
|
13
13
|
module Zerobounce
|
14
|
-
|
14
|
+
|
15
15
|
API_ROOT_URL = 'https://api.zerobounce.net/v2'
|
16
16
|
BULK_API_ROOT_URL = 'https://bulkapi.zerobounce.net/v2'
|
17
17
|
|
@@ -44,7 +44,7 @@ module Zerobounce
|
|
44
44
|
#
|
45
45
|
# @param [String] :email The email address to validate.
|
46
46
|
# @option [String] :ip_address IP address corresponding to the email.
|
47
|
-
#
|
47
|
+
#
|
48
48
|
# @return [Hash]
|
49
49
|
# {
|
50
50
|
# "address": "valid@example.com",
|
@@ -96,16 +96,16 @@ module Zerobounce
|
|
96
96
|
# @param [String] email
|
97
97
|
# @return [Boolean]
|
98
98
|
# def invalid?(email)
|
99
|
-
# # todo:
|
99
|
+
# # todo:
|
100
100
|
# validate(email: email).invalid?
|
101
101
|
# end
|
102
102
|
|
103
|
-
# Get API usage
|
104
|
-
#
|
103
|
+
# Get API usage
|
104
|
+
#
|
105
105
|
# @param [Date] start_date
|
106
106
|
# @param [Date] end_date
|
107
|
-
#
|
108
|
-
# @return [Hash]
|
107
|
+
#
|
108
|
+
# @return [Hash]
|
109
109
|
# {
|
110
110
|
# "total": 5,
|
111
111
|
# "status_valid": 4,
|
@@ -156,8 +156,8 @@ module Zerobounce
|
|
156
156
|
# Get Activty for email
|
157
157
|
#
|
158
158
|
# @param [String] :email Email to get activity for
|
159
|
-
#
|
160
|
-
# @return [Hash]
|
159
|
+
#
|
160
|
+
# @return [Hash]
|
161
161
|
# {
|
162
162
|
# "found": true,
|
163
163
|
# "active_in_days": "180"
|
@@ -168,10 +168,10 @@ module Zerobounce
|
|
168
168
|
end
|
169
169
|
|
170
170
|
# Validate email batch
|
171
|
-
#
|
171
|
+
#
|
172
172
|
# @param [Array] :emails List of email addresses to validate.
|
173
173
|
# @option [Array] :ip_addresses Corresponding list of IP addresses.
|
174
|
-
#
|
174
|
+
#
|
175
175
|
# @return [Array] list of validate result for each element
|
176
176
|
# [
|
177
177
|
# {
|
@@ -220,7 +220,7 @@ module Zerobounce
|
|
220
220
|
end
|
221
221
|
|
222
222
|
# Validate CSV file
|
223
|
-
#
|
223
|
+
#
|
224
224
|
# @param [String] :filepath Path to the file to be uploaded
|
225
225
|
# @option [Int] :email_address_column Specify which column the email address is on
|
226
226
|
# @option [Int] :first_name_column Specify which column the first name is on
|
@@ -228,7 +228,7 @@ module Zerobounce
|
|
228
228
|
# @option [Int] :gender_column Specify which column the gender is on
|
229
229
|
# @option [Int] :has_header_row Specify whether the file includes a header row or not
|
230
230
|
# @option [Int] :return_url Specify a callback URL (if nil, no callback will be performed)
|
231
|
-
#
|
231
|
+
#
|
232
232
|
# @return [Hash]
|
233
233
|
# {
|
234
234
|
# "success": true,
|
@@ -247,19 +247,19 @@ module Zerobounce
|
|
247
247
|
)
|
248
248
|
params = {
|
249
249
|
email_address_column: email_address_column,
|
250
|
-
first_name_column: first_name_column,
|
251
|
-
last_name_column: last_name_column,
|
252
|
-
gender_column: gender_column,
|
253
250
|
has_header_row: has_header_row,
|
254
251
|
}
|
252
|
+
params[:first_name_column] = first_name_column if first_name_column
|
253
|
+
params[:last_name_column] = last_name_column if last_name_column
|
254
|
+
params[:gender_column] = gender_column if gender_column
|
255
255
|
params[:return_url] = return_url if return_url
|
256
256
|
@@request.bulk_post('sendfile', params, 'multipart/form-data', filepath)
|
257
257
|
end
|
258
258
|
|
259
259
|
# Get validate file status
|
260
|
-
#
|
260
|
+
#
|
261
261
|
# @param [String] :file_id Id of the file.
|
262
|
-
#
|
262
|
+
#
|
263
263
|
# @return [Hash]
|
264
264
|
# {
|
265
265
|
# "success": true,
|
@@ -270,28 +270,28 @@ module Zerobounce
|
|
270
270
|
# "complete_percentage": "100%",
|
271
271
|
# "error_reason": null,
|
272
272
|
# "return_url": null
|
273
|
-
# }
|
273
|
+
# }
|
274
274
|
def validate_file_check(file_id)
|
275
275
|
# todo:
|
276
276
|
params = {file_id: file_id}
|
277
277
|
@@request.bulk_get('filestatus', params)
|
278
278
|
end
|
279
279
|
|
280
|
-
# Get validate results file
|
281
|
-
#
|
280
|
+
# Get validate results file
|
281
|
+
#
|
282
282
|
# @param [String] :file_id Id of the file.
|
283
|
-
#
|
284
|
-
# @return [String/File?]
|
283
|
+
#
|
284
|
+
# @return [String/File?]
|
285
285
|
def validate_file_get(file_id)
|
286
286
|
# todo:
|
287
287
|
params = {file_id: file_id}
|
288
288
|
@@request.bulk_get('getfile', params)
|
289
289
|
end
|
290
290
|
|
291
|
-
# Delete validate file
|
292
|
-
#
|
291
|
+
# Delete validate file
|
292
|
+
#
|
293
293
|
# @param file_id Id of the file.
|
294
|
-
#
|
294
|
+
#
|
295
295
|
# @return [Hash]
|
296
296
|
# {
|
297
297
|
# "success": true,
|
@@ -306,12 +306,12 @@ module Zerobounce
|
|
306
306
|
end
|
307
307
|
|
308
308
|
# Score CSV file
|
309
|
-
#
|
309
|
+
#
|
310
310
|
# @param [String] :filepath Path to the file to be uploaded
|
311
311
|
# @option [Int] :email_address_column Specify which column the email address is on
|
312
312
|
# @option [Int] :has_header_row Specify whether the file includes a header row or not
|
313
313
|
# @option [Int] :return_url Specify a callback URL (if nil, no callback will be performed)
|
314
|
-
#
|
314
|
+
#
|
315
315
|
# @return [Hash]
|
316
316
|
# {
|
317
317
|
# "success": true,
|
@@ -333,11 +333,11 @@ module Zerobounce
|
|
333
333
|
@@request.bulk_post('scoring/sendfile', params, 'multipart/form-data', filepath)
|
334
334
|
end
|
335
335
|
|
336
|
-
# Get validate results file
|
337
|
-
#
|
336
|
+
# Get validate results file
|
337
|
+
#
|
338
338
|
# @param [String] :file_id Id of the file.
|
339
|
-
#
|
340
|
-
# @return [String/File?]
|
339
|
+
#
|
340
|
+
# @return [String/File?]
|
341
341
|
def scoring_file_get(file_id)
|
342
342
|
# todo:
|
343
343
|
params = {file_id: file_id}
|
@@ -345,9 +345,9 @@ module Zerobounce
|
|
345
345
|
end
|
346
346
|
|
347
347
|
# Get validate file status
|
348
|
-
#
|
348
|
+
#
|
349
349
|
# @param [String] :file_id Id of the file.
|
350
|
-
#
|
350
|
+
#
|
351
351
|
# @return [Hash]
|
352
352
|
# {
|
353
353
|
# "success": true,
|
@@ -357,16 +357,16 @@ module Zerobounce
|
|
357
357
|
# "file_status": "Complete",
|
358
358
|
# "complete_percentage": "100% Complete.",
|
359
359
|
# "return_url": null
|
360
|
-
# }
|
360
|
+
# }
|
361
361
|
def scoring_file_check(file_id)
|
362
362
|
params = {file_id: file_id}
|
363
363
|
@@request.bulk_get('scoring/filestatus', params)
|
364
364
|
end
|
365
365
|
|
366
|
-
# Delete validate file
|
367
|
-
#
|
366
|
+
# Delete validate file
|
367
|
+
#
|
368
368
|
# @param file_id Id of the file.
|
369
|
-
#
|
369
|
+
#
|
370
370
|
# @return [Hash]
|
371
371
|
# {
|
372
372
|
# "success": true,
|
@@ -379,7 +379,53 @@ module Zerobounce
|
|
379
379
|
@@request.bulk_get('scoring/deletefile', params)
|
380
380
|
end
|
381
381
|
|
382
|
-
|
382
|
+
# Guess email formatDomain to guess format for
|
383
|
+
#
|
384
|
+
# @param [String] domain Domain to guess format for
|
385
|
+
#
|
386
|
+
# @option [String] first_name First name of target.
|
387
|
+
# @option [String] middle_name Middle name of target.
|
388
|
+
# @option [String] last_name Last name of target.
|
389
|
+
#
|
390
|
+
# @return [Hash]
|
391
|
+
# {
|
392
|
+
# "email"=>"",
|
393
|
+
# "domain"=>"zerobounce.net",
|
394
|
+
# "format"=>"first.last",
|
395
|
+
# "status"=>"",
|
396
|
+
# "sub_status"=>"",
|
397
|
+
# "confidence"=>"high",
|
398
|
+
# "did_you_mean"=>"",
|
399
|
+
# "failure_reason"=>"",
|
400
|
+
# "other_domain_formats"=> [
|
401
|
+
# {"format"=>"first", "confidence"=>"high"},
|
402
|
+
# {"format"=>"last.first", "confidence"=>"high"},
|
403
|
+
# {"format"=>"lfirst", "confidence"=>"high"},
|
404
|
+
# {"format"=>"lastfirst", "confidence"=>"high"},
|
405
|
+
# {"format"=>"firstl", "confidence"=>"high"},
|
406
|
+
# {"format"=>"last", "confidence"=>"medium"},
|
407
|
+
# {"format"=>"first.middle.last", "confidence"=>"medium"},
|
408
|
+
# {"format"=>"first-last", "confidence"=>"medium"},
|
409
|
+
# {"format"=>"l.first", "confidence"=>"medium"},
|
410
|
+
# {"format"=>"f.last", "confidence"=>"medium"},
|
411
|
+
# {"format"=>"f-last", "confidence"=>"medium"},
|
412
|
+
# {"format"=>"first.l", "confidence"=>"medium"},
|
413
|
+
# {"format"=>"first-l", "confidence"=>"medium"},
|
414
|
+
# {"format"=>"firstlast", "confidence"=>"medium"},
|
415
|
+
# {"format"=>"first_l", "confidence"=>"medium"},
|
416
|
+
# {"format"=>"f_last", "confidence"=>"medium"},
|
417
|
+
# {"format"=>"last.f", "confidence"=>"medium"},
|
418
|
+
# {"format"=>"last-f", "confidence"=>"medium"},
|
419
|
+
# {"format"=>"last-first", "confidence"=>"medium"},
|
420
|
+
# {"format"=>"first_last", "confidence"=>"medium"},
|
421
|
+
# {"format"=>"last_f", "confidence"=>"medium"},
|
422
|
+
# {"format"=>"last_first", "confidence"=>"medium"},
|
423
|
+
# {"format"=>"flast", "confidence"=>"medium"},
|
424
|
+
# {"format"=>"lastf", "confidence"=>"medium"},
|
425
|
+
# {"format"=>"l-first", "confidence"=>"low"},
|
426
|
+
# {"format"=>"l_first", "confidence"=>"low"}
|
427
|
+
# ]
|
428
|
+
# }
|
383
429
|
def guessformat(domain, first_name: '', middle_name: '', last_name: '')
|
384
430
|
params = {
|
385
431
|
domain: domain
|
data/zerobounce.gemspec
CHANGED
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
|
|
27
27
|
spec.required_ruby_version = '>= 2.5'
|
28
28
|
|
29
29
|
spec.add_dependency 'rest-client', '~>2.1'
|
30
|
+
spec.add_dependency 'dotenv', '~> 2.8.1'
|
30
31
|
|
31
32
|
spec.add_development_dependency 'bundler', '~> 2.4.6'
|
32
33
|
spec.add_development_dependency 'pry', '~> 0.14.1'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zerobounce-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zero Bounce
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: dotenv
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.8.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.8.1
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -250,8 +264,6 @@ files:
|
|
250
264
|
- lib/zerobounce/mock_request.rb
|
251
265
|
- lib/zerobounce/request.rb
|
252
266
|
- lib/zerobounce/version.rb
|
253
|
-
- output.err
|
254
|
-
- output.log
|
255
267
|
- zerobounce.gemspec
|
256
268
|
homepage: https://zerobounce.net
|
257
269
|
licenses:
|