truemail 2.2.3 → 2.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +26 -3
- data/.codeclimate.yml +1 -1
- data/.reek.yml +7 -0
- data/.rubocop.yml +30 -0
- data/CHANGELOG.md +67 -1
- data/Gemfile.lock +46 -33
- data/LICENSE.txt +1 -1
- data/README.md +49 -20
- data/bin/console +3 -10
- data/lib/truemail.rb +1 -1
- data/lib/truemail/audit/base.rb +0 -1
- data/lib/truemail/audit/dns.rb +1 -1
- data/lib/truemail/audit/ip.rb +1 -1
- data/lib/truemail/audit/ptr.rb +4 -3
- data/lib/truemail/auditor.rb +1 -1
- data/lib/truemail/configuration.rb +38 -30
- data/lib/truemail/core.rb +11 -15
- data/lib/truemail/dns/punycode_representer.rb +16 -0
- data/lib/truemail/dns/resolver.rb +17 -0
- data/lib/truemail/dns/worker.rb +52 -0
- data/lib/truemail/log/serializer/auditor_json.rb +1 -1
- data/lib/truemail/log/serializer/base.rb +2 -1
- data/lib/truemail/log/serializer/validator_base.rb +1 -1
- data/lib/truemail/log/serializer/validator_text.rb +2 -2
- data/lib/truemail/logger.rb +1 -1
- data/lib/truemail/validate/mx.rb +7 -9
- data/lib/truemail/validate/smtp/request.rb +3 -3
- data/lib/truemail/validate/smtp/response.rb +1 -1
- data/lib/truemail/validator.rb +2 -2
- data/lib/truemail/version.rb +1 -1
- data/lib/truemail/wrapper.rb +3 -3
- data/truemail.gemspec +10 -8
- metadata +62 -25
@@ -23,14 +23,14 @@ module Truemail
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def check_port
|
26
|
-
response.port_opened = Socket.tcp(
|
26
|
+
response.port_opened = ::Socket.tcp(
|
27
27
|
host,
|
28
28
|
Truemail::Validate::Smtp::Request::SMTP_PORT,
|
29
29
|
connect_timeout: configuration.connection_timeout,
|
30
30
|
&port_open_status
|
31
31
|
)
|
32
32
|
rescue => error
|
33
|
-
retry if attempts_exist? && error.is_a?(Errno::ETIMEDOUT)
|
33
|
+
retry if attempts_exist? && error.is_a?(::Errno::ETIMEDOUT)
|
34
34
|
response.port_opened = false
|
35
35
|
end
|
36
36
|
|
@@ -65,7 +65,7 @@ module Truemail
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def session
|
68
|
-
Net::SMTP.new(host, Truemail::Validate::Smtp::Request::SMTP_PORT).tap do |settings|
|
68
|
+
::Net::SMTP.new(host, Truemail::Validate::Smtp::Request::SMTP_PORT).tap do |settings|
|
69
69
|
settings.open_timeout = configuration.connection_timeout
|
70
70
|
settings.read_timeout = configuration.response_timeout
|
71
71
|
end
|
@@ -5,7 +5,7 @@ module Truemail
|
|
5
5
|
class Smtp
|
6
6
|
RESPONSE_ATTRS = %i[port_opened connection helo mailfrom rcptto errors].freeze
|
7
7
|
|
8
|
-
Response = Struct.new(*RESPONSE_ATTRS, keyword_init: true) do
|
8
|
+
Response = ::Struct.new(*RESPONSE_ATTRS, keyword_init: true) do
|
9
9
|
def initialize(errors: {}, **args)
|
10
10
|
super
|
11
11
|
end
|
data/lib/truemail/validator.rb
CHANGED
@@ -5,13 +5,13 @@ module Truemail
|
|
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
|
|
8
|
-
Result = Struct.new(*RESULT_ATTRS, keyword_init: true) do
|
8
|
+
Result = ::Struct.new(*RESULT_ATTRS, keyword_init: true) do
|
9
9
|
def initialize(mail_servers: [], errors: {}, **args)
|
10
10
|
super
|
11
11
|
end
|
12
12
|
|
13
13
|
def punycode_email
|
14
|
-
@punycode_email ||= Truemail::PunycodeRepresenter.call(email)
|
14
|
+
@punycode_email ||= Truemail::Dns::PunycodeRepresenter.call(email)
|
15
15
|
end
|
16
16
|
alias_method :valid?, :success
|
17
17
|
end
|
data/lib/truemail/version.rb
CHANGED
data/lib/truemail/wrapper.rb
CHANGED
@@ -15,10 +15,10 @@ module Truemail
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def call(&block)
|
18
|
-
Timeout.timeout(timeout, &block)
|
19
|
-
rescue Resolv::ResolvError, IPAddr::InvalidAddressError
|
18
|
+
::Timeout.timeout(timeout, &block)
|
19
|
+
rescue ::Resolv::ResolvError, ::IPAddr::InvalidAddressError
|
20
20
|
false
|
21
|
-
rescue Timeout::Error
|
21
|
+
rescue ::Timeout::Error
|
22
22
|
retry unless (self.attempts -= 1).zero?
|
23
23
|
false
|
24
24
|
end
|
data/truemail.gemspec
CHANGED
@@ -31,21 +31,23 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
32
|
spec.require_paths = ['lib']
|
33
33
|
|
34
|
-
spec.add_runtime_dependency 'simpleidn', '~> 0.
|
34
|
+
spec.add_runtime_dependency 'simpleidn', '~> 0.2.1'
|
35
35
|
|
36
36
|
spec.add_development_dependency 'bundler', '~> 1.16'
|
37
|
-
spec.add_development_dependency 'bundler-audit', '~> 0.
|
38
|
-
spec.add_development_dependency '
|
39
|
-
spec.add_development_dependency '
|
37
|
+
spec.add_development_dependency 'bundler-audit', '~> 0.8.0'
|
38
|
+
spec.add_development_dependency 'dns_mock', '~> 1.2', '>= 1.2.1'
|
39
|
+
spec.add_development_dependency 'faker', '~> 2.17'
|
40
|
+
spec.add_development_dependency 'fasterer', '~> 0.9.0'
|
40
41
|
spec.add_development_dependency 'json_matchers', '~> 0.11.1'
|
41
42
|
spec.add_development_dependency 'overcommit', '~> 0.57.0'
|
42
43
|
spec.add_development_dependency 'pry-byebug', '~> 3.9'
|
43
44
|
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.3'
|
44
45
|
spec.add_development_dependency 'reek', '~> 6.0', '>= 6.0.3'
|
45
46
|
spec.add_development_dependency 'rspec', '~> 3.10'
|
46
|
-
spec.add_development_dependency 'rubocop', '~> 1.
|
47
|
-
spec.add_development_dependency 'rubocop-performance', '~> 1.
|
48
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 2.
|
47
|
+
spec.add_development_dependency 'rubocop', '~> 1.12', '>= 1.12.1'
|
48
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.10', '>= 1.10.2'
|
49
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.2'
|
49
50
|
spec.add_development_dependency 'simplecov', '~> 0.17.1'
|
50
|
-
spec.add_development_dependency 'truemail-rspec', '~> 0.
|
51
|
+
spec.add_development_dependency 'truemail-rspec', '~> 0.4'
|
52
|
+
spec.add_development_dependency 'webmock', '~> 3.12', '>= 3.12.2'
|
51
53
|
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: 2.
|
4
|
+
version: 2.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladislav Trotsenko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simpleidn
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.2.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.2.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,48 +44,62 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.8.0
|
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.8.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: dns_mock
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '2
|
61
|
+
version: '1.2'
|
62
62
|
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version: 2.
|
64
|
+
version: 1.2.1
|
65
65
|
type: :development
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
69
|
- - "~>"
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version: '2
|
71
|
+
version: '1.2'
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 2.
|
74
|
+
version: 1.2.1
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: faker
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '2.17'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '2.17'
|
75
89
|
- !ruby/object:Gem::Dependency
|
76
90
|
name: fasterer
|
77
91
|
requirement: !ruby/object:Gem::Requirement
|
78
92
|
requirements:
|
79
93
|
- - "~>"
|
80
94
|
- !ruby/object:Gem::Version
|
81
|
-
version: 0.
|
95
|
+
version: 0.9.0
|
82
96
|
type: :development
|
83
97
|
prerelease: false
|
84
98
|
version_requirements: !ruby/object:Gem::Requirement
|
85
99
|
requirements:
|
86
100
|
- - "~>"
|
87
101
|
- !ruby/object:Gem::Version
|
88
|
-
version: 0.
|
102
|
+
version: 0.9.0
|
89
103
|
- !ruby/object:Gem::Dependency
|
90
104
|
name: json_matchers
|
91
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -188,54 +202,54 @@ dependencies:
|
|
188
202
|
requirements:
|
189
203
|
- - "~>"
|
190
204
|
- !ruby/object:Gem::Version
|
191
|
-
version: '1.
|
205
|
+
version: '1.12'
|
192
206
|
- - ">="
|
193
207
|
- !ruby/object:Gem::Version
|
194
|
-
version: 1.
|
208
|
+
version: 1.12.1
|
195
209
|
type: :development
|
196
210
|
prerelease: false
|
197
211
|
version_requirements: !ruby/object:Gem::Requirement
|
198
212
|
requirements:
|
199
213
|
- - "~>"
|
200
214
|
- !ruby/object:Gem::Version
|
201
|
-
version: '1.
|
215
|
+
version: '1.12'
|
202
216
|
- - ">="
|
203
217
|
- !ruby/object:Gem::Version
|
204
|
-
version: 1.
|
218
|
+
version: 1.12.1
|
205
219
|
- !ruby/object:Gem::Dependency
|
206
220
|
name: rubocop-performance
|
207
221
|
requirement: !ruby/object:Gem::Requirement
|
208
222
|
requirements:
|
209
223
|
- - "~>"
|
210
224
|
- !ruby/object:Gem::Version
|
211
|
-
version: '1.
|
225
|
+
version: '1.10'
|
212
226
|
- - ">="
|
213
227
|
- !ruby/object:Gem::Version
|
214
|
-
version: 1.
|
228
|
+
version: 1.10.2
|
215
229
|
type: :development
|
216
230
|
prerelease: false
|
217
231
|
version_requirements: !ruby/object:Gem::Requirement
|
218
232
|
requirements:
|
219
233
|
- - "~>"
|
220
234
|
- !ruby/object:Gem::Version
|
221
|
-
version: '1.
|
235
|
+
version: '1.10'
|
222
236
|
- - ">="
|
223
237
|
- !ruby/object:Gem::Version
|
224
|
-
version: 1.
|
238
|
+
version: 1.10.2
|
225
239
|
- !ruby/object:Gem::Dependency
|
226
240
|
name: rubocop-rspec
|
227
241
|
requirement: !ruby/object:Gem::Requirement
|
228
242
|
requirements:
|
229
243
|
- - "~>"
|
230
244
|
- !ruby/object:Gem::Version
|
231
|
-
version: '2.
|
245
|
+
version: '2.2'
|
232
246
|
type: :development
|
233
247
|
prerelease: false
|
234
248
|
version_requirements: !ruby/object:Gem::Requirement
|
235
249
|
requirements:
|
236
250
|
- - "~>"
|
237
251
|
- !ruby/object:Gem::Version
|
238
|
-
version: '2.
|
252
|
+
version: '2.2'
|
239
253
|
- !ruby/object:Gem::Dependency
|
240
254
|
name: simplecov
|
241
255
|
requirement: !ruby/object:Gem::Requirement
|
@@ -256,14 +270,34 @@ dependencies:
|
|
256
270
|
requirements:
|
257
271
|
- - "~>"
|
258
272
|
- !ruby/object:Gem::Version
|
259
|
-
version: 0.
|
273
|
+
version: '0.4'
|
274
|
+
type: :development
|
275
|
+
prerelease: false
|
276
|
+
version_requirements: !ruby/object:Gem::Requirement
|
277
|
+
requirements:
|
278
|
+
- - "~>"
|
279
|
+
- !ruby/object:Gem::Version
|
280
|
+
version: '0.4'
|
281
|
+
- !ruby/object:Gem::Dependency
|
282
|
+
name: webmock
|
283
|
+
requirement: !ruby/object:Gem::Requirement
|
284
|
+
requirements:
|
285
|
+
- - "~>"
|
286
|
+
- !ruby/object:Gem::Version
|
287
|
+
version: '3.12'
|
288
|
+
- - ">="
|
289
|
+
- !ruby/object:Gem::Version
|
290
|
+
version: 3.12.2
|
260
291
|
type: :development
|
261
292
|
prerelease: false
|
262
293
|
version_requirements: !ruby/object:Gem::Requirement
|
263
294
|
requirements:
|
264
295
|
- - "~>"
|
265
296
|
- !ruby/object:Gem::Version
|
266
|
-
version:
|
297
|
+
version: '3.12'
|
298
|
+
- - ">="
|
299
|
+
- !ruby/object:Gem::Version
|
300
|
+
version: 3.12.2
|
267
301
|
description: Configurable framework agnostic plain Ruby email validator. Verify email
|
268
302
|
via Regex, DNS and SMTP.
|
269
303
|
email:
|
@@ -305,6 +339,9 @@ files:
|
|
305
339
|
- lib/truemail/auditor.rb
|
306
340
|
- lib/truemail/configuration.rb
|
307
341
|
- lib/truemail/core.rb
|
342
|
+
- lib/truemail/dns/punycode_representer.rb
|
343
|
+
- lib/truemail/dns/resolver.rb
|
344
|
+
- lib/truemail/dns/worker.rb
|
308
345
|
- lib/truemail/executor.rb
|
309
346
|
- lib/truemail/log/event.rb
|
310
347
|
- lib/truemail/log/serializer/auditor_json.rb
|