truemail 1.8.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +1 -1
- data/.reek.yml +3 -0
- data/.rubocop.yml +138 -6
- data/CHANGELOG.md +39 -1
- data/Gemfile.lock +42 -37
- data/README.md +125 -77
- data/lib/truemail/audit/dns.rb +1 -1
- data/lib/truemail/audit/ptr.rb +2 -2
- data/lib/truemail/auditor.rb +5 -3
- data/lib/truemail/configuration.rb +1 -1
- data/lib/truemail/core.rb +7 -4
- data/lib/truemail/executor.rb +11 -0
- data/lib/truemail/log/serializer/auditor_json.rb +25 -0
- data/lib/truemail/log/serializer/base.rb +17 -42
- data/lib/truemail/log/serializer/validator_base.rb +45 -0
- data/lib/truemail/log/serializer/{json.rb → validator_json.rb} +1 -1
- data/lib/truemail/log/serializer/{text.rb → validator_text.rb} +2 -2
- data/lib/truemail/logger.rb +1 -1
- data/lib/truemail/validator.rb +3 -3
- data/lib/truemail/version.rb +1 -1
- data/truemail.gemspec +16 -8
- metadata +41 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17a5737519f8156df119dc22788dc19ec53ada84a936806bf55997264450c033
|
4
|
+
data.tar.gz: cf291777e0a45707d9e7e6fb3f27e511600817470262f49a046c5c0af4c7ec36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e9cf660b90669fc65eb5482d571278627602c89e62818b01947f79a7376b4de41fa78bf46aa0b72a0b1194d1d19a4fb34f647d241f295b08e9a36603c18cb0e
|
7
|
+
data.tar.gz: 66986df4338a41c7e5145cca47c3765983fcb04c50e76940ca5dcaec43cb70e6fec5889d8e2d680ac3a8236086d0b2d46d26e498030e8d17a115327ac1fae596
|
data/.codeclimate.yml
CHANGED
data/.reek.yml
CHANGED
@@ -39,6 +39,7 @@ detectors:
|
|
39
39
|
- Truemail::Validate::Mx#a_record
|
40
40
|
- Truemail::Audit::Base#verifier_domain
|
41
41
|
- Truemail::Configuration#domain_matcher
|
42
|
+
- Truemail::Log::Serializer::Base#errors
|
42
43
|
|
43
44
|
ControlParameter:
|
44
45
|
exclude:
|
@@ -55,6 +56,8 @@ detectors:
|
|
55
56
|
- Truemail::ConfigurationHelper#create_configuration
|
56
57
|
- Truemail::Log::Serializer::Base#smtp_debug
|
57
58
|
- Truemail::Log::Serializer::Text#data_composer
|
59
|
+
- Truemail::Log::Serializer::ValidatorBase#smtp_debug
|
60
|
+
- Truemail::Log::Serializer::ValidatorText#data_composer
|
58
61
|
|
59
62
|
NilCheck:
|
60
63
|
exclude:
|
data/.rubocop.yml
CHANGED
@@ -40,6 +40,69 @@ Style/EmptyCaseCondition:
|
|
40
40
|
Style/RescueStandardError:
|
41
41
|
Enabled: false
|
42
42
|
|
43
|
+
Style/AccessorGrouping:
|
44
|
+
Enabled: true
|
45
|
+
|
46
|
+
Style/ArrayCoercion:
|
47
|
+
Enabled: true
|
48
|
+
|
49
|
+
Style/BisectedAttrAccessor:
|
50
|
+
Enabled: true
|
51
|
+
|
52
|
+
Style/CaseLikeIf:
|
53
|
+
Enabled: true
|
54
|
+
|
55
|
+
Style/ExplicitBlockArgument:
|
56
|
+
Enabled: true
|
57
|
+
|
58
|
+
Style/ExponentialNotation:
|
59
|
+
Enabled: true
|
60
|
+
|
61
|
+
Style/GlobalStdStream:
|
62
|
+
Enabled: true
|
63
|
+
|
64
|
+
Style/HashAsLastArrayItem:
|
65
|
+
Enabled: true
|
66
|
+
|
67
|
+
Style/HashEachMethods:
|
68
|
+
Enabled: true
|
69
|
+
|
70
|
+
Style/HashLikeCase:
|
71
|
+
Enabled: true
|
72
|
+
|
73
|
+
Style/HashTransformKeys:
|
74
|
+
Enabled: true
|
75
|
+
|
76
|
+
Style/HashTransformValues:
|
77
|
+
Enabled: true
|
78
|
+
|
79
|
+
Style/OptionalBooleanParameter:
|
80
|
+
Enabled: true
|
81
|
+
|
82
|
+
Style/RedundantAssignment:
|
83
|
+
Enabled: true
|
84
|
+
|
85
|
+
Style/RedundantFetchBlock:
|
86
|
+
Enabled: true
|
87
|
+
|
88
|
+
Style/RedundantFileExtensionInRequire:
|
89
|
+
Enabled: true
|
90
|
+
|
91
|
+
Style/RedundantRegexpCharacterClass:
|
92
|
+
Enabled: true
|
93
|
+
|
94
|
+
Style/RedundantRegexpEscape:
|
95
|
+
Enabled: true
|
96
|
+
|
97
|
+
Style/SingleArgumentDig:
|
98
|
+
Enabled: true
|
99
|
+
|
100
|
+
Style/SlicingWithRange:
|
101
|
+
Enabled: true
|
102
|
+
|
103
|
+
Style/StringConcatenation:
|
104
|
+
Enabled: true
|
105
|
+
|
43
106
|
Layout/LineLength:
|
44
107
|
Max: 140
|
45
108
|
|
@@ -50,15 +113,9 @@ Layout/ClassStructure:
|
|
50
113
|
- include
|
51
114
|
- prepend
|
52
115
|
- extend
|
53
|
-
associations:
|
54
|
-
- has_one
|
55
|
-
- has_many
|
56
|
-
- belongs_to
|
57
|
-
- has_and_belongs_to_many
|
58
116
|
ExpectedOrder:
|
59
117
|
- module_inclusion
|
60
118
|
- constants
|
61
|
-
- associations
|
62
119
|
- public_class_methods
|
63
120
|
- initializer
|
64
121
|
- public_methods
|
@@ -68,9 +125,81 @@ Layout/ClassStructure:
|
|
68
125
|
Layout/EmptyLineAfterGuardClause:
|
69
126
|
Enabled: false
|
70
127
|
|
128
|
+
Layout/SpaceAroundMethodCallOperator:
|
129
|
+
Enabled: true
|
130
|
+
|
131
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
132
|
+
Enabled: true
|
133
|
+
|
71
134
|
Lint/NonDeterministicRequireOrder:
|
72
135
|
Enabled: false
|
73
136
|
|
137
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
138
|
+
Enabled: true
|
139
|
+
|
140
|
+
Lint/DeprecatedOpenSSLConstant:
|
141
|
+
Enabled: true
|
142
|
+
|
143
|
+
Lint/DuplicateElsifCondition:
|
144
|
+
Enabled: true
|
145
|
+
|
146
|
+
Lint/DuplicateRescueException:
|
147
|
+
Enabled: true
|
148
|
+
|
149
|
+
Lint/EmptyConditionalBody:
|
150
|
+
Enabled: true
|
151
|
+
|
152
|
+
Lint/FloatComparison:
|
153
|
+
Enabled: true
|
154
|
+
|
155
|
+
Lint/MissingSuper:
|
156
|
+
Enabled: false
|
157
|
+
|
158
|
+
Lint/MixedRegexpCaptureTypes:
|
159
|
+
Enabled: true
|
160
|
+
|
161
|
+
Lint/OutOfRangeRegexpRef:
|
162
|
+
Enabled: true
|
163
|
+
|
164
|
+
Lint/RaiseException:
|
165
|
+
Enabled: true
|
166
|
+
|
167
|
+
Lint/SelfAssignment:
|
168
|
+
Enabled: true
|
169
|
+
|
170
|
+
Lint/StructNewOverride:
|
171
|
+
Enabled: true
|
172
|
+
|
173
|
+
Lint/TopLevelReturnWithArgument:
|
174
|
+
Enabled: true
|
175
|
+
|
176
|
+
Lint/UnreachableLoop:
|
177
|
+
Enabled: true
|
178
|
+
|
179
|
+
Performance/AncestorsInclude:
|
180
|
+
Enabled: true
|
181
|
+
|
182
|
+
Performance/BigDecimalWithNumericArgument:
|
183
|
+
Enabled: true
|
184
|
+
|
185
|
+
Performance/RedundantSortBlock:
|
186
|
+
Enabled: true
|
187
|
+
|
188
|
+
Performance/RedundantStringChars:
|
189
|
+
Enabled: true
|
190
|
+
|
191
|
+
Performance/ReverseFirst:
|
192
|
+
Enabled: true
|
193
|
+
|
194
|
+
Performance/SortReverse:
|
195
|
+
Enabled: true
|
196
|
+
|
197
|
+
Performance/Squeeze:
|
198
|
+
Enabled: true
|
199
|
+
|
200
|
+
Performance/StringInclude:
|
201
|
+
Enabled: true
|
202
|
+
|
74
203
|
RSpec/ExampleLength:
|
75
204
|
Enabled: false
|
76
205
|
|
@@ -94,3 +223,6 @@ RSpec/MessageSpies:
|
|
94
223
|
|
95
224
|
RSpec/MultipleDescribes:
|
96
225
|
Enabled: false
|
226
|
+
|
227
|
+
RSpec/MultipleMemoizedHelpers:
|
228
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,44 @@
|
|
2
2
|
|
3
3
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
4
4
|
|
5
|
+
## [1.9.0] - 2020.09.01
|
6
|
+
|
7
|
+
## Added
|
8
|
+
|
9
|
+
- Ability to use `Truemail::Auditor` instance represented as json directly
|
10
|
+
- `Truemail::Log::Serializer::AuditorJson`
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
|
14
|
+
- `Truemail::Auditor`, `Truemail::Validator`
|
15
|
+
- serializers namespaces
|
16
|
+
- gem development dependencies
|
17
|
+
- gem documentation
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
Truemail.host_audit.as_json
|
21
|
+
|
22
|
+
=>
|
23
|
+
# Serialized Truemail::Auditor instance
|
24
|
+
{
|
25
|
+
"date": "2020-08-31 22:33:43 +0300",
|
26
|
+
"current_host_ip": "127.0.0.1",
|
27
|
+
"warnings": {
|
28
|
+
"dns": "A-record of verifier domain not refers to current host ip address", "ptr": "PTR-record does not reference to current verifier domain"
|
29
|
+
},
|
30
|
+
"configuration": {
|
31
|
+
"validation_type_by_domain": null,
|
32
|
+
"whitelist_validation": false,
|
33
|
+
"whitelisted_domains": null,
|
34
|
+
"blacklisted_domains": null,
|
35
|
+
"not_rfc_mx_lookup_flow": false,
|
36
|
+
"smtp_safe_check": false,
|
37
|
+
"email_pattern": "default gem value",
|
38
|
+
"smtp_error_body_pattern": "default gem value"
|
39
|
+
}
|
40
|
+
}
|
41
|
+
```
|
42
|
+
|
5
43
|
## [1.8.0] - 2020.06.21
|
6
44
|
|
7
45
|
## Added
|
@@ -139,7 +177,7 @@ end
|
|
139
177
|
|
140
178
|
### Added
|
141
179
|
|
142
|
-
-
|
180
|
+
- Ability to use `Truemail::Validator` instance represented as json directly
|
143
181
|
|
144
182
|
### Changed
|
145
183
|
|
data/Gemfile.lock
CHANGED
@@ -1,40 +1,39 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
truemail (1.
|
4
|
+
truemail (1.9.0)
|
5
5
|
simpleidn (~> 0.1.1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
ast (2.4.
|
11
|
-
bundler-audit (0.
|
10
|
+
ast (2.4.1)
|
11
|
+
bundler-audit (0.7.0.1)
|
12
12
|
bundler (>= 1.2.0, < 3)
|
13
|
-
thor (
|
13
|
+
thor (>= 0.18, < 2)
|
14
14
|
byebug (11.1.3)
|
15
|
-
childprocess (
|
16
|
-
coderay (1.1.
|
15
|
+
childprocess (4.0.0)
|
16
|
+
coderay (1.1.3)
|
17
17
|
colorize (0.8.1)
|
18
|
-
diff-lcs (1.
|
18
|
+
diff-lcs (1.4.4)
|
19
19
|
docile (1.3.2)
|
20
20
|
fasterer (0.8.3)
|
21
21
|
colorize (~> 0.7)
|
22
22
|
ruby_parser (>= 3.14.1)
|
23
|
-
ffaker (2.
|
23
|
+
ffaker (2.17.0)
|
24
24
|
iniparse (1.5.0)
|
25
|
-
|
26
|
-
json (2.3.0)
|
25
|
+
json (2.3.1)
|
27
26
|
json_matchers (0.11.1)
|
28
27
|
json_schema
|
29
|
-
json_schema (0.20.
|
28
|
+
json_schema (0.20.9)
|
30
29
|
kwalify (0.7.2)
|
31
30
|
method_source (1.0.0)
|
32
|
-
overcommit (0.
|
33
|
-
childprocess (>= 0.6.3, <
|
31
|
+
overcommit (0.55.0)
|
32
|
+
childprocess (>= 0.6.3, < 5)
|
34
33
|
iniparse (~> 1.4)
|
35
|
-
parallel (1.19.
|
36
|
-
parser (2.7.1.
|
37
|
-
ast (~> 2.4.
|
34
|
+
parallel (1.19.2)
|
35
|
+
parser (2.7.1.4)
|
36
|
+
ast (~> 2.4.1)
|
38
37
|
pry (0.13.1)
|
39
38
|
coderay (~> 1.1)
|
40
39
|
method_source (~> 1.0)
|
@@ -44,11 +43,13 @@ GEM
|
|
44
43
|
psych (3.1.0)
|
45
44
|
rainbow (3.0.0)
|
46
45
|
rake (13.0.1)
|
47
|
-
reek (6.0.
|
46
|
+
reek (6.0.1)
|
48
47
|
kwalify (~> 0.7.0)
|
49
48
|
parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
|
50
49
|
psych (~> 3.1.0)
|
51
50
|
rainbow (>= 2.0, < 4.0)
|
51
|
+
regexp_parser (1.7.1)
|
52
|
+
rexml (3.2.4)
|
52
53
|
rspec (3.9.0)
|
53
54
|
rspec-core (~> 3.9.0)
|
54
55
|
rspec-expectations (~> 3.9.0)
|
@@ -62,21 +63,25 @@ GEM
|
|
62
63
|
diff-lcs (>= 1.2.0, < 2.0)
|
63
64
|
rspec-support (~> 3.9.0)
|
64
65
|
rspec-support (3.9.3)
|
65
|
-
rubocop (0.
|
66
|
-
jaro_winkler (~> 1.5.1)
|
66
|
+
rubocop (0.89.1)
|
67
67
|
parallel (~> 1.10)
|
68
|
-
parser (>= 2.7.
|
68
|
+
parser (>= 2.7.1.1)
|
69
69
|
rainbow (>= 2.2.2, < 4.0)
|
70
|
+
regexp_parser (>= 1.7)
|
71
|
+
rexml
|
72
|
+
rubocop-ast (>= 0.3.0, < 1.0)
|
70
73
|
ruby-progressbar (~> 1.7)
|
71
|
-
unicode-display_width (>= 1.4.0, <
|
72
|
-
rubocop-
|
73
|
-
|
74
|
-
rubocop-
|
75
|
-
rubocop (>= 0.
|
74
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
75
|
+
rubocop-ast (0.3.0)
|
76
|
+
parser (>= 2.7.1.4)
|
77
|
+
rubocop-performance (1.7.1)
|
78
|
+
rubocop (>= 0.82.0)
|
79
|
+
rubocop-rspec (1.43.2)
|
80
|
+
rubocop (~> 0.87)
|
76
81
|
ruby-progressbar (1.10.1)
|
77
82
|
ruby_parser (3.14.2)
|
78
83
|
sexp_processor (~> 4.9)
|
79
|
-
sexp_processor (4.
|
84
|
+
sexp_processor (4.15.0)
|
80
85
|
simplecov (0.17.1)
|
81
86
|
docile (~> 1.1)
|
82
87
|
json (>= 1.8, < 3)
|
@@ -84,35 +89,35 @@ GEM
|
|
84
89
|
simplecov-html (0.10.2)
|
85
90
|
simpleidn (0.1.1)
|
86
91
|
unf (~> 0.1.4)
|
87
|
-
thor (0.
|
88
|
-
truemail-rspec (0.
|
92
|
+
thor (1.0.1)
|
93
|
+
truemail-rspec (0.2.0)
|
89
94
|
rspec (~> 3.9)
|
90
95
|
truemail (~> 1.4, >= 1.4.1)
|
91
96
|
unf (0.1.4)
|
92
97
|
unf_ext
|
93
98
|
unf_ext (0.0.7.7)
|
94
|
-
unicode-display_width (1.
|
99
|
+
unicode-display_width (1.7.0)
|
95
100
|
|
96
101
|
PLATFORMS
|
97
102
|
ruby
|
98
103
|
|
99
104
|
DEPENDENCIES
|
100
105
|
bundler (~> 1.16)
|
101
|
-
bundler-audit (~> 0.
|
106
|
+
bundler-audit (~> 0.7.0.1)
|
102
107
|
fasterer (~> 0.8.3)
|
103
|
-
ffaker (~> 2.
|
108
|
+
ffaker (~> 2.17)
|
104
109
|
json_matchers (~> 0.11.1)
|
105
|
-
overcommit (~> 0.
|
110
|
+
overcommit (~> 0.55.0)
|
106
111
|
pry-byebug (~> 3.9)
|
107
112
|
rake (~> 13.0, >= 13.0.1)
|
108
|
-
reek (~> 6.0)
|
113
|
+
reek (~> 6.0, >= 6.0.1)
|
109
114
|
rspec (~> 3.9)
|
110
|
-
rubocop (~> 0.
|
111
|
-
rubocop-performance (~> 1.
|
112
|
-
rubocop-rspec (~> 1.
|
115
|
+
rubocop (~> 0.89.1)
|
116
|
+
rubocop-performance (~> 1.7, >= 1.7.1)
|
117
|
+
rubocop-rspec (~> 1.43, >= 1.43.2)
|
113
118
|
simplecov (~> 0.17.1)
|
114
119
|
truemail!
|
115
|
-
truemail-rspec (~> 0.
|
120
|
+
truemail-rspec (~> 0.2.0)
|
116
121
|
|
117
122
|
BUNDLED WITH
|
118
123
|
1.16.6
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
![Truemail - configurable framework agnostic plain Ruby email validator](https://truemail-rb.org/assets/images/truemail_logo.png)
|
2
2
|
|
3
3
|
[![Maintainability](https://api.codeclimate.com/v1/badges/657aa241399927dcd2e2/maintainability)](https://codeclimate.com/github/rubygarage/truemail/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/657aa241399927dcd2e2/test_coverage)](https://codeclimate.com/github/rubygarage/truemail/test_coverage) [![CircleCI](https://circleci.com/gh/rubygarage/truemail/tree/master.svg?style=svg)](https://circleci.com/gh/rubygarage/truemail/tree/master) [![Gem Version](https://badge.fury.io/rb/truemail.svg)](https://badge.fury.io/rb/truemail) [![Downloads](https://img.shields.io/gem/dt/truemail.svg?colorA=004d99&colorB=0073e6)](https://rubygems.org/gems/truemail) [![Gitter](https://badges.gitter.im/truemail-rb/community.svg)](https://gitter.im/truemail-rb/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
|
4
4
|
|
@@ -32,14 +32,16 @@ Configurable framework agnostic plain Ruby email validator. Verify email via Reg
|
|
32
32
|
- [SMTP validation](#smtp-validation)
|
33
33
|
- [SMTP safe check disabled](#smtp-safe-check-disabled)
|
34
34
|
- [SMTP safe check enabled](#smtp-safe-check-enabled)
|
35
|
-
- [Event logger](#event-logger)
|
36
|
-
- [Available tracking events](#available-tracking-events)
|
37
|
-
- [JSON serializer](#json-serializer)
|
38
35
|
- [Host audit features](#host-audit-features)
|
39
36
|
- [IP audit](#ip-audit)
|
40
37
|
- [DNS audit](#dns-audit)
|
41
38
|
- [PTR audit](#ptr-audit)
|
42
39
|
- [Example of using](#example-of-using)
|
40
|
+
- [Event logger](#event-logger)
|
41
|
+
- [Available tracking events](#available-tracking-events)
|
42
|
+
- [JSON serializers](#json-serializers)
|
43
|
+
- [Auditor JSON serializer](#auditor-json-serializer)
|
44
|
+
- [Validator JSON serializer](#validator-json-serializer)
|
43
45
|
- [Truemail helpers](#truemail-helpers)
|
44
46
|
- [.valid?](#valid)
|
45
47
|
- [#as_json](#as_json)
|
@@ -51,11 +53,11 @@ Configurable framework agnostic plain Ruby email validator. Verify email via Reg
|
|
51
53
|
- [Credits](#credits)
|
52
54
|
- [Versioning](#versioning)
|
53
55
|
- [Changelog](CHANGELOG.md)
|
54
|
-
- [
|
56
|
+
- [Developers Documentation](https://truemail-rb.org/truemail-gem/)
|
55
57
|
|
56
58
|
## Synopsis
|
57
59
|
|
58
|
-
Email validation is a tricky thing. There are a number of different ways to validate an email address and all mechanisms must conform with the best practices and provide proper validation.
|
60
|
+
Email validation is a tricky thing. There are a number of different ways to validate an email address and all mechanisms must conform with the best practices and provide proper validation. The Truemail gem helps you validate emails via regex pattern, presence of DNS records, and real existence of email account on a current email server.
|
59
61
|
|
60
62
|
**Syntax Checking**: Checks the email addresses via regex pattern.
|
61
63
|
|
@@ -74,7 +76,7 @@ Also Truemail gem allows performing an audit of the host in which runs.
|
|
74
76
|
- Simple SMTP debugger
|
75
77
|
- Event logger
|
76
78
|
- Host auditor tools (helps to detect common host problems interfering to proper email verification)
|
77
|
-
- JSON
|
79
|
+
- JSON serializers
|
78
80
|
|
79
81
|
## Requirements
|
80
82
|
|
@@ -896,63 +898,6 @@ Truemail.validate('email@example.com')
|
|
896
898
|
@validation_type=:smtp>
|
897
899
|
```
|
898
900
|
|
899
|
-
### Event logger
|
900
|
-
|
901
|
-
Truemail gem allows to output tracking events to stdout/file or both of these. Please note, at least one of the outputs must exist. Tracking event by default is `:error`
|
902
|
-
|
903
|
-
```ruby
|
904
|
-
Truemail.configure do |config|
|
905
|
-
config.logger = { tracking_event: :all, stdout: true, log_absolute_path: '/home/app/log/truemail.log' }
|
906
|
-
end
|
907
|
-
```
|
908
|
-
|
909
|
-
#### Available tracking events
|
910
|
-
|
911
|
-
- `:all`, all detected events including success validation cases
|
912
|
-
- `:unrecognized_error`, unrecognized errors only (when `smtp_safe_check = true` and SMTP server does not return an exact answer that the email does not exist)
|
913
|
-
- `:recognized_error`, recognized errors only
|
914
|
-
- `:error`, recognized and unrecognized errors only
|
915
|
-
|
916
|
-
### JSON serializer
|
917
|
-
|
918
|
-
Truemail has built in JSON serializer for `Truemail::Validator` instance, so you can represent your email validation result as json.
|
919
|
-
|
920
|
-
```ruby
|
921
|
-
Truemail::Log::Serializer::Json.call(Truemail.validate('nonexistent_email@bestweb.com.ua'))
|
922
|
-
|
923
|
-
=>
|
924
|
-
# Serialized Truemail::Validator instance
|
925
|
-
{
|
926
|
-
"date": "2019-10-28 10:15:51 +0200",
|
927
|
-
"email": "nonexistent_email@bestweb.com.ua",
|
928
|
-
"validation_type": "smtp",
|
929
|
-
"success": false,
|
930
|
-
"errors": {
|
931
|
-
"smtp": "smtp error"
|
932
|
-
},
|
933
|
-
"smtp_debug": [
|
934
|
-
{
|
935
|
-
"mail_host": "213.180.193.89",
|
936
|
-
"port_opened": true,
|
937
|
-
"connection": true,
|
938
|
-
"errors": {
|
939
|
-
"rcptto": "550 5.7.1 No such user!\n"
|
940
|
-
}
|
941
|
-
}
|
942
|
-
],
|
943
|
-
"configuration": {
|
944
|
-
"validation_type_by_domain": null,
|
945
|
-
"whitelist_validation": false,
|
946
|
-
"whitelisted_domains": null,
|
947
|
-
"blacklisted_domains": null,
|
948
|
-
"not_rfc_mx_lookup_flow": false,
|
949
|
-
"smtp_safe_check": false,
|
950
|
-
"email_pattern": "default gem value",
|
951
|
-
"smtp_error_body_pattern": "default gem value"
|
952
|
-
}
|
953
|
-
}
|
954
|
-
```
|
955
|
-
|
956
901
|
### Host audit features
|
957
902
|
|
958
903
|
Truemail gem allows performing an audit of the host in which runs. It will help to detect common host problems interfering to proper email verification.
|
@@ -1004,8 +949,8 @@ Truemail.host_audit
|
|
1004
949
|
#<struct Truemail::Auditor::Result
|
1005
950
|
current_host_ip="127.0.0.1",
|
1006
951
|
warnings={
|
1007
|
-
:dns=>"
|
1008
|
-
:ptr=>"
|
952
|
+
:dns=>"A-record of verifier domain not refers to current host ip address",
|
953
|
+
:ptr=>"PTR-record does not reference to current verifier domain"
|
1009
954
|
},
|
1010
955
|
configuration=
|
1011
956
|
#<Truemail::Configuration:0x00005615e86327a8
|
@@ -1025,6 +970,91 @@ Truemail.host_audit
|
|
1025
970
|
@whitelisted_domains=[]>
|
1026
971
|
```
|
1027
972
|
|
973
|
+
### Event logger
|
974
|
+
|
975
|
+
Truemail gem allows to output tracking events to stdout/file or both of these. Please note, at least one of the outputs must exist. Tracking event by default is `:error`
|
976
|
+
|
977
|
+
```ruby
|
978
|
+
Truemail.configure do |config|
|
979
|
+
config.logger = { tracking_event: :all, stdout: true, log_absolute_path: '/home/app/log/truemail.log' }
|
980
|
+
end
|
981
|
+
```
|
982
|
+
|
983
|
+
#### Available tracking events
|
984
|
+
|
985
|
+
- `:all`, all detected events including success validation cases
|
986
|
+
- `:unrecognized_error`, unrecognized errors only (when `smtp_safe_check = true` and SMTP server does not return an exact answer that the email does not exist)
|
987
|
+
- `:recognized_error`, recognized errors only
|
988
|
+
- `:error`, recognized and unrecognized errors only
|
989
|
+
|
990
|
+
### JSON serializers
|
991
|
+
|
992
|
+
Truemail has built in JSON serializers for `Truemail::Auditor` and `Truemail::Validator` instances, so you can represent your host audition or email validation result as json. Also you can use [#as_json](#as_json) helper for shortcuting.
|
993
|
+
|
994
|
+
#### Auditor JSON serializer
|
995
|
+
|
996
|
+
```ruby
|
997
|
+
Truemail::Log::Serializer::AuditorJson.call(Truemail.host_audit)
|
998
|
+
|
999
|
+
=>
|
1000
|
+
# Serialized Truemail::Auditor instance
|
1001
|
+
{
|
1002
|
+
"date": "2020-08-31 22:33:43 +0300",
|
1003
|
+
"current_host_ip": "127.0.0.1",
|
1004
|
+
"warnings": {
|
1005
|
+
"dns": "A-record of verifier domain not refers to current host ip address", "ptr": "PTR-record does not reference to current verifier domain"
|
1006
|
+
},
|
1007
|
+
"configuration": {
|
1008
|
+
"validation_type_by_domain": null,
|
1009
|
+
"whitelist_validation": false,
|
1010
|
+
"whitelisted_domains": null,
|
1011
|
+
"blacklisted_domains": null,
|
1012
|
+
"not_rfc_mx_lookup_flow": false,
|
1013
|
+
"smtp_safe_check": false,
|
1014
|
+
"email_pattern": "default gem value",
|
1015
|
+
"smtp_error_body_pattern": "default gem value"
|
1016
|
+
}
|
1017
|
+
}
|
1018
|
+
```
|
1019
|
+
|
1020
|
+
#### Validator JSON serializer
|
1021
|
+
|
1022
|
+
```ruby
|
1023
|
+
Truemail::Log::Serializer::ValidatorJson.call(Truemail.validate('nonexistent_email@bestweb.com.ua'))
|
1024
|
+
|
1025
|
+
=>
|
1026
|
+
# Serialized Truemail::Validator instance
|
1027
|
+
{
|
1028
|
+
"date": "2019-10-28 10:15:51 +0200",
|
1029
|
+
"email": "nonexistent_email@bestweb.com.ua",
|
1030
|
+
"validation_type": "smtp",
|
1031
|
+
"success": false,
|
1032
|
+
"errors": {
|
1033
|
+
"smtp": "smtp error"
|
1034
|
+
},
|
1035
|
+
"smtp_debug": [
|
1036
|
+
{
|
1037
|
+
"mail_host": "213.180.193.89",
|
1038
|
+
"port_opened": true,
|
1039
|
+
"connection": true,
|
1040
|
+
"errors": {
|
1041
|
+
"rcptto": "550 5.7.1 No such user!\n"
|
1042
|
+
}
|
1043
|
+
}
|
1044
|
+
],
|
1045
|
+
"configuration": {
|
1046
|
+
"validation_type_by_domain": null,
|
1047
|
+
"whitelist_validation": false,
|
1048
|
+
"whitelisted_domains": null,
|
1049
|
+
"blacklisted_domains": null,
|
1050
|
+
"not_rfc_mx_lookup_flow": false,
|
1051
|
+
"smtp_safe_check": false,
|
1052
|
+
"email_pattern": "default gem value",
|
1053
|
+
"smtp_error_body_pattern": "default gem value"
|
1054
|
+
}
|
1055
|
+
}
|
1056
|
+
```
|
1057
|
+
|
1028
1058
|
### Truemail helpers
|
1029
1059
|
|
1030
1060
|
#### .valid?
|
@@ -1039,9 +1069,32 @@ Truemail.valid?('email@example.com')
|
|
1039
1069
|
|
1040
1070
|
#### #as_json
|
1041
1071
|
|
1042
|
-
You can use `#as_json` helper for represent `Truemail::Validator`
|
1072
|
+
You can use `#as_json` helper for represent `Truemail::Auditor` or `Truemail::Validator` instances as json. Under the hood it uses internal json `Truemail::Log::Serializer::AuditorJson` and `Truemail::Log::Serializer::ValidatorJson` [serializers](#json-serializers):
|
1043
1073
|
|
1044
1074
|
```ruby
|
1075
|
+
Truemail.host_audit.as_json
|
1076
|
+
|
1077
|
+
=>
|
1078
|
+
# Serialized Truemail::Auditor instance
|
1079
|
+
{
|
1080
|
+
"date": "2020-08-31 22:33:43 +0300",
|
1081
|
+
"current_host_ip": "127.0.0.1",
|
1082
|
+
"warnings": {
|
1083
|
+
"dns": "A-record of verifier domain not refers to current host ip address", "ptr": "PTR-record does not reference to current verifier domain"
|
1084
|
+
},
|
1085
|
+
"configuration": {
|
1086
|
+
"validation_type_by_domain": null,
|
1087
|
+
"whitelist_validation": false,
|
1088
|
+
"whitelisted_domains": null,
|
1089
|
+
"blacklisted_domains": null,
|
1090
|
+
"not_rfc_mx_lookup_flow": false,
|
1091
|
+
"smtp_safe_check": false,
|
1092
|
+
"email_pattern": "default gem value",
|
1093
|
+
"smtp_error_body_pattern": "default gem value"
|
1094
|
+
}
|
1095
|
+
}
|
1096
|
+
|
1097
|
+
|
1045
1098
|
Truemail.validate('nonexistent_email@bestweb.com.ua').as_json
|
1046
1099
|
|
1047
1100
|
=>
|
@@ -1112,15 +1165,15 @@ end
|
|
1112
1165
|
|
1113
1166
|
## Truemail family
|
1114
1167
|
|
1115
|
-
All Truemail
|
1168
|
+
All Truemail solutions: https://truemail-rb.org
|
1116
1169
|
|
1117
1170
|
| Name | Type | Description |
|
1118
1171
|
| --- | --- | --- |
|
1119
|
-
| [truemail server](https://github.com/truemail-rb/truemail-rack) | ruby app | Lightweight rack based web API wrapper for Truemail |
|
1172
|
+
| [truemail server](https://github.com/truemail-rb/truemail-rack) | ruby app | Lightweight rack based web API wrapper for Truemail gem |
|
1120
1173
|
| [truemail-rack-docker](https://github.com/truemail-rb/truemail-rack-docker-image) | docker image | Lightweight rack based web API [dockerized image](https://hub.docker.com/r/truemail/truemail-rack) :whale: of Truemail server |
|
1121
|
-
| [truemail-ruby-client](https://github.com/truemail-rb/truemail-ruby-client) | ruby gem |
|
1122
|
-
| [truemail-crystal-client](https://github.com/truemail-rb/truemail-crystal-client) | crystal shard |
|
1123
|
-
| [truemail-rspec](https://github.com/truemail-rb/truemail-rspec) | ruby gem | Truemail configuration and validator RSpec helpers |
|
1174
|
+
| [truemail-ruby-client](https://github.com/truemail-rb/truemail-ruby-client) | ruby gem | Web API Ruby client for Truemail Server |
|
1175
|
+
| [truemail-crystal-client](https://github.com/truemail-rb/truemail-crystal-client) | crystal shard | Web API Crystal client for Truemail Server |
|
1176
|
+
| [truemail-rspec](https://github.com/truemail-rb/truemail-rspec) | ruby gem | Truemail configuration, auditor and validator RSpec helpers |
|
1124
1177
|
|
1125
1178
|
## Contributing
|
1126
1179
|
|
@@ -1142,8 +1195,3 @@ Everyone interacting in the Truemail project’s codebases, issue trackers, chat
|
|
1142
1195
|
## Versioning
|
1143
1196
|
|
1144
1197
|
Truemail uses [Semantic Versioning 2.0.0](https://semver.org)
|
1145
|
-
|
1146
|
-
---
|
1147
|
-
<a href="https://rubygarage.org/"><img src="https://rubygarage.s3.amazonaws.com/assets/assets/rg_color_logo_horizontal-919afc51a81d2e40cb6a0b43ee832e3fcd49669d06785156d2d16fd0d799f89e.png" alt="RubyGarage Logo" width="415" height="128"></a>
|
1148
|
-
|
1149
|
-
RubyGarage is a leading software development and consulting company in Eastern Europe. Our main expertise includes Ruby and Ruby on Rails, but we successfully employ other technologies to deliver the best results to our clients. [Check out our portfolio](https://rubygarage.org/portfolio) for even more exciting works!
|
data/lib/truemail/audit/dns.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Truemail
|
4
4
|
module Audit
|
5
5
|
class Dns < Truemail::Audit::Base
|
6
|
-
VERIFIER_DOMAIN_NOT_REFER = '
|
6
|
+
VERIFIER_DOMAIN_NOT_REFER = 'A-record of verifier domain not refers to current host ip address'
|
7
7
|
|
8
8
|
def run
|
9
9
|
return if verifier_domain_refer_to_current_host_ip?
|
data/lib/truemail/audit/ptr.rb
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
module Truemail
|
4
4
|
module Audit
|
5
5
|
class Ptr < Truemail::Audit::Base
|
6
|
-
PTR_NOT_FOUND = '
|
7
|
-
PTR_NOT_REFER = '
|
6
|
+
PTR_NOT_FOUND = 'PTR-record for current host ip address was not found'
|
7
|
+
PTR_NOT_REFER = 'PTR-record does not reference to current verifier domain'
|
8
8
|
|
9
9
|
def run
|
10
10
|
return add_warning(Truemail::Audit::Ptr::PTR_NOT_FOUND) if ptr_records.empty?
|
data/lib/truemail/auditor.rb
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Truemail
|
4
|
-
class Auditor
|
4
|
+
class Auditor < Truemail::Executor
|
5
5
|
Result = Struct.new(:current_host_ip, :warnings, :configuration, keyword_init: true) do
|
6
6
|
def initialize(warnings: {}, **args)
|
7
7
|
super
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
attr_reader :result
|
12
|
-
|
13
11
|
def initialize(configuration:)
|
14
12
|
@result = Truemail::Auditor::Result.new(configuration: configuration)
|
15
13
|
end
|
@@ -18,5 +16,9 @@ module Truemail
|
|
18
16
|
Truemail::Audit::Ip.check(result)
|
19
17
|
self
|
20
18
|
end
|
19
|
+
|
20
|
+
def as_json
|
21
|
+
Truemail::Log::Serializer::AuditorJson.call(self)
|
22
|
+
end
|
21
23
|
end
|
22
24
|
end
|
@@ -109,7 +109,7 @@ module Truemail
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def validate_arguments(argument, method)
|
112
|
-
constant = Truemail::RegexConstant.const_get("regex_#{method[/\A.+_(.+)
|
112
|
+
constant = Truemail::RegexConstant.const_get("regex_#{method[/\A.+_(.+)=\z/, 1]}_pattern".upcase)
|
113
113
|
raise_unless(argument, method, constant.match?(argument.to_s))
|
114
114
|
end
|
115
115
|
|
data/lib/truemail/core.rb
CHANGED
@@ -4,6 +4,7 @@ module Truemail
|
|
4
4
|
require_relative '../truemail/version'
|
5
5
|
require_relative '../truemail/configuration'
|
6
6
|
require_relative '../truemail/worker'
|
7
|
+
require_relative '../truemail/executor'
|
7
8
|
require_relative '../truemail/wrapper'
|
8
9
|
require_relative '../truemail/auditor'
|
9
10
|
require_relative '../truemail/validator'
|
@@ -29,8 +30,8 @@ module Truemail
|
|
29
30
|
end
|
30
31
|
|
31
32
|
module RegexConstant
|
32
|
-
REGEX_DOMAIN = /[\p{L}0-9]+([
|
33
|
-
REGEX_EMAIL_PATTERN = /(?=\A.{6,255}\z)(\A([\p{L}0-9]+[\w
|
33
|
+
REGEX_DOMAIN = /[\p{L}0-9]+([\-.]{1}[\p{L}0-9]+)*\.\p{L}{2,63}/i.freeze
|
34
|
+
REGEX_EMAIL_PATTERN = /(?=\A.{6,255}\z)(\A([\p{L}0-9]+[\w|\-|.|+]*)@(#{REGEX_DOMAIN})\z)/.freeze
|
34
35
|
REGEX_DOMAIN_PATTERN = /(?=\A.{4,255}\z)(\A#{REGEX_DOMAIN}\z)/.freeze
|
35
36
|
REGEX_DOMAIN_FROM_EMAIL = /\A.+@(.+)\z/.freeze
|
36
37
|
REGEX_SMTP_ERROR_BODY_PATTERN = /(?=.*550)(?=.*(user|account|customer|mailbox)).*/i.freeze
|
@@ -56,7 +57,9 @@ module Truemail
|
|
56
57
|
module Log
|
57
58
|
require_relative '../truemail/log/event'
|
58
59
|
require_relative '../truemail/log/serializer/base'
|
59
|
-
require_relative '../truemail/log/serializer/
|
60
|
-
require_relative '../truemail/log/serializer/
|
60
|
+
require_relative '../truemail/log/serializer/auditor_json'
|
61
|
+
require_relative '../truemail/log/serializer/validator_base'
|
62
|
+
require_relative '../truemail/log/serializer/validator_text'
|
63
|
+
require_relative '../truemail/log/serializer/validator_json'
|
61
64
|
end
|
62
65
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Truemail
|
4
|
+
module Log
|
5
|
+
module Serializer
|
6
|
+
class AuditorJson < Truemail::Log::Serializer::Base
|
7
|
+
def serialize
|
8
|
+
result.to_json
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def result
|
14
|
+
@result ||=
|
15
|
+
{
|
16
|
+
date: Time.now,
|
17
|
+
current_host_ip: executor_result.current_host_ip,
|
18
|
+
warnings: warnings(executor_result.warnings),
|
19
|
+
configuration: configuration
|
20
|
+
}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -4,47 +4,35 @@ module Truemail
|
|
4
4
|
module Log
|
5
5
|
module Serializer
|
6
6
|
class Base
|
7
|
+
require 'json'
|
8
|
+
|
7
9
|
DEFAULT_GEM_VALUE = 'default gem value'
|
8
10
|
|
9
|
-
def self.call(
|
10
|
-
new(
|
11
|
+
def self.call(executor_instance)
|
12
|
+
new(executor_instance).serialize
|
11
13
|
end
|
12
14
|
|
13
|
-
def initialize(
|
14
|
-
@
|
15
|
-
@
|
16
|
-
@validation_configuration = validation_result.configuration
|
15
|
+
def initialize(executor_instance)
|
16
|
+
@executor_result = executor_instance.result
|
17
|
+
@executor_configuration = executor_result.configuration
|
17
18
|
end
|
18
19
|
|
19
20
|
def serialize; end
|
20
21
|
|
21
22
|
private
|
22
23
|
|
23
|
-
attr_reader :
|
24
|
+
attr_reader :executor_result, :executor_configuration
|
24
25
|
|
25
|
-
def errors
|
26
|
-
|
27
|
-
|
28
|
-
validation_errors
|
26
|
+
def errors(executor_result_target)
|
27
|
+
return if executor_result_target.empty?
|
28
|
+
executor_result_target
|
29
29
|
end
|
30
30
|
|
31
|
-
|
32
|
-
validation_smtp_debug = validation_result.smtp_debug
|
33
|
-
return unless validation_smtp_debug
|
34
|
-
validation_smtp_debug.map do |smtp_request|
|
35
|
-
smtp_response = smtp_request.response
|
36
|
-
{
|
37
|
-
mail_host: smtp_request.host,
|
38
|
-
port_opened: smtp_response.port_opened,
|
39
|
-
connection: smtp_response.connection,
|
40
|
-
errors: smtp_response.errors
|
41
|
-
}
|
42
|
-
end
|
43
|
-
end
|
31
|
+
alias warnings errors
|
44
32
|
|
45
33
|
%i[validation_type_by_domain whitelisted_domains blacklisted_domains].each do |method|
|
46
34
|
define_method(method) do
|
47
|
-
value =
|
35
|
+
value = executor_configuration.public_send(method)
|
48
36
|
return if value.empty?
|
49
37
|
value
|
50
38
|
end
|
@@ -52,7 +40,7 @@ module Truemail
|
|
52
40
|
|
53
41
|
%i[email_pattern smtp_error_body_pattern].each do |method|
|
54
42
|
define_method(method) do
|
55
|
-
value =
|
43
|
+
value = executor_configuration.public_send(method)
|
56
44
|
default_pattern = Truemail::RegexConstant.const_get(
|
57
45
|
(method.eql?(:email_pattern) ? :regex_email_pattern : :regex_smtp_error_body_pattern).upcase
|
58
46
|
)
|
@@ -64,28 +52,15 @@ module Truemail
|
|
64
52
|
def configuration
|
65
53
|
{
|
66
54
|
validation_type_by_domain: validation_type_by_domain,
|
67
|
-
whitelist_validation:
|
55
|
+
whitelist_validation: executor_configuration.whitelist_validation,
|
68
56
|
whitelisted_domains: whitelisted_domains,
|
69
57
|
blacklisted_domains: blacklisted_domains,
|
70
|
-
not_rfc_mx_lookup_flow:
|
71
|
-
smtp_safe_check:
|
58
|
+
not_rfc_mx_lookup_flow: executor_configuration.not_rfc_mx_lookup_flow,
|
59
|
+
smtp_safe_check: executor_configuration.smtp_safe_check,
|
72
60
|
email_pattern: email_pattern,
|
73
61
|
smtp_error_body_pattern: smtp_error_body_pattern
|
74
62
|
}
|
75
63
|
end
|
76
|
-
|
77
|
-
def result
|
78
|
-
@result ||=
|
79
|
-
{
|
80
|
-
date: Time.now,
|
81
|
-
email: validation_result.email,
|
82
|
-
validation_type: validation_type,
|
83
|
-
success: validation_result.success,
|
84
|
-
errors: errors,
|
85
|
-
smtp_debug: smtp_debug,
|
86
|
-
configuration: configuration
|
87
|
-
}
|
88
|
-
end
|
89
64
|
end
|
90
65
|
end
|
91
66
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Truemail
|
4
|
+
module Log
|
5
|
+
module Serializer
|
6
|
+
class ValidatorBase < Truemail::Log::Serializer::Base
|
7
|
+
def initialize(executor_instance)
|
8
|
+
@validation_type = executor_instance.validation_type
|
9
|
+
super
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
attr_reader :validation_type
|
15
|
+
|
16
|
+
def smtp_debug
|
17
|
+
validation_smtp_debug = executor_result.smtp_debug
|
18
|
+
return unless validation_smtp_debug
|
19
|
+
validation_smtp_debug.map do |smtp_request|
|
20
|
+
smtp_response = smtp_request.response
|
21
|
+
{
|
22
|
+
mail_host: smtp_request.host,
|
23
|
+
port_opened: smtp_response.port_opened,
|
24
|
+
connection: smtp_response.connection,
|
25
|
+
errors: smtp_response.errors
|
26
|
+
}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def result
|
31
|
+
@result ||=
|
32
|
+
{
|
33
|
+
date: Time.now,
|
34
|
+
email: executor_result.email,
|
35
|
+
validation_type: validation_type,
|
36
|
+
success: executor_result.success,
|
37
|
+
errors: errors(executor_result.errors),
|
38
|
+
smtp_debug: smtp_debug,
|
39
|
+
configuration: configuration
|
40
|
+
}
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Truemail
|
4
4
|
module Log
|
5
5
|
module Serializer
|
6
|
-
class
|
6
|
+
class ValidatorText < Truemail::Log::Serializer::ValidatorBase
|
7
7
|
ATTEMPT = 'ATTEMPT #'
|
8
8
|
|
9
9
|
def serialize
|
@@ -30,7 +30,7 @@ module Truemail
|
|
30
30
|
|
31
31
|
def collection_printer(collection)
|
32
32
|
collection.inject([]) { |array, hash| array << printer(hash) }.map.with_index do |item, index|
|
33
|
-
"\n#{Truemail::Log::Serializer::
|
33
|
+
"\n#{Truemail::Log::Serializer::ValidatorText::ATTEMPT}#{index + 1}:\n#{item}\n"
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
data/lib/truemail/logger.rb
CHANGED
@@ -15,7 +15,7 @@ module Truemail
|
|
15
15
|
def push(validator_instance)
|
16
16
|
current_event = Truemail::Log::Event.new(event, validator_instance)
|
17
17
|
return unless current_event.valid?
|
18
|
-
create_logs(current_event.log_level, Truemail::Log::Serializer::
|
18
|
+
create_logs(current_event.log_level, Truemail::Log::Serializer::ValidatorText.call(validator_instance))
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
data/lib/truemail/validator.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Truemail
|
4
|
-
class Validator
|
4
|
+
class Validator < Truemail::Executor
|
5
5
|
RESULT_ATTRS = %i[success email domain mail_servers errors smtp_debug configuration].freeze
|
6
6
|
VALIDATION_TYPES = %i[regex mx smtp].freeze
|
7
7
|
|
@@ -16,7 +16,7 @@ module Truemail
|
|
16
16
|
alias_method :valid?, :success
|
17
17
|
end
|
18
18
|
|
19
|
-
attr_reader :validation_type
|
19
|
+
attr_reader :validation_type
|
20
20
|
|
21
21
|
def initialize(email, with: nil, configuration:)
|
22
22
|
with ||= configuration.default_validation_type
|
@@ -33,7 +33,7 @@ module Truemail
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def as_json
|
36
|
-
Truemail::Log::Serializer::
|
36
|
+
Truemail::Log::Serializer::ValidatorJson.call(self)
|
37
37
|
end
|
38
38
|
|
39
39
|
private
|
data/lib/truemail/version.rb
CHANGED
data/truemail.gemspec
CHANGED
@@ -16,6 +16,14 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.homepage = 'https://github.com/rubygarage/truemail'
|
17
17
|
spec.license = 'MIT'
|
18
18
|
|
19
|
+
spec.metadata = {
|
20
|
+
'homepage_uri' => 'https://truemail-rb.org',
|
21
|
+
'changelog_uri' => 'https://github.com/rubygarage/truemail/blob/master/CHANGELOG.md',
|
22
|
+
'source_code_uri' => 'https://github.com/rubygarage/truemail',
|
23
|
+
'documentation_uri' => 'https://truemail-rb.org/truemail-gem/',
|
24
|
+
'bug_tracker_uri' => 'https://github.com/rubygarage/truemail/issues'
|
25
|
+
}
|
26
|
+
|
19
27
|
spec.required_ruby_version = '>= 2.5.0'
|
20
28
|
|
21
29
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
@@ -26,18 +34,18 @@ Gem::Specification.new do |spec|
|
|
26
34
|
spec.add_runtime_dependency 'simpleidn', '~> 0.1.1'
|
27
35
|
|
28
36
|
spec.add_development_dependency 'bundler', '~> 1.16'
|
29
|
-
spec.add_development_dependency 'bundler-audit', '~> 0.
|
37
|
+
spec.add_development_dependency 'bundler-audit', '~> 0.7.0.1'
|
30
38
|
spec.add_development_dependency 'fasterer', '~> 0.8.3'
|
31
|
-
spec.add_development_dependency 'ffaker', '~> 2.
|
39
|
+
spec.add_development_dependency 'ffaker', '~> 2.17'
|
32
40
|
spec.add_development_dependency 'json_matchers', '~> 0.11.1'
|
33
|
-
spec.add_development_dependency 'overcommit', '~> 0.
|
41
|
+
spec.add_development_dependency 'overcommit', '~> 0.55.0'
|
34
42
|
spec.add_development_dependency 'pry-byebug', '~> 3.9'
|
35
43
|
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.1'
|
36
|
-
spec.add_development_dependency 'reek', '~> 6.0'
|
44
|
+
spec.add_development_dependency 'reek', '~> 6.0', '>= 6.0.1'
|
37
45
|
spec.add_development_dependency 'rspec', '~> 3.9'
|
38
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
39
|
-
spec.add_development_dependency 'rubocop-performance', '~> 1.
|
40
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 1.
|
46
|
+
spec.add_development_dependency 'rubocop', '~> 0.89.1'
|
47
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.7', '>= 1.7.1'
|
48
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 1.43', '>= 1.43.2'
|
41
49
|
spec.add_development_dependency 'simplecov', '~> 0.17.1'
|
42
|
-
spec.add_development_dependency 'truemail-rspec', '~> 0.
|
50
|
+
spec.add_development_dependency 'truemail-rspec', '~> 0.2.0'
|
43
51
|
end
|
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.
|
4
|
+
version: 1.9.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: 2020-
|
11
|
+
date: 2020-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simpleidn
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.7.0.1
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.7.0.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: fasterer
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '2.
|
75
|
+
version: '2.17'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '2.
|
82
|
+
version: '2.17'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: json_matchers
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
103
|
+
version: 0.55.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
110
|
+
version: 0.55.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: pry-byebug
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -149,6 +149,9 @@ dependencies:
|
|
149
149
|
- - "~>"
|
150
150
|
- !ruby/object:Gem::Version
|
151
151
|
version: '6.0'
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: 6.0.1
|
152
155
|
type: :development
|
153
156
|
prerelease: false
|
154
157
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -156,6 +159,9 @@ dependencies:
|
|
156
159
|
- - "~>"
|
157
160
|
- !ruby/object:Gem::Version
|
158
161
|
version: '6.0'
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: 6.0.1
|
159
165
|
- !ruby/object:Gem::Dependency
|
160
166
|
name: rspec
|
161
167
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,48 +182,54 @@ dependencies:
|
|
176
182
|
requirements:
|
177
183
|
- - "~>"
|
178
184
|
- !ruby/object:Gem::Version
|
179
|
-
version: 0.
|
185
|
+
version: 0.89.1
|
180
186
|
type: :development
|
181
187
|
prerelease: false
|
182
188
|
version_requirements: !ruby/object:Gem::Requirement
|
183
189
|
requirements:
|
184
190
|
- - "~>"
|
185
191
|
- !ruby/object:Gem::Version
|
186
|
-
version: 0.
|
192
|
+
version: 0.89.1
|
187
193
|
- !ruby/object:Gem::Dependency
|
188
194
|
name: rubocop-performance
|
189
195
|
requirement: !ruby/object:Gem::Requirement
|
190
196
|
requirements:
|
191
197
|
- - "~>"
|
192
198
|
- !ruby/object:Gem::Version
|
193
|
-
version: '1.
|
199
|
+
version: '1.7'
|
194
200
|
- - ">="
|
195
201
|
- !ruby/object:Gem::Version
|
196
|
-
version: 1.
|
202
|
+
version: 1.7.1
|
197
203
|
type: :development
|
198
204
|
prerelease: false
|
199
205
|
version_requirements: !ruby/object:Gem::Requirement
|
200
206
|
requirements:
|
201
207
|
- - "~>"
|
202
208
|
- !ruby/object:Gem::Version
|
203
|
-
version: '1.
|
209
|
+
version: '1.7'
|
204
210
|
- - ">="
|
205
211
|
- !ruby/object:Gem::Version
|
206
|
-
version: 1.
|
212
|
+
version: 1.7.1
|
207
213
|
- !ruby/object:Gem::Dependency
|
208
214
|
name: rubocop-rspec
|
209
215
|
requirement: !ruby/object:Gem::Requirement
|
210
216
|
requirements:
|
211
217
|
- - "~>"
|
212
218
|
- !ruby/object:Gem::Version
|
213
|
-
version: '1.
|
219
|
+
version: '1.43'
|
220
|
+
- - ">="
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: 1.43.2
|
214
223
|
type: :development
|
215
224
|
prerelease: false
|
216
225
|
version_requirements: !ruby/object:Gem::Requirement
|
217
226
|
requirements:
|
218
227
|
- - "~>"
|
219
228
|
- !ruby/object:Gem::Version
|
220
|
-
version: '1.
|
229
|
+
version: '1.43'
|
230
|
+
- - ">="
|
231
|
+
- !ruby/object:Gem::Version
|
232
|
+
version: 1.43.2
|
221
233
|
- !ruby/object:Gem::Dependency
|
222
234
|
name: simplecov
|
223
235
|
requirement: !ruby/object:Gem::Requirement
|
@@ -238,14 +250,14 @@ dependencies:
|
|
238
250
|
requirements:
|
239
251
|
- - "~>"
|
240
252
|
- !ruby/object:Gem::Version
|
241
|
-
version: 0.
|
253
|
+
version: 0.2.0
|
242
254
|
type: :development
|
243
255
|
prerelease: false
|
244
256
|
version_requirements: !ruby/object:Gem::Requirement
|
245
257
|
requirements:
|
246
258
|
- - "~>"
|
247
259
|
- !ruby/object:Gem::Version
|
248
|
-
version: 0.
|
260
|
+
version: 0.2.0
|
249
261
|
description: Configurable framework agnostic plain Ruby email validator. Verify email
|
250
262
|
via Regex, DNS and SMTP.
|
251
263
|
email:
|
@@ -283,10 +295,13 @@ files:
|
|
283
295
|
- lib/truemail/auditor.rb
|
284
296
|
- lib/truemail/configuration.rb
|
285
297
|
- lib/truemail/core.rb
|
298
|
+
- lib/truemail/executor.rb
|
286
299
|
- lib/truemail/log/event.rb
|
300
|
+
- lib/truemail/log/serializer/auditor_json.rb
|
287
301
|
- lib/truemail/log/serializer/base.rb
|
288
|
-
- lib/truemail/log/serializer/
|
289
|
-
- lib/truemail/log/serializer/
|
302
|
+
- lib/truemail/log/serializer/validator_base.rb
|
303
|
+
- lib/truemail/log/serializer/validator_json.rb
|
304
|
+
- lib/truemail/log/serializer/validator_text.rb
|
290
305
|
- lib/truemail/logger.rb
|
291
306
|
- lib/truemail/validate/base.rb
|
292
307
|
- lib/truemail/validate/domain_list_match.rb
|
@@ -303,7 +318,12 @@ files:
|
|
303
318
|
homepage: https://github.com/rubygarage/truemail
|
304
319
|
licenses:
|
305
320
|
- MIT
|
306
|
-
metadata:
|
321
|
+
metadata:
|
322
|
+
homepage_uri: https://truemail-rb.org
|
323
|
+
changelog_uri: https://github.com/rubygarage/truemail/blob/master/CHANGELOG.md
|
324
|
+
source_code_uri: https://github.com/rubygarage/truemail
|
325
|
+
documentation_uri: https://truemail-rb.org/truemail-gem/
|
326
|
+
bug_tracker_uri: https://github.com/rubygarage/truemail/issues
|
307
327
|
post_install_message:
|
308
328
|
rdoc_options: []
|
309
329
|
require_paths:
|