truemail 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +5 -0
- data/lib/truemail/configuration.rb +8 -0
- data/lib/truemail/validator.rb +2 -2
- data/lib/truemail/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20487757313dd1f93984687a1bb9190b5a8e7a9f619d41a5ae0b550230de63a5
|
4
|
+
data.tar.gz: fc67f8aaa93041388ff21a9dfb3cbeee16581929cd8217cb2101de64ef2c5af7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f4551903201185b354ec56c919fba276633da90546a8de1c4a3e57d0f4b786de6b1d7c667be61af5a46414569f9d00c98d19e0cc9e3bfa23c80c807fc38ba1e
|
7
|
+
data.tar.gz: 27873755f8df550ce1b2be550b8ad6650a3b4dbbeb1f5d0ee7bade7588d2d7a0b3eb1fe539a596ab05ecf220391006f6d10bfb95dfb312ce05653b2c59bf5c7a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -74,6 +74,11 @@ Truemail.configure do |config|
|
|
74
74
|
# there is one mx server).
|
75
75
|
config.connection_attempts = 3
|
76
76
|
|
77
|
+
# Optional parameter. You can predefine default validation type for
|
78
|
+
# Truemail.validate('email@email.com') call without with-parameter
|
79
|
+
# Available validation types: :regex, :mx, :smtp
|
80
|
+
config.default_validation_type = :mx
|
81
|
+
|
77
82
|
# Optional parameter. You can predefine which type of validation will be used for domains.
|
78
83
|
# Also you can skip validation by domain. Available validation types: :regex, :mx, :smtp
|
79
84
|
# This configuration will be used over current or default validation type parameter
|
@@ -5,6 +5,7 @@ module Truemail
|
|
5
5
|
DEFAULT_CONNECTION_TIMEOUT = 2
|
6
6
|
DEFAULT_RESPONSE_TIMEOUT = 2
|
7
7
|
DEFAULT_CONNECTION_ATTEMPTS = 2
|
8
|
+
DEFAULT_VALIDATION_TYPE = :smtp
|
8
9
|
|
9
10
|
attr_reader :email_pattern,
|
10
11
|
:smtp_error_body_pattern,
|
@@ -13,6 +14,7 @@ module Truemail
|
|
13
14
|
:connection_timeout,
|
14
15
|
:response_timeout,
|
15
16
|
:connection_attempts,
|
17
|
+
:default_validation_type,
|
16
18
|
:validation_type_by_domain,
|
17
19
|
:whitelisted_domains,
|
18
20
|
:blacklisted_domains
|
@@ -27,6 +29,7 @@ module Truemail
|
|
27
29
|
@connection_timeout = Truemail::Configuration::DEFAULT_CONNECTION_TIMEOUT
|
28
30
|
@response_timeout = Truemail::Configuration::DEFAULT_RESPONSE_TIMEOUT
|
29
31
|
@connection_attempts = Truemail::Configuration::DEFAULT_CONNECTION_ATTEMPTS
|
32
|
+
@default_validation_type = Truemail::Configuration::DEFAULT_VALIDATION_TYPE
|
30
33
|
@validation_type_by_domain = {}
|
31
34
|
@whitelisted_domains = []
|
32
35
|
@blacklisted_domains = []
|
@@ -58,6 +61,11 @@ module Truemail
|
|
58
61
|
end
|
59
62
|
end
|
60
63
|
|
64
|
+
def default_validation_type=(argument)
|
65
|
+
raise_unless(argument, __method__, argument.is_a?(Symbol) && Truemail::Validator::VALIDATION_TYPES.include?(argument))
|
66
|
+
@default_validation_type = argument
|
67
|
+
end
|
68
|
+
|
61
69
|
def validation_type_for=(settings)
|
62
70
|
validate_validation_type(settings)
|
63
71
|
validation_type_by_domain.merge!(settings)
|
data/lib/truemail/validator.rb
CHANGED
@@ -14,8 +14,8 @@ module Truemail
|
|
14
14
|
|
15
15
|
attr_reader :validation_type, :result
|
16
16
|
|
17
|
-
def initialize(email, with:
|
18
|
-
raise ArgumentError.new(with, :argument) unless VALIDATION_TYPES.include?(with)
|
17
|
+
def initialize(email, with: Truemail.configuration.default_validation_type)
|
18
|
+
raise Truemail::ArgumentError.new(with, :argument) unless Truemail::Validator::VALIDATION_TYPES.include?(with)
|
19
19
|
@validation_type = select_validation_type(email, with)
|
20
20
|
@result = Truemail::Validator::Result.new(email: email)
|
21
21
|
end
|
data/lib/truemail/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: truemail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladislav Trotsenko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|