zerobounce-sdk 1.0.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce3b4157b9478ba02c42a325862699aa7679b4270504ac7cc5448f5b7d4538fe
4
- data.tar.gz: f95a6733dc75b74bcf4fcfc341eb84baa4e539ea54eaf70ac38d64fe2aa63655
3
+ metadata.gz: 804ff0380f6e305c6b80ceaec623ed06f014927074ebef93598b9dab3d23c988
4
+ data.tar.gz: 64ff74c48f382f6cb50d29c1d9f6e95d149929289e3971f27c2e1cfcc7088706
5
5
  SHA512:
6
- metadata.gz: 3e0382eb10b8a5aac8edfdd6fedf4c50ab6de72333f5f648f0d9cac64d41af67412cf8dfbd77ba10731f1185b05f2c84b252bb25a2bd98a1827fc55397b77c1a
7
- data.tar.gz: b9213e632058dd88944cb0499d6dfbdbf343138547296644a3843ef7e860d59fc808c7b8429ec3c86df81a971cf1891006c61a7982aeae9ba236789a9dd36b0f
6
+ metadata.gz: 8c4b82770126e3f7f0ef3699688ad11bf526163df669d3a6d637ff87d183955b1876e99e2a9e953eebb5b4102863ab8ff5204417a77d7e47722fe3b14977abcf
7
+ data.tar.gz: a9ebe2bd4422d96e85ffd5331456cb0669090a1ade71f828249b32a44730e843b05ffa24148673b353130b4e896075acf035d59c9963bc83ad60dcb841c56f4f
data/.gitignore CHANGED
@@ -57,3 +57,8 @@ build-iPhoneSimulator/
57
57
 
58
58
  # Used by RSpec
59
59
  .rspec_status
60
+
61
+
62
+ # Log files
63
+ output.err
64
+ output.log
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zerobounce (0.4.0)
4
+ zerobounce-sdk (1.1.1)
5
+ dotenv (~> 2.8.1)
5
6
  rest-client (~> 2.1)
6
7
 
7
8
  GEM
@@ -17,15 +18,16 @@ GEM
17
18
  docile (1.4.0)
18
19
  domain_name (0.5.20190701)
19
20
  unf (>= 0.0.5, < 1.0.0)
21
+ dotenv (2.8.1)
20
22
  hashdiff (1.0.1)
21
23
  http-accept (1.7.0)
22
24
  http-cookie (1.0.5)
23
25
  domain_name (~> 0.5)
24
26
  json (2.6.3)
25
27
  method_source (1.0.0)
26
- mime-types (3.4.1)
28
+ mime-types (3.5.1)
27
29
  mime-types-data (~> 3.2015)
28
- mime-types-data (3.2023.0218.1)
30
+ mime-types-data (3.2023.0808)
29
31
  netrc (0.11.0)
30
32
  parallel (1.22.1)
31
33
  parser (3.2.2.0)
@@ -115,7 +117,7 @@ DEPENDENCIES
115
117
  vcr (~> 6.1.0)
116
118
  webmock (~> 3.18)
117
119
  yard (~> 0.9.26)
118
- zerobounce!
120
+ zerobounce-sdk!
119
121
 
120
122
  BUNDLED WITH
121
123
  2.4.6
data/README.md CHANGED
@@ -30,7 +30,7 @@ Zerobounce.configure do |config|
30
30
  ...
31
31
  end
32
32
  ```
33
- or
33
+ or
34
34
  ```
35
35
  Zerobounce.config.apikey = '<zerobounce-api-key>'
36
36
  ...
@@ -92,7 +92,7 @@ Zerobounce.api_usage(Date.today, Date.today)
92
92
 
93
93
  Validate single eMail
