truemail 1.6.1 → 1.9.1
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 +5 -0
- data/.rubocop.yml +177 -6
- data/CHANGELOG.md +241 -1
- data/Gemfile.lock +55 -68
- data/LICENSE.txt +1 -1
- data/README.md +237 -90
- data/lib/truemail.rb +1 -1
- data/lib/truemail/audit/base.rb +8 -0
- data/lib/truemail/audit/dns.rb +26 -0
- data/lib/truemail/audit/ip.rb +28 -0
- data/lib/truemail/audit/ptr.rb +8 -37
- data/lib/truemail/auditor.rb +7 -5
- data/lib/truemail/configuration.rb +10 -3
- data/lib/truemail/core.rb +27 -22
- 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 -41
- 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/validate/mx.rb +1 -0
- data/lib/truemail/validator.rb +4 -4
- data/lib/truemail/version.rb +1 -1
- data/truemail.gemspec +17 -9
- metadata +48 -32
@@ -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/validate/mx.rb
CHANGED
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,9 +16,9 @@ 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
|
-
def initialize(email, with: nil
|
21
|
+
def initialize(email, configuration:, with: nil)
|
22
22
|
with ||= configuration.default_validation_type
|
23
23
|
raise Truemail::ArgumentError.new(with, :argument) unless Truemail::Validator::VALIDATION_TYPES.include?(with)
|
24
24
|
@result = Truemail::Validator::Result.new(email: email, configuration: configuration)
|
@@ -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.
|
30
|
-
spec.add_development_dependency 'fasterer', '~> 0.8.
|
31
|
-
spec.add_development_dependency 'ffaker', '~> 2.
|
37
|
+
spec.add_development_dependency 'bundler-audit', '~> 0.7.0.1'
|
38
|
+
spec.add_development_dependency 'fasterer', '~> 0.8.3'
|
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', '~>
|
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.91.0'
|
47
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.8', '>= 1.8.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.1'
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladislav Trotsenko
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simpleidn
|
@@ -44,42 +44,42 @@ 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
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.8.
|
61
|
+
version: 0.8.3
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.8.
|
68
|
+
version: 0.8.3
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: ffaker
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
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
|
@@ -148,14 +148,20 @@ dependencies:
|
|
148
148
|
requirements:
|
149
149
|
- - "~>"
|
150
150
|
- !ruby/object:Gem::Version
|
151
|
-
version: '
|
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
|
155
158
|
requirements:
|
156
159
|
- - "~>"
|
157
160
|
- !ruby/object:Gem::Version
|
158
|
-
version: '
|
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,54 +182,54 @@ dependencies:
|
|
176
182
|
requirements:
|
177
183
|
- - "~>"
|
178
184
|
- !ruby/object:Gem::Version
|
179
|
-
version: 0.
|
185
|
+
version: 0.91.0
|
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.91.0
|
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.8'
|
194
200
|
- - ">="
|
195
201
|
- !ruby/object:Gem::Version
|
196
|
-
version: 1.
|
202
|
+
version: 1.8.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.8'
|
204
210
|
- - ">="
|
205
211
|
- !ruby/object:Gem::Version
|
206
|
-
version: 1.
|
212
|
+
version: 1.8.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'
|
214
220
|
- - ">="
|
215
221
|
- !ruby/object:Gem::Version
|
216
|
-
version: 1.
|
222
|
+
version: 1.43.2
|
217
223
|
type: :development
|
218
224
|
prerelease: false
|
219
225
|
version_requirements: !ruby/object:Gem::Requirement
|
220
226
|
requirements:
|
221
227
|
- - "~>"
|
222
228
|
- !ruby/object:Gem::Version
|
223
|
-
version: '1.
|
229
|
+
version: '1.43'
|
224
230
|
- - ">="
|
225
231
|
- !ruby/object:Gem::Version
|
226
|
-
version: 1.
|
232
|
+
version: 1.43.2
|
227
233
|
- !ruby/object:Gem::Dependency
|
228
234
|
name: simplecov
|
229
235
|
requirement: !ruby/object:Gem::Requirement
|
@@ -244,14 +250,14 @@ dependencies:
|
|
244
250
|
requirements:
|
245
251
|
- - "~>"
|
246
252
|
- !ruby/object:Gem::Version
|
247
|
-
version: 0.
|
253
|
+
version: 0.2.1
|
248
254
|
type: :development
|
249
255
|
prerelease: false
|
250
256
|
version_requirements: !ruby/object:Gem::Requirement
|
251
257
|
requirements:
|
252
258
|
- - "~>"
|
253
259
|
- !ruby/object:Gem::Version
|
254
|
-
version: 0.
|
260
|
+
version: 0.2.1
|
255
261
|
description: Configurable framework agnostic plain Ruby email validator. Verify email
|
256
262
|
via Regex, DNS and SMTP.
|
257
263
|
email:
|
@@ -283,14 +289,19 @@ files:
|
|
283
289
|
- bin/setup
|
284
290
|
- lib/truemail.rb
|
285
291
|
- lib/truemail/audit/base.rb
|
292
|
+
- lib/truemail/audit/dns.rb
|
293
|
+
- lib/truemail/audit/ip.rb
|
286
294
|
- lib/truemail/audit/ptr.rb
|
287
295
|
- lib/truemail/auditor.rb
|
288
296
|
- lib/truemail/configuration.rb
|
289
297
|
- lib/truemail/core.rb
|
298
|
+
- lib/truemail/executor.rb
|
290
299
|
- lib/truemail/log/event.rb
|
300
|
+
- lib/truemail/log/serializer/auditor_json.rb
|
291
301
|
- lib/truemail/log/serializer/base.rb
|
292
|
-
- lib/truemail/log/serializer/
|
293
|
-
- 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
|
294
305
|
- lib/truemail/logger.rb
|
295
306
|
- lib/truemail/validate/base.rb
|
296
307
|
- lib/truemail/validate/domain_list_match.rb
|
@@ -307,8 +318,13 @@ files:
|
|
307
318
|
homepage: https://github.com/rubygarage/truemail
|
308
319
|
licenses:
|
309
320
|
- MIT
|
310
|
-
metadata:
|
311
|
-
|
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
|
327
|
+
post_install_message:
|
312
328
|
rdoc_options: []
|
313
329
|
require_paths:
|
314
330
|
- lib
|
@@ -323,9 +339,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
323
339
|
- !ruby/object:Gem::Version
|
324
340
|
version: '0'
|
325
341
|
requirements: []
|
326
|
-
rubyforge_project:
|
327
|
-
rubygems_version: 2.7.
|
328
|
-
signing_key:
|
342
|
+
rubyforge_project:
|
343
|
+
rubygems_version: 2.7.3
|
344
|
+
signing_key:
|
329
345
|
specification_version: 4
|
330
346
|
summary: truemail
|
331
347
|
test_files: []
|