appending 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appending.rb +25 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e018ab896cfc8ade090d1520b22241d6a6ff94af9680466ce659aa5ad6e7fb9b
4
- data.tar.gz: 1d9ddd8428910b8085399bbcdbba8198cb05bdc112200714844c29a35bde0ff0
3
+ metadata.gz: add82355a1cc40388a4638c12458a7c85419d888c2faf290468293aa3d1c5318
4
+ data.tar.gz: 50b9b920c608bcb72a3ca9402be2bfc0bc60854c2ab0091e0662384c95995323
5
5
  SHA512:
6
- metadata.gz: 721ec624c8fe4594ab7fff4aac354fbc0dafb1215abb5c5c51c88d942eb8929877fa4bfe85ae4b9f960166caee84bd480ba318c26b998d3b4b68dd4aa69c6539
7
- data.tar.gz: 9a16c08e7ff289a88253b81dafe553aee4792672e4ac83c4325e554a9da743ddf9282f0ee13f9c4d5ce312694268882da2daad730d28aade85777c69268ec2d1
6
+ metadata.gz: 29cf888c3f57d24ff03a0314450c1cc9f8882b4ffb7f0bf6e3a7c6ffae13f2b0c082541aede412141dea935713511292b8af93467335a6d636ab5abc2065120a
7
+ data.tar.gz: fdccb2a50a08b53dcfbc9736982cf57c1f224ace49931510e5562f2627279cdd7b41090df42925023b611c66394058f74e1c7b3853012f302169163f27817f52
data/lib/appending.rb CHANGED
@@ -14,6 +14,8 @@ module BlackStack
14
14
  @@phone_fields = []
15
15
  @@company_domain_fields = []
16
16
 
17
+ @@zerobounce_api_key = nil
18
+
17
19
  ## @@logger
18
20
  def self.set_logger(logger)
19
21
  @@logger = logger
@@ -162,6 +164,23 @@ module BlackStack
162
164
  @@email_fields = h[:email_fields] if h[:email_fields]
163
165
  @@phone_fields = h[:phone_fields] if h[:phone_fields]
164
166
  @@company_domain_fields = h[:company_domain_fields] if h[:company_domain_fields]
167
+
168
+ # zerobounce api key
169
+ @@zerobounce_api_key = h[:zerobounce_api_key] if h[:zerobounce_api_key]
170
+ end
171
+
172
+ # call zerobounce api
173
+ def self.zerobounce_verify(email)
174
+ # validation: email must be a string
175
+ raise "Invalid email: #{email.class}. Expected: String." if !email.is_a?(String)
176
+ url = "https://api.zerobounce.net/v2/validate"
177
+ params = {
178
+ :api_key => @@zerobounce_api_key,
179
+ :email => email,
180
+ :ip_address => nil,
181
+ }
182
+ res = BlackStack::Netting::call_get(url, params)
183
+ JSON.parse(res.body)
165
184
  end
166
185
 
167
186
  # return true if the domain get any random address as valid
@@ -337,6 +356,8 @@ module BlackStack
337
356
  emails = []
338
357
  domains = []
339
358
  verified_emails = []
359
+ #
360
+ return verified_emails if cname =~ /Self.*employed/i
340
361
  # get lead emails from in the indexes
341
362
  l.logs ("Searching index emails... ")
342
363
  emails = BlackStack::Appending.find_persons(fname, lname, cname, l).map { |res|
@@ -345,6 +366,7 @@ module BlackStack
345
366
  email.to_s.empty?
346
367
  }.uniq
347
368
  # remove duplications
369
+ # IMPORTANT: be sure you have no spances, and no duplications, in order to don't repeat this issue https://github.com/leandrosardi/emails/issues/124
348
370
  emails = emails.map { |email| email.to_s.downcase.strip }.uniq
349
371
  l.logf "done (#{emails.to_s})"
350
372
  # get company domains from the indexes
@@ -358,6 +380,7 @@ module BlackStack
358
380
  domain.to_s.gsub('www.', '').downcase
359
381
  }.uniq
360
382
  # remove duplications
383
+ # IMPORTANT: be sure you have no spances, and no duplications, in order to don't repeat this issue https://github.com/leandrosardi/emails/issues/124
361
384
  domains = domains.map { |domain| domain.to_s.downcase.strip }.uniq
362
385
  l.logf "done (#{domains.to_s})"
363
386
  # add emails using fname and lname and company domains
@@ -389,10 +412,12 @@ module BlackStack
389
412
  l.logs "Verifying #{email}... "
390
413
  verified_emails << email if BlackStack::Appending.verify(email)
391
414
  l.done
415
+ # IMPORTANT: I added this line in order to resolve this issue https://github.com/leandrosardi/emails/issues/124
392
416
  break if verified_emails.size > 0
393
417
  }
394
418
  l.done
395
419
  # verify all the emails found in the indexes
420
+ # IMPORTANT: I added this double-check in order to don't repeat this issue https://github.com/leandrosardi/emails/issues/124
396
421
  l.logs ("Double check emails... ")
397
422
  verified_emails.each { |email|
398
423
  l.logs "Double-checking #{email}... "
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appending
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-21 00:00:00.000000000 Z
11
+ date: 2023-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: csv