94
94
  ```ruby
95
- Zerobounce.validate('valid@example.com')
95
+ Zerobounce.validate('valid@example.com')
96
96
  # Zerobounce.validate('valid@example.com', '192.168.0.1') # optional IP address
97
97
  =>
98
98
  {"address"=>"valid@example.com",
@@ -126,11 +126,11 @@ emails
126
126
  "toxic@example.com",
127
127
  "donotmail@example.com",
128
128
  "spamtrap@example.com"]
129
-
130
- # ip_addresses
129
+
130
+ # ip_addresses
131
131
  => ["192.168.0.1", "192.168.0.1", "192.168.0.1", "192.168.0.1", "192.168.0.1", "192.168.0.1"]
132
132
  # Zerobounce.validate_batch(emails, ip_addresses) # optional ip_addresses parameter
133
-
133
+
134
134
  Zerobounce.validate_batch(emails)
135
135
  =>
136
136
  [{"address"=>"disposable@example.com",
@@ -263,14 +263,14 @@ Send file
263
263
  "file_name"=>"validation.csv",
264
264
  "file_id"=>"75d854a6-565c-49f9-b4c8-b3344480ec4c"}
265
265
  # file_id will be required for next steps
266
- # optional named parameters:
266
+ # optional named parameters:
267
267
  email_address_column: 1,
268
268
  first_name_column: 2,
269
269
  last_name_column: 3,
270
270
  gender_column: 4,
271
271
  has_header_row: true,
272
272
  return_url: nil # results callback url
273
- # Zerobounce.validate_file_send(validate_file_path, email_address_column: 1, gender_column: 4)
273
+ # Zerobounce.validate_file_send(validate_file_path, email_address_column: 1, gender_column: 4)
274
274
  ```
275
275
 
276
276
  Check file
