smtping-email-verifier 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 06ec55ae5ee7c09211c9698dada5ec0c23b998978bbff6209994922bd662bb31
4
- data.tar.gz: 97145b6b79d1a44cd0d88a4bb9bbeb4081feb67c7b55f9b0582c524498788c28
3
+ metadata.gz: fb13f42d0efb05602a764fd2548eb1d49327e1dc6e36f57c23ee17e5576d0a7e
4
+ data.tar.gz: 79ecc233658db01d5c9686304ef90496069f5d844aef10493318a66cf8d6e252
5
5
  SHA512:
6
- metadata.gz: 44280978f93634dceab770fdcb023a405d064bb20fa683038dc017cd7d284b45360c3cfc3677837040bc78f96e1b47d49ac19d043d63aa13c2dcc8607566b1a2
7
- data.tar.gz: 46cb1424056c0d31552abce977ded717ff941c2b8afbd29a0678cfdc2da60da4c91e0be0ef003f91d96257d41f8e24abc80f77dfd75eeac385f8257e7a59c525
6
+ metadata.gz: 1a387d40f5dc41ead53555a9a968633ef463ccc9d6bf6384c4b86d9e2b39774d56805079aa76519329e2c97b93332ee0201e592abba2e2189b092c497ed44ead
7
+ data.tar.gz: 5ba8e579d089d2fb6474b8aa12d6dc6113a566837629b109df02f6aaf08bb5a389dd6c2a30c626bb95aea52e6d09e92e7258dc20b690ccf4d8b5d1d3d9936114
data/README.md CHANGED
@@ -39,6 +39,8 @@ Every result carries a `band` for simple routing:
39
39
  | `avoid` | invalid, spamtrap, disposable, blacklisted, complainer, spambot, inbox_full | remove |
40
40
  | `judgement` | catch_all, unknown, role and others | your call |
41
41
 
42
+ The band comes from the API. If a response has none, it is derived from the status.
43
+
42
44
  ## Verify a list
43
45
 
44
46
  Small lists with parallel single calls:
data/lib/smtping/bulk.rb CHANGED
@@ -29,7 +29,7 @@ module Smtping
29
29
  data = data["results"] if data.is_a?(Hash) && data.key?("results")
30
30
  return [] unless data.is_a?(Array)
31
31
 
32
- data.map { |r| r.merge("band" => Smtping.band(r["status"])) }
32
+ data.map { |r| r.merge("band" => Smtping.band_of(r)) }
33
33
  end
34
34
 
35
35
  # Poll until the job succeeds, then return its results. The block, if any, receives each job status.
@@ -132,7 +132,7 @@ module Smtping
132
132
 
133
133
  def with_band(result)
134
134
  r = result.is_a?(Hash) ? result : {}
135
- r.merge("band" => Smtping.band(r["status"]))
135
+ r.merge("band" => Smtping.band_of(r))
136
136
  end
137
137
 
138
138
  def parse(text)
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Smtping
4
4
  # The publish workflow rewrites this from the release tag (v1.2.3 gives 1.2.3).
5
- VERSION = "1.0.0"
5
+ VERSION = "1.1.0"
6
6
  end
data/lib/smtping.rb CHANGED
@@ -16,7 +16,8 @@ module Smtping
16
16
  BATCH_MAX = 1_000
17
17
  CHECKS = %w[spamtrap disposable spambot complainer].freeze
18
18
  SAFE = %w[valid alias].freeze
19
- AVOID = %w[invalid spamtrap disposable blacklisted complainer spambot inbox_full].freeze
19
+ AVOID = %w[invalid spamtrap disposable blacklisted complainer spambot inbox_full no_reply].freeze
20
+ BANDS = %w[safe avoid judgement].freeze
20
21
  EMAIL_RE = /\A[^@\s]+@[^@\s]+\.[^@\s]+\z/.freeze
21
22
 
22
23
  # "safe" (send), "avoid" (remove) or "judgement" (your call).
@@ -27,6 +28,11 @@ module Smtping
27
28
  "judgement"
28
29
  end
29
30
 
31
+ # The band decided by the API, or derived from the status when the result has none.
32
+ def self.band_of(result)
33
+ BANDS.include?(result["band"]) ? result["band"] : band(result["status"])
34
+ end
35
+
30
36
  def self.email?(value)
31
37
  EMAIL_RE.match?(value.to_s.strip)
32
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smtping-email-verifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SMTPing