zerobounce-sdk 1.0.0 → 1.0.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/README.md +6 -0
- data/README_es.md +391 -0
- data/lib/zerobounce/version.rb +1 -1
- data/lib/zerobounce.rb +14 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce3b4157b9478ba02c42a325862699aa7679b4270504ac7cc5448f5b7d4538fe
|
4
|
+
data.tar.gz: f95a6733dc75b74bcf4fcfc341eb84baa4e539ea54eaf70ac38d64fe2aa63655
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e0382eb10b8a5aac8edfdd6fedf4c50ab6de72333f5f648f0d9cac64d41af67412cf8dfbd77ba10731f1185b05f2c84b252bb25a2bd98a1827fc55397b77c1a
|
7
|
+
data.tar.gz: b9213e632058dd88944cb0499d6dfbdbf343138547296644a3843ef7e860d59fc808c7b8429ec3c86df81a971cf1891006c61a7982aeae9ba236789a9dd36b0f
|
data/README.md
CHANGED
@@ -42,6 +42,12 @@ Zerobounce.credits
|
|
42
42
|
=> 79 # returns -1 for invalid key
|
43
43
|
```
|
44
44
|
|
45
|
+
Activity
|
46
|
+
```ruby
|
47
|
+
Zerobounce.activity('ss@gmail.com')
|
48
|
+
=> {"found"=>true, "active_in_days"=>"180"}
|
49
|
+
```
|
50
|
+
|
45
51
|
Usage statistics
|
46
52
|
```ruby
|
47
53
|
Zerobounce.api_usage(Date.today, Date.today)
|
data/README_es.md
ADDED
@@ -0,0 +1,391 @@
|
|
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
|
6
|
+
Add this line to your application's Gemfile:
|
7
|
+
```ruby
|
8
|
+
gem 'zerobounce-sdk'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
```bash
|
13
|
+
$bundle
|
14
|
+
```
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
```bash
|
18
|
+
$gem install zerobounce-sdk
|
19
|
+
```
|
20
|
+
|
21
|
+
Import
|
22
|
+
```ruby
|
23
|
+
require 'zerobounce'
|
24
|
+
```
|
25
|
+
|
26
|
+
Set a valid ZeroBounce API key.
|
27
|
+
```ruby
|
28
|
+
Zerobounce.configure do |config|
|
29
|
+
config.apikey = '<zerobounce-api-key>'
|
30
|
+
...
|
31
|
+
end
|
32
|
+
```
|
33
|
+
or
|
34
|
+
```
|
35
|
+
Zerobounce.config.apikey = '<zerobounce-api-key>'
|
36
|
+
...
|
37
|
+
```
|
38
|
+
|
39
|
+
Credits
|
40
|
+
```ruby
|
41
|
+
Zerobounce.credits
|
42
|
+
=> 79 # returns -1 for invalid key
|
43
|
+
```
|
44
|
+
|
45
|
+
Usage statistics
|
46
|
+
```ruby
|
47
|
+
Zerobounce.api_usage(Date.today, Date.today)
|
48
|
+
=>
|
49
|
+
{"total"=>0,
|
50
|
+
"status_valid"=>0,
|
51
|
+
"status_invalid"=>0,
|
52
|
+
"status_catch_all"=>0,
|
53
|
+
"status_do_not_mail"=>0,
|
54
|
+
"status_spamtrap"=>0,
|
55
|
+
"status_unknown"=>0,
|
56
|
+
"sub_status_toxic"=>0,
|
57
|
+
"sub_status_disposable"=>0,
|
58
|
+
"sub_status_role_based"=>0,
|
59
|
+
"sub_status_possible_trap"=>0,
|
60
|
+
"sub_status_global_suppression"=>0,
|
61
|
+
"sub_status_timeout_exceeded"=>0,
|
62
|
+
"sub_status_mail_server_temporary_error"=>0,
|
63
|
+
"sub_status_mail_server_did_not_respond"=>0,
|
64
|
+
"sub_status_greylisted"=>0,
|
65
|
+
"sub_status_antispam_system"=>0,
|
66
|
+
"sub_status_does_not_accept_mail"=>0,
|
67
|
+
"sub_status_exception_occurred"=>0,
|
68
|
+
"sub_status_failed_syntax_check"=>0,
|
69
|
+
"sub_status_mailbox_not_found"=>0,
|
70
|
+
"sub_status_unroutable_ip_address"=>0,
|
71
|
+
"sub_status_possible_typo"=>0,
|
72
|
+
"sub_status_no_dns_entries"=>0,
|
73
|
+
"sub_status_role_based_catch_all"=>0,
|
74
|
+
"sub_status_mailbox_quota_exceeded"=>0,
|
75
|
+
"sub_status_forcible_disconnect"=>0,
|
76
|
+
"sub_status_failed_smtp_connection"=>0,
|
77
|
+
"sub_status_mx_forward"=>0,
|
78
|
+
"sub_status_alternate"=>0,
|
79
|
+
"sub_status_blocked"=>0,
|
80
|
+
"sub_status_allowed"=>0,
|
81
|
+
"start_date"=>"4/28/2023",
|
82
|
+
"end_date"=>"4/28/2023"}
|
83
|
+
```
|
84
|
+
|
85
|
+
### Email Validation
|
86
|
+
|
87
|
+
Validate single eMail
|
88
|
+
```ruby
|
89
|
+
Zerobounce.validate('valid@example.com')
|
90
|
+
# Zerobounce.validate('valid@example.com', '192.168.0.1') # optional IP address
|
91
|
+
=>
|
92
|
+
{"address"=>"valid@example.com",
|
93
|
+
"status"=>"valid",
|
94
|
+
"sub_status"=>"",
|
95
|
+
"free_email"=>false,
|
96
|
+
"did_you_mean"=>nil,
|
97
|
+
"account"=>nil,
|
98
|
+
"domain"=>nil,
|
99
|
+
"domain_age_days"=>"9692",
|
100
|
+
"smtp_provider"=>"example",
|
101
|
+
"mx_found"=>"true",
|
102
|
+
"mx_record"=>"mx.example.com",
|
103
|
+
"firstname"=>"zero",
|
104
|
+
"lastname"=>"bounce",
|
105
|
+
"gender"=>"male",
|
106
|
+
"country"=>nil,
|
107
|
+
"region"=>nil,
|
108
|
+
"city"=>nil,
|
109
|
+
"zipcode"=>nil,
|
110
|
+
"processed_at"=>"2023-04-28 15:18:45.631"}
|
111
|
+
```
|
112
|
+
|
113
|
+
Validate batch
|
114
|
+
```ruby
|
115
|
+
emails
|
116
|
+
=>
|
117
|
+
["disposable@example.com",
|
118
|
+
"invalid@example.com",
|
119
|
+
"valid@example.com",
|
120
|
+
"toxic@example.com",
|
121
|
+
"donotmail@example.com",
|
122
|
+
"spamtrap@example.com"]
|
123
|
+
|
124
|
+
# ip_addresses
|
125
|
+
=> ["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)
|
129
|
+
=>
|
130
|
+
[{"address"=>"disposable@example.com",
|
131
|
+
"status"=>"do_not_mail",
|
132
|
+
"sub_status"=>"disposable",
|
133
|
+
"free_email"=>false,
|
134
|
+
"did_you_mean"=>nil,
|
135
|
+
"account"=>nil,
|
136
|
+
"domain"=>nil,
|
137
|
+
"domain_age_days"=>"9692",
|
138
|
+
"smtp_provider"=>"example",
|
139
|
+
"mx_found"=>"true",
|
140
|
+
"mx_record"=>"mx.example.com",
|
141
|
+
"firstname"=>"zero",
|
142
|
+
"lastname"=>"bounce",
|
143
|
+
"gender"=>"male",
|
144
|
+
"country"=>nil,
|
145
|
+
"region"=>nil,
|
146
|
+
"city"=>nil,
|
147
|
+
"zipcode"=>nil,
|
148
|
+
"processed_at"=>"2023-04-28 15:21:44.340"},
|
149
|
+
{"address"=>"invalid@example.com",
|
150
|
+
"status"=>"invalid",
|
151
|
+
"sub_status"=>"mailbox_not_found",
|
152
|
+
"free_email"=>false,
|
153
|
+
"did_you_mean"=>nil,
|
154
|
+
"account"=>nil,
|
155
|
+
"domain"=>nil,
|
156
|
+
"domain_age_days"=>"9692",
|
157
|
+
"smtp_provider"=>"example",
|
158
|
+
"mx_found"=>"true",
|
159
|
+
"mx_record"=>"mx.example.com",
|
160
|
+
"firstname"=>"zero",
|
161
|
+
"lastname"=>"bounce",
|
162
|
+
"gender"=>"male",
|
163
|
+
"country"=>nil,
|
164
|
+
"region"=>nil,
|
165
|
+
"city"=>nil,
|
166
|
+
"zipcode"=>nil,
|
167
|
+
"processed_at"=>"2023-04-28 15:21:44.340"},
|
168
|
+
{"address"=>"valid@example.com",
|
169
|
+
"status"=>"valid",
|
170
|
+
"sub_status"=>"",
|
171
|
+
"free_email"=>false,
|
172
|
+
"did_you_mean"=>nil,
|
173
|
+
"account"=>nil,
|
174
|
+
"domain"=>nil,
|
175
|
+
"domain_age_days"=>"9692",
|
176
|
+
"smtp_provider"=>"example",
|
177
|
+
"mx_found"=>"true",
|
178
|
+
"mx_record"=>"mx.example.com",
|
179
|
+
"firstname"=>"zero",
|
180
|
+
"lastname"=>"bounce",
|
181
|
+
"gender"=>"male",
|
182
|
+
"country"=>nil,
|
183
|
+
"region"=>nil,
|
184
|
+
"city"=>nil,
|
185
|
+
"zipcode"=>nil,
|
186
|
+
"processed_at"=>"2023-04-28 15:21:44.340"},
|
187
|
+
{"address"=>"toxic@example.com",
|
188
|
+
"status"=>"do_not_mail",
|
189
|
+
"sub_status"=>"toxic",
|
190
|
+
"free_email"=>false,
|
191
|
+
"did_you_mean"=>nil,
|
192
|
+
"account"=>nil,
|
193
|
+
"domain"=>nil,
|
194
|
+
"domain_age_days"=>"9692",
|
195
|
+
"smtp_provider"=>"example",
|
196
|
+
"mx_found"=>"true",
|
197
|
+
"mx_record"=>"mx.example.com",
|
198
|
+
"firstname"=>"zero",
|
199
|
+
"lastname"=>"bounce",
|
200
|
+
"gender"=>"male",
|
201
|
+
"country"=>nil,
|
202
|
+
"region"=>nil,
|
203
|
+
"city"=>nil,
|
204
|
+
"zipcode"=>nil,
|
205
|
+
"processed_at"=>"2023-04-28 15:21:44.340"},
|
206
|
+
{"address"=>"donotmail@example.com",
|
207
|
+
"status"=>"do_not_mail",
|
208
|
+
"sub_status"=>"role_based",
|
209
|
+
"free_email"=>false,
|
210
|
+
"did_you_mean"=>nil,
|
211
|
+
"account"=>nil,
|
212
|
+
"domain"=>nil,
|
213
|
+
"domain_age_days"=>"9692",
|
214
|
+
"smtp_provider"=>"example",
|
215
|
+
"mx_found"=>"true",
|
216
|
+
"mx_record"=>"mx.example.com",
|
217
|
+
"firstname"=>"zero",
|
218
|
+
"lastname"=>"bounce",
|
219
|
+
"gender"=>"male",
|
220
|
+
"country"=>nil,
|
221
|
+
"region"=>nil,
|
222
|
+
"city"=>nil,
|
223
|
+
"zipcode"=>nil,
|
224
|
+
"processed_at"=>"2023-04-28 15:21:44.340"},
|
225
|
+
{"address"=>"spamtrap@example.com",
|
226
|
+
"status"=>"spamtrap",
|
227
|
+
"sub_status"=>"",
|
228
|
+
"free_email"=>false,
|
229
|
+
"did_you_mean"=>nil,
|
230
|
+
"account"=>nil,
|
231
|
+
"domain"=>nil,
|
232
|
+
"domain_age_days"=>"9692",
|
233
|
+
"smtp_provider"=>"example",
|
234
|
+
"mx_found"=>"true",
|
235
|
+
"mx_record"=>"mx.example.com",
|
236
|
+
"firstname"=>"zero",
|
237
|
+
"lastname"=>"bounce",
|
238
|
+
"gender"=>"male",
|
239
|
+
"country"=>nil,
|
240
|
+
"region"=>nil,
|
241
|
+
"city"=>nil,
|
242
|
+
"zipcode"=>nil,
|
243
|
+
"processed_at"=>"2023-04-28 15:21:44.340"}]
|
244
|
+
```
|
245
|
+
|
246
|
+
#### Batch File Validation
|
247
|
+
|
248
|
+
Send file
|
249
|
+
```ruby
|
250
|
+
# sample file can be found in the files folder of this repository
|
251
|
+
validate_file_path = File.join(Dir.pwd, 'files', 'validation.csv')
|
252
|
+
=> "/home/zb/wrappers/ruby-test/files/validation.csv"
|
253
|
+
Zerobounce.validate_file_send(validate_file_path)
|
254
|
+
=>
|
255
|
+
{"success"=>true,
|
256
|
+
"message"=>"File Accepted",
|
257
|
+
"file_name"=>"validation.csv",
|
258
|
+
"file_id"=>"75d854a6-565c-49f9-b4c8-b3344480ec4c"}
|
259
|
+
# file_id will be required for next steps
|
260
|
+
# optional named parameters:
|
261
|
+
email_address_column: 1,
|
262
|
+
first_name_column: 2,
|
263
|
+
last_name_column: 3,
|
264
|
+
gender_column: 4,
|
265
|
+
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
|
+
```
|
269
|
+
|
270
|
+
Check file
|
271
|
+
```ruby
|
272
|
+
file_id = "75d854a6-565c-49f9-b4c8-b3344480ec4c"
|
273
|
+
=> "75d854a6-565c-49f9-b4c8-b3344480ec4c"
|
274
|
+
Zerobounce.validate_file_check(file_id)
|
275
|
+
=>
|
276
|
+
{"success"=>true,
|
277
|
+
"file_id"=>"75d854a6-565c-49f9-b4c8-b3344480ec4c",
|
278
|
+
"file_name"=>"validation.csv",
|
279
|
+
"upload_date"=>"2023-04-28T15:25:41Z",
|
280
|
+
"file_status"=>"Greylisted",
|
281
|
+
"complete_percentage"=>"0%",
|
282
|
+
"error_reason"=>nil,
|
283
|
+
"return_url"=>nil}
|
284
|
+
```
|
285
|
+
|
286
|
+
Get file
|
287
|
+
```ruby
|
288
|
+
file_id = "75d854a6-565c-49f9-b4c8-b3344480ec4c"
|
289
|
+
=> "75d854a6-565c-49f9-b4c8-b3344480ec4c"
|
290
|
+
Zerobounce.validate_file_get(file_id)
|
291
|
+
=> "\"email\",\"first\",\"last\",\"gender\",\"ip\",\"ZB Status\",\"ZB Sub Status\",\"ZB Account\",\"ZB Domain\",\"ZB First Name\",\"ZB Last Name\",\"ZB Gender\",\"ZB Free Email\",\"ZB MX Found\",\"ZB MX Record\",\"ZB SMTP Provider\",\"ZB Did You Mean\"\n\"disposable@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"do_not_mail\",\"disposable\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"invalid@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"invalid\",\"mailbox_not_found\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"valid@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"valid\",\"\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"toxic@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"do_not_mail\",\"toxic\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"donotmail@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"do_not_mail\",\"role_based\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"spamtrap@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"spamtrap\",\"\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"abuse@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"abuse\",\"\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"unknown@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"unknown\",\"mail_server_temporary_error\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"catch_all@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"catch-all\",\"\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"antispam_system@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"unknown\",\"antispam_system\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"does_not_accept_mail@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"invalid\",\"does_not_accept_mail\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"exception_occurred@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"unknown\",\"exception_occurred\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"failed_smtp_connection@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"unknown\",\"failed_smtp_connection\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"failed_syntax_check@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"invalid\",\"failed_syntax_check\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"forcible_disconnect@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"unknown\",\"forcible_disconnect\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"global_suppression@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"do_not_mail\",\"global_suppression\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"greylisted@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"unknown\",\"greylisted\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"leading_period_removed@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"valid\",\"leading_period_removed\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"mail_server_did_not_respond@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"unknown\",\"mail_server_did_not_respond\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"mail_server_temporary_error@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"unknown\",\"mail_server_temporary_error\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"mailbox_quota_exceeded@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"invalid\",\"mailbox_quota_exceeded\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"mailbox_not_found@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"invalid\",\"mailbox_not_found\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"no_dns_entries@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"invalid\",\"no_dns_entries\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"possible_trap@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"do_not_mail\",\"possible_trap\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"possible_typo@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"invalid\",\"possible_typo\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"role_based@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"do_not_mail\",\"role_based\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"timeout_exceeded@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"unknown\",\"timeout_exceeded\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"unroutable_ip_address@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"invalid\",\"unroutable_ip_address\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"free_email@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"valid\",\"\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"True\",\"true\",\"mx.example.com\",\"example\",\"\"\n\"role_based_catch_all@example.com\",\"First\",\"Last\",\"male\",\"127.0.0.1\",\"do_not_mail\",\"role_based_catch_all\",\"\",\"\",\"zero\",\"bounce\",\"male\",\"False\",\"true\",\"mx.example.com\",\"example\",\"\"\n"
|
292
|
+
```
|
293
|
+
|
294
|
+
Delete file
|
295
|
+
```ruby
|
296
|
+
file_id = "75d854a6-565c-49f9-b4c8-b3344480ec4c"
|
297
|
+
=> "75d854a6-565c-49f9-b4c8-b3344480ec4c"
|
298
|
+
Zerobounce.validate_file_delete(file_id)
|
299
|
+
=>
|
300
|
+
{"success"=>true,
|
301
|
+
"message"=>"File Deleted",
|
302
|
+
"file_name"=>"validation.csv",
|
303
|
+
"file_id"=>"75d854a6-565c-49f9-b4c8-b3344480ec4c"}
|
304
|
+
```
|
305
|
+
|
306
|
+
### AI Scoring
|
307
|
+
|
308
|
+
Send file
|
309
|
+
```ruby
|
310
|
+
scoring_file_path = File.join(Dir.pwd, 'files', 'scoring.csv')
|
311
|
+
=> "/home/odin/zb/wrappers/ruby-test/files/scoring.csv"
|
312
|
+
Zerobounce.scoring_file_send(scoring_file_path)
|
313
|
+
=>
|
314
|
+
{"success"=>true,
|
315
|
+
"message"=>"File Accepted",
|
316
|
+
"file_name"=>"scoring.csv",
|
317
|
+
"file_id"=>"89fb7262-b845-4fa1-aa25-e486347ec64e"}
|
318
|
+
# file_id will be required for the next steps
|
319
|
+
# optional named parameters
|
320
|
+
email_address_column: 1,
|
321
|
+
has_header_row: true,
|
322
|
+
return_url: nil # results callback url
|
323
|
+
# Zerobounce.scoring_file_send(scoring_file_path, email_address_column: 1)
|
324
|
+
```
|
325
|
+
|
326
|
+
File check
|
327
|
+
```ruby
|
328
|
+
file_id = "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
329
|
+
=> "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
330
|
+
Zerobounce.scoring_file_check(file_id)
|
331
|
+
=>
|
332
|
+
{"success"=>true,
|
333
|
+
"file_id"=>"89fb7262-b845-4fa1-aa25-e486347ec64e",
|
334
|
+
"file_name"=>"scoring.csv",
|
335
|
+
"upload_date"=>"2023-04-28T16:57:18Z",
|
336
|
+
"file_status"=>"Complete",
|
337
|
+
"complete_percentage"=>"100% Complete.",
|
338
|
+
"return_url"=>nil}
|
339
|
+
```
|
340
|
+
|
341
|
+
Get file
|
342
|
+
```ruby
|
343
|
+
file_id = "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
344
|
+
=> "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
345
|
+
Zerobounce.scoring_file_get(file_id)
|
346
|
+
=> "\"email\",\"ZeroBounceQualityScore\"\r\n\"disposable@example.com\",\"0\"\r\n\"invalid@example.com\",\"10\"\r\n\"valid@example.com\",\"10\"\r\n\"toxic@example.com\",\"2\"\r\n\"donotmail@example.com\",\"0\"\r\n\"spamtrap@example.com\",\"0\"\r\n\"abuse@example.com\",\"10\"\r\n\"unknown@example.com\",\"10\"\r\n\"catch_all@example.com\",\"10\"\r\n\"antispam_system@example.com\",\"0\"\r\n\"does_not_accept_mail@example.com\",\"0\"\r\n\"exception_occurred@example.com\",\"0\"\r\n\"failed_smtp_connection@example.com\",\"0\"\r\n\"failed_syntax_check@example.com\",\"0\"\r\n\"forcible_disconnect@example.com\",\"0\"\r\n\"global_suppression@example.com\",\"0\"\r\n\"greylisted@example.com\",\"0\"\r\n\"leading_period_removed@example.com\",\"0\"\r\n\"mail_server_did_not_respond@example.com\",\"0\"\r\n\"mail_server_temporary_error@example.com\",\"0\"\r\n\"mailbox_quota_exceeded@example.com\",\"0\"\r\n\"mailbox_not_found@example.com\",\"0\"\r\n\"no_dns_entries@example.com\",\"0\"\r\n\"possible_trap@example.com\",\"0\"\r\n\"possible_typo@example.com\",\"0\"\r\n\"role_based@example.com\",\"0\"\r\n\"timeout_exceeded@example.com\",\"0\"\r\n\"unroutable_ip_address@example.com\",\"0\"\r\n\"free_email@example.com\",\"0\"\r\n\"role_based_catch_all@example.com\",\"0\""
|
347
|
+
```
|
348
|
+
|
349
|
+
Delete file
|
350
|
+
```ruby
|
351
|
+
file_id = "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
352
|
+
=> "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
353
|
+
Zerobounce.validate_file_delete(file_id)
|
354
|
+
=> {"success"=>false, "message"=>"File cannot be found."}
|
355
|
+
```
|
356
|
+
|
357
|
+
|
358
|
+
## Development
|
359
|
+
|
360
|
+
After checking out the repo run tests
|
361
|
+
```bash
|
362
|
+
rspec --init # if needed
|
363
|
+
bundle exec rspec
|
364
|
+
```
|
365
|
+
|
366
|
+
You should see an output like this
|
367
|
+
```bash
|
368
|
+
Run options: include {:focus=>true}
|
369
|
+
running live tests
|
370
|
+
.....................................................
|
371
|
+
|
372
|
+
Finished in 6.81 seconds (files took 0.40587 seconds to load)
|
373
|
+
53 examples, 0 failures
|
374
|
+
```
|
375
|
+
|
376
|
+
### Test parameters
|
377
|
+
The tests use the following environment parameters:
|
378
|
+
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
|
+
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)
|
380
|
+
INCORRECT_API_KEY {any non whitespace string value that is not a valid key} used for tests where the requests are meant to fail due to the API key value.
|
381
|
+
|
382
|
+
To set them
|
383
|
+
```bash
|
384
|
+
export ZEROBOUNCE_API_KEY=99e7ef20ceea4480a173b07b1be75371
|
385
|
+
export INCORRECT_API_KEY=thiskeyisinvalidorotherwiseincorrect
|
386
|
+
export TEST=unit
|
387
|
+
```
|
388
|
+
|
389
|
+
A .env.sample file is provided.
|
390
|
+
|
391
|
+
Mock tests were generated using webmock and vcr. This means that actual requests were made and recorded in the spec/cassettes with an (at the time) valid API key used for testing purposes. This key has been invalidated in the meantime, however it is provided in the .env.sample file for the mock tests to work. If you do not wish to use this key for mocks, you can replace it with any value in the .yml files under spec/cassettes or delete all of them and rerun the tests so that vcr records them with a new key.
|
data/lib/zerobounce/version.rb
CHANGED
data/lib/zerobounce.rb
CHANGED
@@ -153,6 +153,20 @@ module Zerobounce
|
|
153
153
|
@@request.get('getapiusage', params)
|
154
154
|
end
|
155
155
|
|
156
|
+
# Get Activty for email
|
157
|
+
#
|
158
|
+
# @param [String] :email Email to get activity for
|
159
|
+
#
|
160
|
+
# @return [Hash]
|
161
|
+
# {
|
162
|
+
# "found": true,
|
163
|
+
# "active_in_days": "180"
|
164
|
+
# }
|
165
|
+
def activity(email)
|
166
|
+
params = {email: email}
|
167
|
+
@@request.get('activity', params)
|
168
|
+
end
|
169
|
+
|
156
170
|
# Validate email batch
|
157
171
|
#
|
158
172
|
# @param [Array] :emails List of email addresses to validate.
|
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.0.
|
4
|
+
version: 1.0.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: 2023-05-
|
11
|
+
date: 2023-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -231,6 +231,7 @@ files:
|
|
231
231
|
- LICENSE
|
232
232
|
- LICENSE.txt
|
233
233
|
- README.md
|
234
|
+
- README_es.md
|
234
235
|
- Rakefile
|
235
236
|
- bin/bundle
|
236
237
|
- bin/console
|