@@ -361,6 +361,99 @@ Zerobounce.validate_file_delete(file_id)
361
361
  ```
362
362
 
363
363
 
364
+ ### More details on CSV file submission and CSV result retrieval
365
+
366
+ This applies for both 'Email validation' and 'AI Scoring' functionalities.
367
+
368
+ **The data** of the submitted CSV file **will be included** in the result CSV file. Therefore, the first columns of the result CSV file will consist of the submitted data and the following columns will provide information specific to each functionality.
369
+
370
+ #### 'Email validation'
371
+
372
+ The additional columns that would be included in result CSV file:
373
+ * ZB Status
374
+ * ZB Sub Status
375
+ * ZB Account
376
+ * ZB Domain
377
+ * ZB First Name
378
+ * ZB Last Name
379
+ * ZB Gender
380
+ * ZB Free Email
381
+ * ZB MX Found
382
+ * ZB MX Record
383
+ * ZB SMTP Provider
384
+ * ZB Did You Mean
385
+ * ZB City
386
+ * ZB Region/State
387
+ * ZB Zip Code
388
+ * ZB Country
389
+
390
+ When `has_header_row: true` is provided to `validate_file_send()` method, original columns of the submitted file will be retained.
391
+
392
+ When `has_header_row: false`, the columns that were explicitly specified in `validate_file_send()` will be given the following column title:
393
+ ```
394
+ email_address_column => "Email Address"
395
+ first_name_column => "First Name"
396
+ last_name_column => "Last Name"
397
+ gender_column => "Gender"
398
+ ```
399
+
400
+ Any additional that were not (or can not be) specified by parameters, will be given column title "Custom".
401
+
402
+
403
+ #### 'AI Scoring':
404
+ The additional _column_ that would be included in result CSV file:
405
+ * ZeroBounceQualityScore
406
+
407
+ When `has_header_row: true` is provided to `scoring_file_send()` method, original columns of the submitted file will be retained.
408
+
409
+
410
+ When `has_header_row: false` is provided to `scoring_file_send()` method, column title for the email column (as well as the other columns) will be _Email Address_.
411
+
412
+
413
+ ### Email Finder
414
+
415
+ Guess Format
416
+ ```ruby
417
+ Zerobounce.guessformat("zerobounce.net")
418
+ =>
419
+ {"email"=>"",
420
+ "domain"=>"zerobounce.net",
421
+ "format"=>"first.last",
422
+ "status"=>"",
423
+ "sub_status"=>"",
424
+ "confidence"=>"high",
425
+ "did_you_mean"=>"",
426
+ "failure_reason"=>"",
427
+ "other_domain_formats"=>
428
+ [{"format"=>"first", "confidence"=>"high"},
429
+ {"format"=>"last.first", "confidence"=>"high"},
430
+ {"format"=>"lfirst", "confidence"=>"high"},
431
+ {"format"=>"lastfirst", "confidence"=>"high"},
432
+ {"format"=>"firstl", "confidence"=>"high"},
433
+ {"format"=>"last", "confidence"=>"medium"},
434
+ {"format"=>"first.middle.last", "confidence"=>"medium"},
435
+ {"format"=>"first-last", "confidence"=>"medium"},
436
+ {"format"=>"l.first", "confidence"=>"medium"},
437
+ {"format"=>"f.last", "confidence"=>"medium"},
438
+ {"format"=>"f-last", "confidence"=>"medium"},
439
+ {"format"=>"first.l", "confidence"=>"medium"},
440
+ {"format"=>"first-l", "confidence"=>"medium"},
441
+ {"format"=>"firstlast", "confidence"=>"medium"},
442
+ {"format"=>"first_l", "confidence"=>"medium"},
443
+ {"format"=>"f_last", "confidence"=>"medium"},
444
+ {"format"=>"last.f", "confidence"=>"medium"},
445
+ {"format"=>"last-f", "confidence"=>"medium"},
446
+ {"format"=>"last-first", "confidence"=>"medium"},
447
+ {"format"=>"first_last", "confidence"=>"medium"},
448
+ {"format"=>"last_f", "confidence"=>"medium"},
449
+ {"format"=>"last_first", "confidence"=>"medium"},
450
+ {"format"=>"flast", "confidence"=>"medium"},
451
+ {"format"=>"lastf", "confidence"=>"medium"},
452
+ {"format"=>"l-first", "confidence"=>"low"},
453
+ {"format"=>"l_first", "confidence"=>"low"}]}
454
+ # Zerobounce.guessformat("zerobounce.net", first_name: "John", middle_name: 'Deere', last_name: "Doe")
455
+ ```
456
+
364
457
  ## Development
365
458
 
366
459
  After checking out the repo run tests
@@ -1,8 +1,4 @@
1
-
2
- # Zerobounce
3
- Ruby client for Zerobounce.net API. Developed based on [this version](https://github.com/afrase/zerobounce) by Aaron Frase.
4
-
5
- ## Usage
1
+ #### Usage
6
2
  Add this line to your application's Gemfile:
7
3
  ```ruby
8
4
  gem 'zerobounce-sdk'
@@ -30,7 +26,7 @@ Zerobounce.configure do |config|
30
26
  ...
31
27
  end
32
28
  ```
33
- or
29
+ or
34
30
  ```
35
31
  Zerobounce.config.apikey = '<zerobounce-api-key>'
36
32
  ...
@@ -39,7 +35,13 @@ Zerobounce.config.apikey = '<zerobounce-api-key>'
39
35
  Credits
40
36
  ```ruby
41
37
  Zerobounce.credits
42
- => 79 # returns -1 for invalid key
38
+ => 79 ### returns -1 for invalid key
39
+ ```
40
+
41
+ Activity
42
+ ```ruby
43
+ Zerobounce.activity('ss@gmail.com')
44
+ => {"found"=>true, "active_in_days"=>"180"}
43
45
  ```
44
46
 
45
47
  Usage statistics
@@ -82,12 +84,12 @@ Zerobounce.api_usage(Date.today, Date.today)
82
84
  "end_date"=>"4/28/2023"}
