zerobounce-sdk 1.0.0 → 1.1.0
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/Gemfile.lock +4 -4
- data/README.md +6 -0
- data/documentation.md +393 -0
- data/documentation_es.md +405 -0
- data/lib/zerobounce/version.rb +1 -1
- data/lib/zerobounce.rb +32 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f187873eefae835fa3cf0d83ee742ecac903880e67162f81b553e1a288170d2c
|
4
|
+
data.tar.gz: d169d4722b1fbfef58486a6495e144164fc5d1e2ca25d3c7d40ac691627cd39e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf05baf952979ea120118261ff907528188e6d50677ad40390159338db8d830918d9064399443ad0d3d08cd2f174bed769466965660e4b8c11e568aaa3f2a6d8
|
7
|
+
data.tar.gz: 689c70548c2b6b700ebc9b48cc8326ff8f7bd0e61713f48ad73c1fda9cbb003e448117678161a5a8dcb320da05343263945cb58ca2cb767b1e3a11d1311c1b65
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
zerobounce (
|
4
|
+
zerobounce-sdk (1.1.0)
|
5
5
|
rest-client (~> 2.1)
|
6
6
|
|
7
7
|
GEM
|
@@ -23,9 +23,9 @@ GEM
|
|
23
23
|
domain_name (~> 0.5)
|
24
24
|
json (2.6.3)
|
25
25
|
method_source (1.0.0)
|
26
|
-
mime-types (3.
|
26
|
+
mime-types (3.5.1)
|
27
27
|
mime-types-data (~> 3.2015)
|
28
|
-
mime-types-data (3.2023.
|
28
|
+
mime-types-data (3.2023.0808)
|
29
29
|
netrc (0.11.0)
|
30
30
|
parallel (1.22.1)
|
31
31
|
parser (3.2.2.0)
|
@@ -115,7 +115,7 @@ DEPENDENCIES
|
|
115
115
|
vcr (~> 6.1.0)
|
116
116
|
webmock (~> 3.18)
|
117
117
|
yard (~> 0.9.26)
|
118
|
-
zerobounce!
|
118
|
+
zerobounce-sdk!
|
119
119
|
|
120
120
|
BUNDLED WITH
|
121
121
|
2.4.6
|
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/documentation.md
ADDED
@@ -0,0 +1,393 @@
|
|
1
|
+
#### Usage
|
2
|
+
Add this line to your application's Gemfile:
|
3
|
+
```ruby
|
4
|
+
gem 'zerobounce-sdk'
|
5
|
+
```
|
6
|
+
|
7
|
+
And then execute:
|
8
|
+
```bash
|
9
|
+
$bundle
|
10
|
+
```
|
11
|
+
|
12
|
+
Or install it yourself as:
|
13
|
+
```bash
|
14
|
+
$gem install zerobounce-sdk
|
15
|
+
```
|
16
|
+
|
17
|
+
Import
|
18
|
+
```ruby
|
19
|
+
require 'zerobounce'
|
20
|
+
```
|
21
|
+
|
22
|
+
Set a valid ZeroBounce API key.
|
23
|
+
```ruby
|
24
|
+
Zerobounce.configure do |config|
|
25
|
+
config.apikey = '<zerobounce-api-key>'
|
26
|
+
...
|
27
|
+
end
|
28
|
+
```
|
29
|
+
or
|
30
|
+
```
|
31
|
+
Zerobounce.config.apikey = '<zerobounce-api-key>'
|
32
|
+
...
|
33
|
+
```
|
34
|
+
|
35
|
+
Credits
|
36
|
+
```ruby
|
37
|
+
Zerobounce.credits
|
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"}
|
45
|
+
```
|
46
|
+
|
47
|
+
Usage statistics
|
48
|
+
```ruby
|
49
|
+
Zerobounce.api_usage(Date.today, Date.today)
|
50
|
+
=>
|
51
|
+
{"total"=>0,
|
52
|
+
"status_valid"=>0,
|
53
|
+
"status_invalid"=>0,
|
54
|
+
"status_catch_all"=>0,
|
55
|
+
"status_do_not_mail"=>0,
|
56
|
+
"status_spamtrap"=>0,
|
57
|
+
"status_unknown"=>0,
|
58
|
+
"sub_status_toxic"=>0,
|
59
|
+
"sub_status_disposable"=>0,
|
60
|
+
"sub_status_role_based"=>0,
|
61
|
+
"sub_status_possible_trap"=>0,
|
62
|
+
"sub_status_global_suppression"=>0,
|
63
|
+
"sub_status_timeout_exceeded"=>0,
|
64
|
+
"sub_status_mail_server_temporary_error"=>0,
|
65
|
+
"sub_status_mail_server_did_not_respond"=>0,
|
66
|
+
"sub_status_greylisted"=>0,
|
67
|
+
"sub_status_antispam_system"=>0,
|
68
|
+
"sub_status_does_not_accept_mail"=>0,
|
69
|
+
"sub_status_exception_occurred"=>0,
|
70
|
+
"sub_status_failed_syntax_check"=>0,
|
71
|
+
"sub_status_mailbox_not_found"=>0,
|
72
|
+
"sub_status_unroutable_ip_address"=>0,
|
73
|
+
"sub_status_possible_typo"=>0,
|
74
|
+
"sub_status_no_dns_entries"=>0,
|
75
|
+
"sub_status_role_based_catch_all"=>0,
|
76
|
+
"sub_status_mailbox_quota_exceeded"=>0,
|
77
|
+
"sub_status_forcible_disconnect"=>0,
|
78
|
+
"sub_status_failed_smtp_connection"=>0,
|
79
|
+
"sub_status_mx_forward"=>0,
|
80
|
+
"sub_status_alternate"=>0,
|
81
|
+
"sub_status_blocked"=>0,
|
82
|
+
"sub_status_allowed"=>0,
|
83
|
+
"start_date"=>"4/28/2023",
|
84
|
+
"end_date"=>"4/28/2023"}
|
85
|
+
```
|
86
|
+
|
87
|
+
##### Email Validation
|
88
|
+
|
89
|
+
Validate single eMail
|
90
|
+
```ruby
|
91
|
+
Zerobounce.validate('valid@example.com')
|
92
|
+
### Zerobounce.validate('valid@example.com', '192.168.0.1') # optional IP address
|
93
|
+
=>
|
94
|
+
{"address"=>"valid@example.com",
|
95
|
+
"status"=>"valid",
|
96
|
+
"sub_status"=>"",
|
97
|
+
"free_email"=>false,
|
98
|
+
"did_you_mean"=>nil,
|
99
|
+
"account"=>nil,
|
100
|
+
"domain"=>nil,
|
101
|
+
"domain_age_days"=>"9692",
|
102
|
+
"smtp_provider"=>"example",
|
103
|
+
"mx_found"=>"true",
|
104
|
+
"mx_record"=>"mx.example.com",
|
105
|
+
"firstname"=>"zero",
|
106
|
+
"lastname"=>"bounce",
|
107
|
+
"gender"=>"male",
|
108
|
+
"country"=>nil,
|
109
|
+
"region"=>nil,
|
110
|
+
"city"=>nil,
|
111
|
+
"zipcode"=>nil,
|
112
|
+
"processed_at"=>"2023-04-28 15:18:45.631"}
|
113
|
+
```
|
114
|
+
|
115
|
+
Validate batch
|
116
|
+
```ruby
|
117
|
+
emails
|
118
|
+
=>
|
119
|
+
["disposable@example.com",
|
120
|
+
"invalid@example.com",
|
121
|
+
"valid@example.com",
|
122
|
+
"toxic@example.com",
|
123
|
+
"donotmail@example.com",
|
124
|
+
"spamtrap@example.com"]
|
125
|
+
|
126
|
+
### ip_addresses
|
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"]
|
128
|
+
### Zerobounce.validate_batch(emails, ip_addresses) # optional ip_addresses parameter
|
129
|
+
|
130
|
+
Zerobounce.validate_batch(emails)
|
131
|
+
=>
|
132
|
+
[{"address"=>"disposable@example.com",
|
133
|
+
"status"=>"do_not_mail",
|
134
|
+
"sub_status"=>"disposable",
|
135
|
+
"free_email"=>false,
|
136
|
+
"did_you_mean"=>nil,
|
137
|
+
"account"=>nil,
|
138
|
+
"domain"=>nil,
|
139
|
+
"domain_age_days"=>"9692",
|
140
|
+
"smtp_provider"=>"example",
|
141
|
+
"mx_found"=>"true",
|
142
|
+
"mx_record"=>"mx.example.com",
|
143
|
+
"firstname"=>"zero",
|
144
|
+
"lastname"=>"bounce",
|
145
|
+
"gender"=>"male",
|
146
|
+
"country"=>nil,
|
147
|
+
"region"=>nil,
|
148
|
+
"city"=>nil,
|
149
|
+
"zipcode"=>nil,
|
150
|
+
"processed_at"=>"2023-04-28 15:21:44.340"},
|
151
|
+
{"address"=>"invalid@example.com",
|
152
|
+
"status"=>"invalid",
|
153
|
+
"sub_status"=>"mailbox_not_found",
|
154
|
+
"free_email"=>false,
|
155
|
+
"did_you_mean"=>nil,
|
156
|
+
"account"=>nil,
|
157
|
+
"domain"=>nil,
|
158
|
+
"domain_age_days"=>"9692",
|
159
|
+
"smtp_provider"=>"example",
|
160
|
+
"mx_found"=>"true",
|
161
|
+
"mx_record"=>"mx.example.com",
|
162
|
+
"firstname"=>"zero",
|
163
|
+
"lastname"=>"bounce",
|
164
|
+
"gender"=>"male",
|
165
|
+
"country"=>nil,
|
166
|
+
"region"=>nil,
|
167
|
+
"city"=>nil,
|
168
|
+
"zipcode"=>nil,
|
169
|
+
"processed_at"=>"2023-04-28 15:21:44.340"},
|
170
|
+
{"address"=>"valid@example.com",
|
171
|
+
"status"=>"valid",
|
172
|
+
"sub_status"=>"",
|
173
|
+
"free_email"=>false,
|
174
|
+
"did_you_mean"=>nil,
|
175
|
+
"account"=>nil,
|
176
|
+
"domain"=>nil,
|
177
|
+
"domain_age_days"=>"9692",
|
178
|
+
"smtp_provider"=>"example",
|
179
|
+
"mx_found"=>"true",
|
180
|
+
"mx_record"=>"mx.example.com",
|
181
|
+
"firstname"=>"zero",
|
182
|
+
"lastname"=>"bounce",
|
183
|
+
"gender"=>"male",
|
184
|
+
"country"=>nil,
|
185
|
+
"region"=>nil,
|
186
|
+
"city"=>nil,
|
187
|
+
"zipcode"=>nil,
|
188
|
+
"processed_at"=>"2023-04-28 15:21:44.340"},
|
189
|
+
{"address"=>"toxic@example.com",
|
190
|
+
"status"=>"do_not_mail",
|
191
|
+
"sub_status"=>"toxic",
|
192
|
+
"free_email"=>false,
|
193
|
+
"did_you_mean"=>nil,
|
194
|
+
"account"=>nil,
|
195
|
+
"domain"=>nil,
|
196
|
+
"domain_age_days"=>"9692",
|
197
|
+
"smtp_provider"=>"example",
|
198
|
+
"mx_found"=>"true",
|
199
|
+
"mx_record"=>"mx.example.com",
|
200
|
+
"firstname"=>"zero",
|
201
|
+
"lastname"=>"bounce",
|
202
|
+
"gender"=>"male",
|
203
|
+
"country"=>nil,
|
204
|
+
"region"=>nil,
|
205
|
+
"city"=>nil,
|
206
|
+
"zipcode"=>nil,
|
207
|
+
"processed_at"=>"2023-04-28 15:21:44.340"},
|
208
|
+
{"address"=>"donotmail@example.com",
|
209
|
+
"status"=>"do_not_mail",
|
210
|
+
"sub_status"=>"role_based",
|
211
|
+
"free_email"=>false,
|
212
|
+
"did_you_mean"=>nil,
|
213
|
+
"account"=>nil,
|
214
|
+
"domain"=>nil,
|
215
|
+
"domain_age_days"=>"9692",
|
216
|
+
"smtp_provider"=>"example",
|
217
|
+
"mx_found"=>"true",
|
218
|
+
"mx_record"=>"mx.example.com",
|
219
|
+
"firstname"=>"zero",
|
220
|
+
"lastname"=>"bounce",
|
221
|
+
"gender"=>"male",
|
222
|
+
"country"=>nil,
|
223
|
+
"region"=>nil,
|
224
|
+
"city"=>nil,
|
225
|
+
"zipcode"=>nil,
|
226
|
+
"processed_at"=>"2023-04-28 15:21:44.340"},
|
227
|
+
{"address"=>"spamtrap@example.com",
|
228
|
+
"status"=>"spamtrap",
|
229
|
+
"sub_status"=>"",
|
230
|
+
"free_email"=>false,
|
231
|
+
"did_you_mean"=>nil,
|
232
|
+
"account"=>nil,
|
233
|
+
"domain"=>nil,
|
234
|
+
"domain_age_days"=>"9692",
|
235
|
+
"smtp_provider"=>"example",
|
236
|
+
"mx_found"=>"true",
|
237
|
+
"mx_record"=>"mx.example.com",
|
238
|
+
"firstname"=>"zero",
|
239
|
+
"lastname"=>"bounce",
|
240
|
+
"gender"=>"male",
|
241
|
+
"country"=>nil,
|
242
|
+
"region"=>nil,
|
243
|
+
"city"=>nil,
|
244
|
+
"zipcode"=>nil,
|
245
|
+
"processed_at"=>"2023-04-28 15:21:44.340"}]
|
246
|
+
```
|
247
|
+
|
248
|
+
###### Batch File Validation
|
249
|
+
|
250
|
+
Send file
|
251
|
+
```ruby
|
252
|
+
### sample file can be found in the files folder of this repository
|
253
|
+
validate_file_path = File.join(Dir.pwd, 'files', 'validation.csv')
|
254
|
+
=> "/home/zb/wrappers/ruby-test/files/validation.csv"
|
255
|
+
Zerobounce.validate_file_send(validate_file_path)
|
256
|
+
=>
|
257
|
+
{"success"=>true,
|
258
|
+
"message"=>"File Accepted",
|
259
|
+
"file_name"=>"validation.csv",
|
260
|
+
"file_id"=>"75d854a6-565c-49f9-b4c8-b3344480ec4c"}
|
261
|
+
### file_id will be required for next steps
|
262
|
+
### optional named parameters:
|
263
|
+
email_address_column: 1,
|
264
|
+
first_name_column: 2,
|
265
|
+
last_name_column: 3,
|
266
|
+
gender_column: 4,
|
267
|
+
has_header_row: true,
|
268
|
+
return_url: nil ### results callback url
|
269
|
+
### Zerobounce.validate_file_send(validate_file_path, email_address_column: 1, gender_column: 4)
|
270
|
+
```
|
271
|
+
|
272
|
+
Check file
|
273
|
+
```ruby
|
274
|
+
file_id = "75d854a6-565c-49f9-b4c8-b3344480ec4c"
|
275
|
+
=> "75d854a6-565c-49f9-b4c8-b3344480ec4c"
|
276
|
+
Zerobounce.validate_file_check(file_id)
|
277
|
+
=>
|
278
|
+
{"success"=>true,
|
279
|
+
"file_id"=>"75d854a6-565c-49f9-b4c8-b3344480ec4c",
|
280
|
+
"file_name"=>"validation.csv",
|
281
|
+
"upload_date"=>"2023-04-28T15:25:41Z",
|
282
|
+
"file_status"=>"Greylisted",
|
283
|
+
"complete_percentage"=>"0%",
|
284
|
+
"error_reason"=>nil,
|
285
|
+
"return_url"=>nil}
|
286
|
+
```
|
287
|
+
|
288
|
+
Get file
|
289
|
+
```ruby
|
290
|
+
file_id = "75d854a6-565c-49f9-b4c8-b3344480ec4c"
|
291
|
+
=> "75d854a6-565c-49f9-b4c8-b3344480ec4c"
|
292
|
+
Zerobounce.validate_file_get(file_id)
|
293
|
+
=> "\"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"
|
294
|
+
```
|
295
|
+
|
296
|
+
Delete file
|
297
|
+
```ruby
|
298
|
+
file_id = "75d854a6-565c-49f9-b4c8-b3344480ec4c"
|
299
|
+
=> "75d854a6-565c-49f9-b4c8-b3344480ec4c"
|
300
|
+
Zerobounce.validate_file_delete(file_id)
|
301
|
+
=>
|
302
|
+
{"success"=>true,
|
303
|
+
"message"=>"File Deleted",
|
304
|
+
"file_name"=>"validation.csv",
|
305
|
+
"file_id"=>"75d854a6-565c-49f9-b4c8-b3344480ec4c"}
|
306
|
+
```
|
307
|
+
|
308
|
+
##### AI Scoring
|
309
|
+
|
310
|
+
Send file
|
311
|
+
```ruby
|
312
|
+
scoring_file_path = File.join(Dir.pwd, 'files', 'scoring.csv')
|
313
|
+
=> "/home/odin/zb/wrappers/ruby-test/files/scoring.csv"
|
314
|
+
Zerobounce.scoring_file_send(scoring_file_path)
|
315
|
+
=>
|
316
|
+
{"success"=>true,
|
317
|
+
"message"=>"File Accepted",
|
318
|
+
"file_name"=>"scoring.csv",
|
319
|
+
"file_id"=>"89fb7262-b845-4fa1-aa25-e486347ec64e"}
|
320
|
+
### file_id will be required for the next steps
|
321
|
+
### optional named parameters
|
322
|
+
email_address_column: 1,
|
323
|
+
has_header_row: true,
|
324
|
+
return_url: nil ### results callback url
|
325
|
+
### Zerobounce.scoring_file_send(scoring_file_path, email_address_column: 1)
|
326
|
+
```
|
327
|
+
|
328
|
+
File check
|
329
|
+
```ruby
|
330
|
+
file_id = "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
331
|
+
=> "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
332
|
+
Zerobounce.scoring_file_check(file_id)
|
333
|
+
=>
|
334
|
+
{"success"=>true,
|
335
|
+
"file_id"=>"89fb7262-b845-4fa1-aa25-e486347ec64e",
|
336
|
+
"file_name"=>"scoring.csv",
|
337
|
+
"upload_date"=>"2023-04-28T16:57:18Z",
|
338
|
+
"file_status"=>"Complete",
|
339
|
+
"complete_percentage"=>"100% Complete.",
|
340
|
+
"return_url"=>nil}
|
341
|
+
```
|
342
|
+
|
343
|
+
Get file
|
344
|
+
```ruby
|
345
|
+
file_id = "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
346
|
+
=> "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
347
|
+
Zerobounce.scoring_file_get(file_id)
|
348
|
+
=> "\"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\""
|
349
|
+
```
|
350
|
+
|
351
|
+
Delete file
|
352
|
+
```ruby
|
353
|
+
file_id = "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
354
|
+
=> "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
355
|
+
Zerobounce.validate_file_delete(file_id)
|
356
|
+
=> {"success"=>false, "message"=>"File cannot be found."}
|
357
|
+
```
|
358
|
+
|
359
|
+
|
360
|
+
#### Development
|
361
|
+
|
362
|
+
After checking out the repo run tests
|
363
|
+
```bash
|
364
|
+
rspec --init ### if needed
|
365
|
+
bundle exec rspec
|
366
|
+
```
|
367
|
+
|
368
|
+
You should see an output like this
|
369
|
+
```bash
|
370
|
+
Run options: include {:focus=>true}
|
371
|
+
running live tests
|
372
|
+
.....................................................
|
373
|
+
|
374
|
+
Finished in 6.81 seconds (files took 0.40587 seconds to load)
|
375
|
+
53 examples, 0 failures
|
376
|
+
```
|
377
|
+
|
378
|
+
##### Test parameters
|
379
|
+
The tests use the following environment parameters:
|
380
|
+
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)
|
381
|
+
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)
|
382
|
+
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.
|
383
|
+
|
384
|
+
To set them
|
385
|
+
```bash
|
386
|
+
export ZEROBOUNCE_API_KEY=99e7ef20ceea4480a173b07b1be75371
|
387
|
+
export INCORRECT_API_KEY=thiskeyisinvalidorotherwiseincorrect
|
388
|
+
export TEST=unit
|
389
|
+
```
|
390
|
+
|
391
|
+
A .env.sample file is provided.
|
392
|
+
|
393
|
+
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/documentation_es.md
ADDED
@@ -0,0 +1,405 @@
|
|
1
|
+
#### Uso
|
2
|
+
Agrega esta línea a tu Gemfile de la aplicación:
|
3
|
+
```ruby
|
4
|
+
gem 'zerobounce-sdk'
|
5
|
+
```
|
6
|
+
|
7
|
+
Y luego ejecuta:
|
8
|
+
```bash
|
9
|
+
$ bundle
|
10
|
+
```
|
11
|
+
|
12
|
+
O instálalo directamente con:
|
13
|
+
```bash
|
14
|
+
$ gem install zerobounce-sdk
|
15
|
+
```
|
16
|
+
|
17
|
+
Importa:
|
18
|
+
```ruby
|
19
|
+
require 'zerobounce'
|
20
|
+
```
|
21
|
+
|
22
|
+
Configura una clave de API válida de ZeroBounce:
|
23
|
+
```ruby
|
24
|
+
Zerobounce.configure do |config|
|
25
|
+
config.apikey = '<clave-de-api-de-zerobounce>'
|
26
|
+
...
|
27
|
+
end
|
28
|
+
```
|
29
|
+
o
|
30
|
+
```ruby
|
31
|
+
Zerobounce.config.apikey = '<clave-de-api-de-zerobounce>'
|
32
|
+
...
|
33
|
+
```
|
34
|
+
|
35
|
+
Créditos
|
36
|
+
```ruby
|
37
|
+
Zerobounce.credits
|
38
|
+
=> 79 ### devuelve -1 si la clave es inválida
|
39
|
+
```
|
40
|
+
|
41
|
+
Actividad
|
42
|
+
```ruby
|
43
|
+
Zerobounce.activity('ss@gmail.com')
|
44
|
+
=> {"found"=>true, "active_in_days"=>"180"}
|
45
|
+
```
|
46
|
+
|
47
|
+
Estadísticas de uso
|
48
|
+
```ruby
|
49
|
+
Zerobounce.api_usage(Date.today, Date.today)
|
50
|
+
=>
|
51
|
+
{"total"=>0,
|
52
|
+
"status_valid"=>0,
|
53
|
+
"status_invalid"=>0,
|
54
|
+
"status_catch_all"=>0,
|
55
|
+
"status_do_not_mail"=>0,
|
56
|
+
"status_spamtrap"=>0,
|
57
|
+
"status_unknown"=>0,
|
58
|
+
"sub_status_toxic"=>0,
|
59
|
+
"sub_status_disposable"=>0,
|
60
|
+
"sub_status_role_based"=>0,
|
61
|
+
"sub_status_possible_trap"=>0,
|
62
|
+
"sub_status_global_suppression"=>0,
|
63
|
+
"sub_status_timeout_exceeded"=>0,
|
64
|
+
"sub_status_mail_server_temporary_error"=>0,
|
65
|
+
"sub_status_mail_server_did_not_respond"=>0,
|
66
|
+
"sub_status_greylisted"=>0,
|
67
|
+
"sub_status_antispam_system"=>0,
|
68
|
+
"sub_status_does_not_accept_mail"=>0,
|
69
|
+
"sub_status_exception_occurred"=>0,
|
70
|
+
"sub_status_failed_syntax_check"=>0,
|
71
|
+
"sub_status_mailbox_not_found"=>0,
|
72
|
+
"sub_status_unroutable_ip_address"=>0,
|
73
|
+
"sub_status_possible_typo"=>0,
|
74
|
+
"sub_status_no_dns_entries"=>0,
|
75
|
+
"sub_status_role_based_catch_all"=>0,
|
76
|
+
"sub_status_mailbox_quota_exceeded"=>0,
|
77
|
+
"sub_status_forcible_disconnect"=>0,
|
78
|
+
"sub_status_failed_smtp_connection"=>0,
|
79
|
+
"sub_status_mx_forward"=>0,
|
80
|
+
"sub_status_alternate"=>0,
|
81
|
+
"sub_status_blocked"=>0,
|
82
|
+
"sub_status_allowed"=>0,
|
83
|
+
"start_date"=>"4/28/2023",
|
84
|
+
"end_date"=>"4/28/2023"}
|
85
|
+
```
|
86
|
+
|
87
|
+
##### Validación de correo electrónico
|
88
|
+
|
89
|
+
Validar un solo correo electrónico
|
90
|
+
```ruby
|
91
|
+
Zerobounce.validate('valid@example.com')
|
92
|
+
### Zerobounce.validate('valid@example.com', '192.168.0.1') # dirección IP opcional
|
93
|
+
=>
|
94
|
+
{"address"=>"valid@example.com",
|
95
|
+
"status"=>"valid",
|
96
|
+
"sub_status"=>"",
|
97
|
+
"free_email"=>false,
|
98
|
+
"did_you_mean"=>nil,
|
99
|
+
"account"=>nil,
|
100
|
+
"domain"=>nil,
|
101
|
+
"domain_age_days"=>"9692",
|
102
|
+
"smtp_provider"=>"example",
|
103
|
+
"mx_found"=>"true",
|
104
|
+
"mx_record"=>"mx.example.com",
|
105
|
+
"firstname"=>"zero",
|
106
|
+
"lastname"=>"bounce",
|
107
|
+
"gender"=>"male",
|
108
|
+
"country"=>nil,
|
109
|
+
"region"=>nil,
|
110
|
+
"city"=>nil,
|
111
|
+
"zipcode"=>nil,
|
112
|
+
"processed_at"=>"2023-04-28 15:18:45.631"}
|
113
|
+
```
|
114
|
+
|
115
|
+
Validar
|
116
|
+
|
117
|
+
en lote
|
118
|
+
```ruby
|
119
|
+
emails
|
120
|
+
=>
|
121
|
+
["disposable@example.com",
|
122
|
+
"invalid@example.com",
|
123
|
+
"valid@example.com",
|
124
|
+
"toxic@example.com",
|
125
|
+
"donotmail@example.com",
|
126
|
+
"spamtrap@example.com"]
|
127
|
+
|
128
|
+
### ip_addresses
|
129
|
+
=> ["192.168.0.1", "192.168.0.1", "192.168.0.1", "192.168.0.1", "192.168.0.1", "192.168.0.1"]
|
130
|
+
### Zerobounce.validate_batch(emails, ip_addresses) # parámetro ip_addresses opcional
|
131
|
+
|
132
|
+
Zerobounce.validate_batch(emails)
|
133
|
+
=>
|
134
|
+
[{"address"=>"disposable@example.com",
|
135
|
+
"status"=>"do_not_mail",
|
136
|
+
"sub_status"=>"disposable",
|
137
|
+
"free_email"=>false,
|
138
|
+
"did_you_mean"=>nil,
|
139
|
+
"account"=>nil,
|
140
|
+
"domain"=>nil,
|
141
|
+
"domain_age_days"=>"9692",
|
142
|
+
"smtp_provider"=>"example",
|
143
|
+
"mx_found"=>"true",
|
144
|
+
"mx_record"=>"mx.example.com",
|
145
|
+
"firstname"=>"zero",
|
146
|
+
"lastname"=>"bounce",
|
147
|
+
"gender"=>"male",
|
148
|
+
"country"=>nil,
|
149
|
+
"region"=>nil,
|
150
|
+
"city"=>nil,
|
151
|
+
"zipcode"=>nil,
|
152
|
+
"processed_at"=>"2023-04-28 15:21:44.340"},
|
153
|
+
{"address"=>"invalid@example.com",
|
154
|
+
"status"=>"invalid",
|
155
|
+
"sub_status"=>"mailbox_not_found",
|
156
|
+
"free_email"=>false,
|
157
|
+
"did_you_mean"=>nil,
|
158
|
+
"account"=>nil,
|
159
|
+
"domain"=>nil,
|
160
|
+
"domain_age_days"=>"9692",
|
161
|
+
"smtp_provider"=>"example",
|
162
|
+
"mx_found"=>"true",
|
163
|
+
"mx_record"=>"mx.example.com",
|
164
|
+
"firstname"=>"zero",
|
165
|
+
"lastname"=>"bounce",
|
166
|
+
"gender"=>"male",
|
167
|
+
"country"=>nil,
|
168
|
+
"region"=>nil,
|
169
|
+
"city"=>nil,
|
170
|
+
"zipcode"=>nil,
|
171
|
+
"processed_at"=>"2023-04-28 15:21:44.340"},
|
172
|
+
{"address"=>"valid@example.com",
|
173
|
+
"status"=>"valid",
|
174
|
+
"sub_status"=>"",
|
175
|
+
"free_email"=>false,
|
176
|
+
"did_you_mean"=>nil,
|
177
|
+
"account"=>nil,
|
178
|
+
"domain"=>nil,
|
179
|
+
"domain_age_days"=>"9692",
|
180
|
+
"smtp_provider"=>"example",
|
181
|
+
"mx_found"=>"true",
|
182
|
+
"mx_record"=>"mx.example.com",
|
183
|
+
"firstname"=>"zero",
|
184
|
+
"lastname"=>"bounce",
|
185
|
+
"gender"=>"male",
|
186
|
+
"country"=>nil,
|
187
|
+
"region"=>nil,
|
188
|
+
"city"=>nil,
|
189
|
+
"zipcode"=>nil,
|
190
|
+
"processed_at"=>"2023-04-28 15:21:44.340"},
|
191
|
+
{"address"=>"toxic@example.com",
|
192
|
+
"status"=>"do_not_mail",
|
193
|
+
"sub_status"=>"toxic",
|
194
|
+
"free_email"=>false,
|
195
|
+
"did_you_mean"=>nil,
|
196
|
+
"account"=>nil,
|
197
|
+
"domain"=>nil,
|
198
|
+
"domain_age_days"=>"9692",
|
199
|
+
"smtp_provider"=>"example",
|
200
|
+
"mx_found"=>"true",
|
201
|
+
"mx_record"=>"mx.example.com",
|
202
|
+
"firstname"=>"zero",
|
203
|
+
"lastname"=>"bounce",
|
204
|
+
"gender"=>"male",
|
205
|
+
"country"=>nil,
|
206
|
+
"region"=>nil,
|
207
|
+
"city"=>nil,
|
208
|
+
"zipcode"=>nil,
|
209
|
+
"processed_at"=>"2023-04-28 15:21:44.340"},
|
210
|
+
{"address"=>"donotmail@example.com",
|
211
|
+
"status"=>"do_not_mail",
|
212
|
+
"sub_status"=>"role_based",
|
213
|
+
"free_email"=>false,
|
214
|
+
"did_you_mean"=>nil,
|
215
|
+
"account"=>nil,
|
216
|
+
"domain"=>nil,
|
217
|
+
"domain
|
218
|
+
|
219
|
+
_age_days"=>"9692",
|
220
|
+
"smtp_provider"=>"example",
|
221
|
+
"mx_found"=>"true",
|
222
|
+
"mx_record"=>"mx.example.com",
|
223
|
+
"firstname"=>"zero",
|
224
|
+
"lastname"=>"bounce",
|
225
|
+
"gender"=>"male",
|
226
|
+
"country"=>nil,
|
227
|
+
"region"=>nil,
|
228
|
+
"city"=>nil,
|
229
|
+
"zipcode"=>nil,
|
230
|
+
"processed_at"=>"2023-04-28 15:21:44.340"},
|
231
|
+
{"address"=>"spamtrap@example.com",
|
232
|
+
"status"=>"spamtrap",
|
233
|
+
"sub_status"=>"",
|
234
|
+
"free_email"=>false,
|
235
|
+
"did_you_mean"=>nil,
|
236
|
+
"account"=>nil,
|
237
|
+
"domain"=>nil,
|
238
|
+
"domain_age_days"=>"9692",
|
239
|
+
"smtp_provider"=>"example",
|
240
|
+
"mx_found"=>"true",
|
241
|
+
"mx_record"=>"mx.example.com",
|
242
|
+
"firstname"=>"zero",
|
243
|
+
"lastname"=>"bounce",
|
244
|
+
"gender"=>"male",
|
245
|
+
"country"=>nil,
|
246
|
+
"region"=>nil,
|
247
|
+
"city"=>nil,
|
248
|
+
"zipcode"=>nil,
|
249
|
+
"processed_at"=>"2023-04-28 15:21:44.340"}]
|
250
|
+
```
|
251
|
+
|
252
|
+
###### Validación de archivo en lote
|
253
|
+
|
254
|
+
Enviar archivo
|
255
|
+
```ruby
|
256
|
+
### puedes encontrar un archivo de muestra en la carpeta files de este repositorio
|
257
|
+
validate_file_path = File.join(Dir.pwd, 'files', 'validation.csv')
|
258
|
+
=> "/home/zb/wrappers/ruby-test/files/validation.csv"
|
259
|
+
Zerobounce.validate_file_send(validate_file_path)
|
260
|
+
=>
|
261
|
+
{"success"=>true,
|
262
|
+
"message"=>"File Accepted",
|
263
|
+
"file_name"=>"validation.csv",
|
264
|
+
"file_id"=>"75d854a6-565c-49f9-b4c8-b3344480ec4c"}
|
265
|
+
### se requerirá el file_id para los próximos pasos
|
266
|
+
### parámetros opcionales:
|
267
|
+
email_address_column: 1,
|
268
|
+
first_name_column: 2,
|
269
|
+
last_name_column: 3,
|
270
|
+
gender_column: 4,
|
271
|
+
has_header_row: true,
|
272
|
+
return_url: nil ### URL de devolución de resultados
|
273
|
+
### Zerobounce.validate_file_send(validate_file_path, email_address_column: 1, gender_column: 4)
|
274
|
+
```
|
275
|
+
|
276
|
+
Verificar archivo
|
277
|
+
```ruby
|
278
|
+
file_id = "75d854a6-565c-49f9-b4c8-b3344480ec4c"
|
279
|
+
=> "75d854a6-565c-49f9-b4c8-b3344480ec4c"
|
280
|
+
Zerobounce.validate_file_check(file_id)
|
281
|
+
=>
|
282
|
+
{"success"=>true,
|
283
|
+
"file_id"=>"75d854a6-565c-49f9-b4c8-b3344480ec4c",
|
284
|
+
"file_name"=>"validation.csv",
|
285
|
+
"upload_date"=>"2023-04-28T15:25:41Z",
|
286
|
+
"file_status"=>"Greylisted",
|
287
|
+
"complete_percentage"=>"0%",
|
288
|
+
"error_reason"=>nil,
|
289
|
+
"return_url"=>nil}
|
290
|
+
```
|
291
|
+
|
292
|
+
Obtener archivo
|
293
|
+
```ruby
|
294
|
+
file_id = "75d854a6-565c-49f9-b4c8-b3344480ec4c"
|
295
|
+
=> "75d854a6-565c-49f9-b4c8-b3344480ec4c"
|
296
|
+
Zerobounce.validate_file_get(file_id)
|
297
|
+
=> "\"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\",\"
|
298
|
+
|
299
|
+
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\",\"
|
300
|
+
|
301
|
+
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"
|
302
|
+
```
|
303
|
+
|
304
|
+
Eliminar archivo
|
305
|
+
```ruby
|
306
|
+
file_id = "75d854a6-565c-49f9-b4c8-b3344480ec4c"
|
307
|
+
=> "75d854a6-565c-49f9-b4c8-b3344480ec4c"
|
308
|
+
Zerobounce.validate_file_delete(file_id)
|
309
|
+
=>
|
310
|
+
{"success"=>true,
|
311
|
+
"message"=>"File Deleted",
|
312
|
+
"file_name"=>"validation.csv",
|
313
|
+
"file_id"=>"75d854a6-565c-49f9-b4c8-b3344480ec4
|
314
|
+
|
315
|
+
c"}
|
316
|
+
```
|
317
|
+
|
318
|
+
##### Puntuación de IA
|
319
|
+
|
320
|
+
Enviar archivo
|
321
|
+
```ruby
|
322
|
+
scoring_file_path = File.join(Dir.pwd, 'files', 'scoring.csv')
|
323
|
+
=> "/home/odin/zb/wrappers/ruby-test/files/scoring.csv"
|
324
|
+
Zerobounce.scoring_file_send(scoring_file_path)
|
325
|
+
=>
|
326
|
+
{"success"=>true,
|
327
|
+
"message"=>"File Accepted",
|
328
|
+
"file_name"=>"scoring.csv",
|
329
|
+
"file_id"=>"89fb7262-b845-4fa1-aa25-e486347ec64e"}
|
330
|
+
### se requerirá el file_id para los próximos pasos
|
331
|
+
### parámetros opcionales
|
332
|
+
email_address_column: 1,
|
333
|
+
has_header_row: true,
|
334
|
+
return_url: nil ### URL de devolución de resultados
|
335
|
+
### Zerobounce.scoring_file_send(scoring_file_path, email_address_column: 1)
|
336
|
+
```
|
337
|
+
|
338
|
+
Verificar archivo
|
339
|
+
```ruby
|
340
|
+
file_id = "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
341
|
+
=> "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
342
|
+
Zerobounce.scoring_file_check(file_id)
|
343
|
+
=>
|
344
|
+
{"success"=>true,
|
345
|
+
"file_id"=>"89fb7262-b845-4fa1-aa25-e486347ec64e",
|
346
|
+
"file_name"=>"scoring.csv",
|
347
|
+
"upload_date"=>"2023-04-28T16:57:18Z",
|
348
|
+
"file_status"=>"Complete",
|
349
|
+
"complete_percentage"=>"100% Complete.",
|
350
|
+
"return_url"=>nil}
|
351
|
+
```
|
352
|
+
|
353
|
+
Obtener archivo
|
354
|
+
```ruby
|
355
|
+
file_id = "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
356
|
+
=> "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
357
|
+
Zerobounce.scoring_file_get(file_id)
|
358
|
+
=> "\"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\""
|
359
|
+
```
|
360
|
+
|
361
|
+
Eliminar archivo
|
362
|
+
```ruby
|
363
|
+
file_id = "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
364
|
+
|
365
|
+
|
366
|
+
=> "89fb7262-b845-4fa1-aa25-e486347ec64e"
|
367
|
+
Zerobounce.validate_file_delete(file_id)
|
368
|
+
=> {"success"=>false, "message"=>"File cannot be found."}
|
369
|
+
```
|
370
|
+
|
371
|
+
|
372
|
+
#### Desarrollo
|
373
|
+
|
374
|
+
Después de revisar el repositorio, ejecuta las pruebas:
|
375
|
+
```bash
|
376
|
+
rspec --init ### si es necesario
|
377
|
+
bundle exec rspec
|
378
|
+
```
|
379
|
+
|
380
|
+
Deberías ver una salida como esta:
|
381
|
+
```bash
|
382
|
+
Run options: include {:focus=>true}
|
383
|
+
running live tests
|
384
|
+
.....................................................
|
385
|
+
|
386
|
+
Finished in 6.81 seconds (files took 0.40587 seconds to load)
|
387
|
+
53 examples, 0 failures
|
388
|
+
```
|
389
|
+
|
390
|
+
##### Parámetros de prueba
|
391
|
+
Las pruebas utilizan los siguientes parámetros de entorno:
|
392
|
+
TEST {unit|live} influye en si se ejecutan las pruebas simuladas de unidad o se utiliza el servidor en vivo (se pueden utilizar créditos si eliges hacer esto)
|
393
|
+
ZEROBOUNCE_API_KEY {<zerobounce-api-key-value>} esta clave se utiliza para realizar solicitudes al servidor en vivo; también se utiliza en las pruebas simuladas como un ejemplo de clave válida (cualquier valor funcionará para las pruebas simuladas)
|
394
|
+
INCORRECT_API_KEY {cualquier cadena sin espacios en blanco que no sea una clave válida} se utiliza para pruebas en las que las solicitudes deben fallar debido al valor de la clave de la API.
|
395
|
+
|
396
|
+
Para configurarlos:
|
397
|
+
```bash
|
398
|
+
export ZEROBOUNCE_API_KEY=99e7ef20ceea4480a173b07b1be75371
|
399
|
+
export INCORRECT_API_KEY=thiskeyisinvalidorotherwiseincorrect
|
400
|
+
export TEST=unit
|
401
|
+
```
|
402
|
+
|
403
|
+
Se proporciona un archivo .env.sample.
|
404
|
+
|
405
|
+
Las pruebas simuladas se generaron utilizando webmock y vcr. Esto significa que se realizaron solicitudes reales y se grabaron en los archivos .yml bajo spec/cassettes con una clave API válida en ese momento utilizada con fines de prueba. Sin embargo, esta clave se ha invalidado en el ínterin, pero se proporciona en el archivo .env.sample para que las pruebas simuladas funcionen. Si no desea utilizar esta clave para simulaciones, puede reemplazarla con cualquier valor en los archivos .yml bajo spec/cassettes o eliminarlos todos y volver a ejecutar las pruebas para que vcr los grabe con una nueva clave.
|
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.
|
@@ -361,10 +375,27 @@ module Zerobounce
|
|
361
375
|
# "file_id": "6d44a908-7283-42a9-aa5f-9e57b16f84bd"
|
362
376
|
# }
|
363
377
|
def scoring_file_delete(file_id)
|
364
|
-
# todo:
|
365
378
|
params = {file_id: file_id}
|
366
379
|
@@request.bulk_get('scoring/deletefile', params)
|
367
380
|
end
|
368
381
|
|
382
|
+
|
383
|
+
def guessformat(domain, first_name: '', middle_name: '', last_name: '')
|
384
|
+
params = {
|
385
|
+
domain: domain
|
386
|
+
}
|
387
|
+
unless first_name.empty?
|
388
|
+
params['first_name'] = first_name
|
389
|
+
end
|
390
|
+
unless middle_name.empty?
|
391
|
+
params['middle_name'] = middle_name
|
392
|
+
end
|
393
|
+
unless last_name.empty?
|
394
|
+
params['last_name'] = last_name
|
395
|
+
end
|
396
|
+
|
397
|
+
@@request.get('guessformat', params)
|
398
|
+
end
|
399
|
+
|
369
400
|
end
|
370
401
|
end
|
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.
|
4
|
+
version: 1.1.0
|
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-
|
11
|
+
date: 2023-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -237,6 +237,8 @@ files:
|
|
237
237
|
- bin/setup
|
238
238
|
- data/zerobounce-ai-scoring.csv
|
239
239
|
- data/zerobounce-batch-validation.csv
|
240
|
+
- documentation.md
|
241
|
+
- documentation_es.md
|
240
242
|
- files/scoring.csv
|
241
243
|
- files/validation.csv
|
242
244
|
- files/zerobounce-ai-scoring.csv
|