83
85
  ```
84
86
 
85
- ### Email Validation
87
+ ##### Email Validation
86
88
 
87
89
  Validate single eMail
88
90
  ```ruby
89
- Zerobounce.validate('valid@example.com')
90
- # Zerobounce.validate('valid@example.com', '192.168.0.1') # optional IP address
91
+ Zerobounce.validate('valid@example.com')
92
+ ### Zerobounce.validate('valid@example.com', '192.168.0.1') # optional IP address
91
93
  =>
92
94
  {"address"=>"valid@example.com",
93
95
  "status"=>"valid",
@@ -120,11 +122,11 @@ emails
120
122
  "toxic@example.com",
121
123
  "donotmail@example.com",
122
124
  "spamtrap@example.com"]
123
-
124
- # ip_addresses
125
+
126
+ ### ip_addresses
125
127
  => ["192.168.0.1", "192.168.0.1", "192.168.0.1", "192.168.0.1", "192.168.0.1", "192.168.0.1"]
126
- # Zerobounce.validate_batch(emails, ip_addresses) # optional ip_addresses parameter
127
-
128
+ ### Zerobounce.validate_batch(emails, ip_addresses) # optional ip_addresses parameter
129
+
128
130
  Zerobounce.validate_batch(emails)
129
131
  =>
130
132
  [{"address"=>"disposable@example.com",
@@ -243,11 +245,11 @@ Zerobounce.validate_batch(emails)
243
245
  "processed_at"=>"2023-04-28 15:21:44.340"}]
244
246
  ```
245
247
 
246
- #### Batch File Validation
248
+ ###### Batch File Validation
247
249
 
248
250
  Send file
249
251
  ```ruby
250
- # sample file can be found in the files folder of this repository
252
+ ### sample file can be found in the files folder of this repository
251
253
  validate_file_path = File.join(Dir.pwd, 'files', 'validation.csv')
252
254
  => "/home/zb/wrappers/ruby-test/files/validation.csv"
253
255
  Zerobounce.validate_file_send(validate_file_path)
@@ -256,15 +258,15 @@ Send file
256
258
  "message"=>"File Accepted",
257
259
  "file_name"=>"validation.csv",
258
260
  "file_id"=>"75d854a6-565c-49f9-b4c8-b3344480ec4c"}
259
- # file_id will be required for next steps
260
- # optional named parameters:
261
+ ### file_id will be required for next steps
262
+ ### optional named parameters:
261
263
  email_address_column: 1,
262
264
  first_name_column: 2,
263
265
  last_name_column: 3,
264
266
  gender_column: 4,
265
267
  has_header_row: true,
266
- return_url: nil # results callback url
267
- # Zerobounce.validate_file_send(validate_file_path, email_address_column: 1, gender_column: 4)
268
+ return_url: nil ### results callback url
269
+ ### Zerobounce.validate_file_send(validate_file_path, email_address_column: 1, gender_column: 4)
268
270
  ```
269
271
 
270
272
  Check file
@@ -303,7 +305,7 @@ Zerobounce.validate_file_delete(file_id)
303
305
  "file_id"=>"75d854a6-565c-49f9-b4c8-b3344480ec4c"}
304
306
  ```
305
307
 
306
- ### AI Scoring
308
+ ##### AI Scoring
307
309
 
308
310
  Send file
309
311
  ```ruby
@@ -315,12 +317,12 @@ Zerobounce.scoring_file_send(scoring_file_path)
315
317
  "message"=>"File Accepted",
316
318
  "file_name"=>"scoring.csv",
317
319
  "file_id"=>"89fb7262-b845-4fa1-aa25-e486347ec64e"}
318
- # file_id will be required for the next steps
319
- # optional named parameters
320
+ ### file_id will be required for the next steps
321
+ ### optional named parameters
320
322
  email_address_column: 1,
321
323
  has_header_row: true,
322
- return_url: nil # results callback url
323
- # Zerobounce.scoring_file_send(scoring_file_path, email_address_column: 1)
324
+ return_url: nil ### results callback url
325
+ ### Zerobounce.scoring_file_send(scoring_file_path, email_address_column: 1)
324
326
  ```
325
327
 
326
328
  File check
@@ -354,12 +356,56 @@ Zerobounce.validate_file_delete(file_id)
354
356
  => {"success"=>false, "message"=>"File cannot be found."}
355
357
  ```
356
358
 
359
+ ##### Email Finder
360
+
361
+ Guess Format
362
+ ```ruby
363
+ Zerobounce.guessformat("zerobounce.net")
364
+ =>
365
+ {"email"=>"",
366
+ "domain"=>"zerobounce.net",
367
+ "format"=>"first.last",
368
+ "status"=>"",
369
+ "sub_status"=>"",
370
+ "confidence"=>"high",
371
+ "did_you_mean"=>"",
372
+ "failure_reason"=>"",
373
+ "other_domain_formats"=>
374
+ [{"format"=>"first", "confidence"=>"high"},
375
+ {"format"=>"last.first", "confidence"=>"high"},
376
+ {"format"=>"lfirst", "confidence"=>"high"},
377
+ {"format"=>"lastfirst", "confidence"=>"high"},
378
+ {"format"=>"firstl", "confidence"=>"high"},
379
+ {"format"=>"last", "confidence"=>"medium"},
380
+ {"format"=>"first.middle.last", "confidence"=>"medium"},
381
+ {"format"=>"first-last", "confidence"=>"medium"},
382
+ {"format"=>"l.first", "confidence"=>"medium"},
383
+ {"format"=>"f.last", "confidence"=>"medium"},
384
+ {"format"=>"f-last", "confidence"=>"medium"},
385
+ {"format"=>"first.l", "confidence"=>"medium"},
386
+ {"format"=>"first-l", "confidence"=>"medium"},
387
+ {"format"=>"firstlast", "confidence"=>"medium"},
388
+ {"format"=>"first_l", "confidence"=>"medium"},
389
+ {"format"=>"f_last", "confidence"=>"medium"},
390
+ {"format"=>"last.f", "confidence"=>"medium"},
391
+ {"format"=>"last-f", "confidence"=>"medium"},
392
+ {"format"=>"last-first", "confidence"=>"medium"},
393
+ {"format"=>"first_last", "confidence"=>"medium"},
394
+ {"format"=>"last_f", "confidence"=>"medium"},
395
+ {"format"=>"last_first", "confidence"=>"medium"},
396
+ {"format"=>"flast", "confidence"=>"medium"},
397
+ {"format"=>"lastf", "confidence"=>"medium"},
398
+ {"format"=>"l-first", "confidence"=>"low"},
399
+ {"format"=>"l_first", "confidence"=>"low"}]}
400
+ # Zerobounce.guessformat("zerobounce.net", first_name: "John", middle_name: 'Deere', last_name: "Doe")
401
+ ```
402
+
357
403
 
358
- ## Development
404
+ #### Development
359
405
 
360
406
  After checking out the repo run tests
361
407
  ```bash
362
- rspec --init # if needed
408
+ rspec --init ### if needed
363
409
  bundle exec rspec
364
410
  ```
365
411
 
@@ -373,7 +419,7 @@ Finished in 6.81 seconds (files took 0.40587 seconds to load)
373
419
  53 examples, 0 failures
374
420
  ```
375
421
 
376
- ### Test parameters
422
+ ##### Test parameters
377
423
  The tests use the following environment parameters:
378
424
  TEST {unit|live} influences whether mocked unit tests are run or the live server is used (credits may be used if you choose to do this)
379
425
  ZEROBOUNCE_API_KEY {<zerobounce-api-key-value>} this key is used to make requests to the live server; it is also used in mock tests as a valid key sample (any value will work for mock tests)