truemail 2.5.4 → 2.6.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: 37bf79a8686596bdc9c9f3b3b790af4d2fee50814b9c0c776696c77085a01bb1
4
- data.tar.gz: '0927e1e776737834c16db6caea0ab3892686bfb4dc86d1d87b1cb7446b5ec821'
3
+ metadata.gz: 2826eb4303d5730ba1cd199cf91d7ef07946d3d167af6b8a3eee704c56127490
4
+ data.tar.gz: e23c0881d4e066857e51421a511b46e13e61bd6c9e4690223ed83fffc3947249
5
5
  SHA512:
6
- metadata.gz: de69fa4ff5d56639d98eba1c2bd19ade808651dbbdff3eb6ebea66c3e200a371f1fd78ab932b62f865ba0c2b4f413d7842a08d78c46ce7da3aea6f86e1e68e19
7
- data.tar.gz: ffa822e760e57bcaf273af04b2fbe6e334f4bba3bd91c2130e6164ec0e580cff3e65af3a771a4409290a8aedfd8d2a5dd85c3aa2c0ff8fb6d6740322d99be810
6
+ metadata.gz: facbed503237e69db472f8392402e45e04e3fb41bf44cab0048eaee7b8968ae0a68a72da34315d1ebe066001ec253ae5da96adab1b4c2891fa069404afe1db77
7
+ data.tar.gz: d93dc1d183fbafb6be9a12b35d38ddebff6d5b92d76cb80f559238303f27ce5246caaa271665b0060a0ae340678831ad3bcec949cdd0447085469f223a629a8e
data/.circleci/config.yml CHANGED
@@ -4,18 +4,11 @@ defaults: &defaults
4
4
  working_directory: ~/truemail
5
5
  docker:
6
6
  - image: cimg/ruby:<< parameters.ruby-version >>
7
- environment:
8
- CC_TEST_REPORTER_ID: 693272a1328521f6f7c09d7ffd419b21c00410da26e98e94c687fdd38b26e2cb
9
7
 
10
8
  orbs:
11
- ruby: circleci/ruby@1.1.3
9
+ ruby: circleci/ruby@1.2.0
12
10
 
13
11
  references:
14
- install_bundler: &install_bundler
15
- run:
16
- name: Installing Bundler
17
- command: gem i bundler -v $(tail -1 Gemfile.lock | tr -d ' ')
18
-
19
12
  restore_bundle_cache: &restore_bundle_cache
20
13
  restore_cache:
21
14
  keys:
@@ -24,7 +17,9 @@ references:
24
17
  bundle_install: &bundle_install
25
18
  run:
26
19
  name: Installing gems
27
- command: bundle install --path vendor/bundle
20
+ command: |
21
+ bundle config set --local path 'vendor/bundle'
22
+ bundle install
28
23
 
29
24
  save_bundle_cache: &save_bundle_cache
30
25
  save_cache:
@@ -50,7 +45,6 @@ jobs:
50
45
  steps:
51
46
  - checkout
52
47
 
53
- - <<: *install_bundler
54
48
  - <<: *restore_bundle_cache
55
49
  - <<: *bundle_install
56
50
  - <<: *save_bundle_cache
@@ -71,7 +65,6 @@ jobs:
71
65
  steps:
72
66
  - checkout
73
67
 
74
- - <<: *install_bundler
75
68
  - <<: *restore_bundle_cache
76
69
  - <<: *bundle_install
77
70
  - <<: *save_bundle_cache
@@ -107,6 +100,7 @@ jobs:
107
100
  steps:
108
101
  - checkout
109
102
  - ruby/install-deps:
103
+ bundler-version: "2.3.3"
110
104
  with-cache: false
111
105
  path: './vendor/custom_bundle'
112
106
  - run:
@@ -127,4 +121,4 @@ workflows:
127
121
  - compatibility-ruby:
128
122
  matrix:
129
123
  parameters:
130
- ruby-version: ["2.6", "2.7", "3.0"]
124
+ ruby-version: ["2.6", "2.7", "3.0", "3.1"]
data/.codeclimate.yml CHANGED
@@ -7,7 +7,7 @@ checks:
7
7
  plugins:
8
8
  rubocop:
9
9
  enabled: true
10
- channel: rubocop-1-23
10
+ channel: rubocop-1-24
11
11
 
12
12
  reek:
13
13
  enabled: true
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  /.rspec_status
2
2
  /pkg
3
3
  /coverage/
4
+ Gemfile.lock
data/.reek.yml CHANGED
@@ -47,6 +47,7 @@ detectors:
47
47
  - Truemail::Validate::Mx#null_mx?
48
48
  - Truemail::Validate::Mx#a_record
49
49
  - Truemail::Validate::Smtp::Request#compose_from
50
+ - Truemail::Validate::Smtp::Request::Session#old_net_smtp?
50
51
 
51
52
  ControlParameter:
52
53
  exclude:
data/.rubocop.yml CHANGED
@@ -31,6 +31,9 @@ Naming/RescuedExceptionsVariableName:
31
31
  Naming/InclusiveLanguage:
32
32
  Enabled: false
33
33
 
34
+ Naming/BlockForwarding:
35
+ Enabled: true
36
+
34
37
  Style/Documentation:
35
38
  Enabled: false
36
39
 
@@ -181,6 +184,15 @@ Style/SelectByRegexp:
181
184
  Style/OpenStructUse:
182
185
  Enabled: true
183
186
 
187
+ Style/FileRead:
188
+ Enabled: true
189
+
190
+ Style/FileWrite:
191
+ Enabled: true
192
+
193
+ Style/MapToHash:
194
+ Enabled: true
195
+
184
196
  Layout/LineLength:
185
197
  Max: 140
186
198
 
@@ -416,6 +428,9 @@ Performance/MapCompact:
416
428
  Performance/ConcurrentMonotonicTime:
417
429
  Enabled: true
418
430
 
431
+ Performance/StringIdentifierArgument:
432
+ Enabled: true
433
+
419
434
  RSpec/ExampleLength:
420
435
  Enabled: false
421
436
 
@@ -457,3 +472,6 @@ RSpec/ExcessiveDocstringSpacing:
457
472
 
458
473
  RSpec/SubjectDeclaration:
459
474
  Enabled: true
475
+
476
+ RSpec/FactoryBot/SyntaxMethods:
477
+ Enabled: true
data/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
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
+ ## [2.6.0] - 2021.12.28
6
+
7
+ ### Added
8
+
9
+ - Added Ruby 3.1.x compatibility
10
+ - Added `Truemail::Validate::Smtp::Request::Session` - `Net::SMTP` wrapper, tests
11
+
12
+ ### Updated
13
+
14
+ - Updated `Truemail::Validate::Smtp::Request#session`, `Truemail::Validate::Smtp::Request#run`, tests
15
+ - Updated rubocop/reek/codeclimate/circleci configs
16
+ - Updated gem runtime/development dependencies
17
+ - Updated gem docs, version
18
+
5
19
  ## [2.5.4] - 2021.12.03
6
20
 
7
21
  ### Fixed
data/README.md CHANGED
@@ -81,7 +81,6 @@ Also Truemail gem allows performing an audit of the host in which runs.
81
81
  ## Features
82
82
 
83
83
  - Configurable validator, validate only what you need
84
- - Only one runtime dependency
85
84
  - Supporting of internationalized emails ([EAI](https://en.wikipedia.org/wiki/Email_address#Internationalization))
86
85
  - Whitelist/blacklist validation layers
87
86
  - Ability to configure different MX/SMTP validation flows
@@ -4,8 +4,6 @@ module Truemail
4
4
  module Validate
5
5
  class Smtp
6
6
  class Request
7
- require 'net/smtp'
8
-
9
7
  SMTP_PORT = 25
10
8
  CONNECTION_TIMEOUT_ERROR = 'connection timed out'
11
9
  RESPONSE_TIMEOUT_ERROR = 'server response timeout'
@@ -35,7 +33,6 @@ module Truemail
35
33
  end
36
34
 
37
35
  def run
38
- return session.start(verifier_domain, tls_verify: false, &session_actions) if ::RUBY_VERSION[/\A3\..+\z/]
39
36
  session.start(verifier_domain, &session_actions)
40
37
  rescue => error
41
38
  retry if attempts_exist?
@@ -55,6 +52,30 @@ module Truemail
55
52
  end
56
53
  end
57
54
 
55
+ class Session
56
+ require 'net/smtp'
57
+
58
+ def initialize(host, port, connection_timeout, response_timeout)
59
+ @net_smtp = (old_net_smtp? ? ::Net::SMTP.new(host, port) : ::Net::SMTP.new(host, port, tls_verify: false)).tap do |settings|
60
+ settings.open_timeout = connection_timeout
61
+ settings.read_timeout = response_timeout
62
+ end
63
+ end
64
+
65
+ def start(helo_domain, &block)
66
+ return net_smtp.start(helo_domain, &block) if old_net_smtp?
67
+ net_smtp.start(helo: helo_domain, &block)
68
+ end
69
+
70
+ private
71
+
72
+ attr_reader :net_smtp
73
+
74
+ def old_net_smtp?
75
+ !::Net::SMTP.const_defined?(:VERSION) || ::Net::SMTP::VERSION < '0.3.0'
76
+ end
77
+ end
78
+
58
79
  attr_reader :attempts, :port_open_status
59
80
 
60
81
  def attempts_exist?
@@ -63,10 +84,12 @@ module Truemail
63
84
  end
64
85
 
65
86
  def session
66
- ::Net::SMTP.new(host, Truemail::Validate::Smtp::Request::SMTP_PORT).tap do |settings|
67
- settings.open_timeout = configuration.connection_timeout
68
- settings.read_timeout = configuration.response_timeout
69
- end
87
+ Truemail::Validate::Smtp::Request::Session.new(
88
+ host,
89
+ Truemail::Validate::Smtp::Request::SMTP_PORT,
90
+ configuration.connection_timeout,
91
+ configuration.response_timeout
92
+ )
70
93
  end
71
94
 
72
95
  def compose_from(error)
@@ -84,10 +107,7 @@ module Truemail
84
107
  end
85
108
 
86
109
  def session_data
87
- {
88
- mailfrom: configuration.verifier_email,
89
- rcptto: email
90
- }
110
+ { mailfrom: configuration.verifier_email, rcptto: email }
91
111
  end
92
112
 
93
113
  def smtp_resolver(smtp_request, method, value)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Truemail
4
- VERSION = '2.5.4'
4
+ VERSION = '2.6.0'
5
5
  end
data/truemail.gemspec CHANGED
@@ -31,9 +31,9 @@ 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 'net-smtp', '~> 0.3'
34
35
  spec.add_runtime_dependency 'simpleidn', '~> 0.2.1'
35
36
 
36
- spec.add_development_dependency 'bundler', '~> 2.2', '>= 2.2.32'
37
37
  spec.add_development_dependency 'bundler-audit', '~> 0.9.0.1'
38
38
  spec.add_development_dependency 'dns_mock', '~> 1.4', '>= 1.4.4'
39
39
  spec.add_development_dependency 'fasterer', '~> 0.9.0'
@@ -44,9 +44,9 @@ Gem::Specification.new do |spec|
44
44
  spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
45
45
  spec.add_development_dependency 'reek', '~> 6.0', '>= 6.0.6'
46
46
  spec.add_development_dependency 'rspec', '~> 3.10'
47
- spec.add_development_dependency 'rubocop', '~> 1.23'
48
- spec.add_development_dependency 'rubocop-performance', '~> 1.12'
49
- spec.add_development_dependency 'rubocop-rspec', '~> 2.6'
47
+ spec.add_development_dependency 'rubocop', '~> 1.24'
48
+ spec.add_development_dependency 'rubocop-performance', '~> 1.13'
49
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.7'
50
50
  spec.add_development_dependency 'simplecov', '~> 0.17.1'
51
51
  spec.add_development_dependency 'truemail-rspec', '~> 0.7.0'
52
52
  spec.add_development_dependency 'webmock', '~> 3.14'
metadata CHANGED
@@ -1,49 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: truemail
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.4
4
+ version: 2.6.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: 2021-12-03 00:00:00.000000000 Z
11
+ date: 2021-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: simpleidn
14
+ name: net-smtp
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.1
19
+ version: '0.3'
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.2.1
26
+ version: '0.3'
27
27
  - !ruby/object:Gem::Dependency
28
- name: bundler
28
+ name: simpleidn
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.2'
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 2.2.32
37
- type: :development
33
+ version: 0.2.1
34
+ type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
38
  - - "~>"
42
39
  - !ruby/object:Gem::Version
43
- version: '2.2'
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 2.2.32
40
+ version: 0.2.1
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: bundler-audit
49
43
  requirement: !ruby/object:Gem::Requirement
@@ -208,42 +202,42 @@ dependencies:
208
202
  requirements:
209
203
  - - "~>"
210
204
  - !ruby/object:Gem::Version
211
- version: '1.23'
205
+ version: '1.24'
212
206
  type: :development
213
207
  prerelease: false
214
208
  version_requirements: !ruby/object:Gem::Requirement
215
209
  requirements:
216
210
  - - "~>"
217
211
  - !ruby/object:Gem::Version
218
- version: '1.23'
212
+ version: '1.24'
219
213
  - !ruby/object:Gem::Dependency
220
214
  name: rubocop-performance
221
215
  requirement: !ruby/object:Gem::Requirement
222
216
  requirements:
223
217
  - - "~>"
224
218
  - !ruby/object:Gem::Version
225
- version: '1.12'
219
+ version: '1.13'
226
220
  type: :development
227
221
  prerelease: false
228
222
  version_requirements: !ruby/object:Gem::Requirement
229
223
  requirements:
230
224
  - - "~>"
231
225
  - !ruby/object:Gem::Version
232
- version: '1.12'
226
+ version: '1.13'
233
227
  - !ruby/object:Gem::Dependency
234
228
  name: rubocop-rspec
235
229
  requirement: !ruby/object:Gem::Requirement
236
230
  requirements:
237
231
  - - "~>"
238
232
  - !ruby/object:Gem::Version
239
- version: '2.6'
233
+ version: '2.7'
240
234
  type: :development
241
235
  prerelease: false
242
236
  version_requirements: !ruby/object:Gem::Requirement
243
237
  requirements:
244
238
  - - "~>"
245
239
  - !ruby/object:Gem::Version
246
- version: '2.6'
240
+ version: '2.7'
247
241
  - !ruby/object:Gem::Dependency
248
242
  name: simplecov
249
243
  requirement: !ruby/object:Gem::Requirement
@@ -313,7 +307,6 @@ files:
313
307
  - CODE_OF_CONDUCT.md
314
308
  - CONTRIBUTING.md
315
309
  - Gemfile
316
- - Gemfile.lock
317
310
  - LICENSE.txt
318
311
  - README.md
319
312
  - Rakefile
data/Gemfile.lock DELETED
@@ -1,138 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- truemail (2.5.4)
5
- simpleidn (~> 0.2.1)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- addressable (2.8.0)
11
- public_suffix (>= 2.0.2, < 5.0)
12
- ast (2.4.2)
13
- bundler-audit (0.9.0.1)
14
- bundler (>= 1.2.0, < 3)
15
- thor (~> 1.0)
16
- byebug (11.1.3)
17
- childprocess (4.1.0)
18
- coderay (1.1.3)
19
- colorize (0.8.1)
20
- crack (0.4.5)
21
- rexml
22
- diff-lcs (1.4.4)
23
- dns_mock (1.4.4)
24
- simpleidn (~> 0.2.1)
25
- docile (1.4.0)
26
- fasterer (0.9.0)
27
- colorize (~> 0.7)
28
- ruby_parser (>= 3.14.1)
29
- ffaker (2.20.0)
30
- hashdiff (1.0.1)
31
- iniparse (1.5.0)
32
- json (2.6.1)
33
- json_matchers (0.11.1)
34
- json_schema
35
- json_schema (0.21.0)
36
- kwalify (0.7.2)
37
- method_source (1.0.0)
38
- overcommit (0.58.0)
39
- childprocess (>= 0.6.3, < 5)
40
- iniparse (~> 1.4)
41
- rexml (~> 3.2)
42
- parallel (1.21.0)
43
- parser (3.0.3.1)
44
- ast (~> 2.4.1)
45
- pry (0.13.1)
46
- coderay (~> 1.1)
47
- method_source (~> 1.0)
48
- pry-byebug (3.9.0)
49
- byebug (~> 11.0)
50
- pry (~> 0.13.0)
51
- public_suffix (4.0.6)
52
- rainbow (3.0.0)
53
- rake (13.0.6)
54
- reek (6.0.6)
55
- kwalify (~> 0.7.0)
56
- parser (~> 3.0.0)
57
- rainbow (>= 2.0, < 4.0)
58
- regexp_parser (2.1.1)
59
- rexml (3.2.5)
60
- rspec (3.10.0)
61
- rspec-core (~> 3.10.0)
62
- rspec-expectations (~> 3.10.0)
63
- rspec-mocks (~> 3.10.0)
64
- rspec-core (3.10.1)
65
- rspec-support (~> 3.10.0)
66
- rspec-expectations (3.10.1)
67
- diff-lcs (>= 1.2.0, < 2.0)
68
- rspec-support (~> 3.10.0)
69
- rspec-mocks (3.10.2)
70
- diff-lcs (>= 1.2.0, < 2.0)
71
- rspec-support (~> 3.10.0)
72
- rspec-support (3.10.3)
73
- rubocop (1.23.0)
74
- parallel (~> 1.10)
75
- parser (>= 3.0.0.0)
76
- rainbow (>= 2.2.2, < 4.0)
77
- regexp_parser (>= 1.8, < 3.0)
78
- rexml
79
- rubocop-ast (>= 1.12.0, < 2.0)
80
- ruby-progressbar (~> 1.7)
81
- unicode-display_width (>= 1.4.0, < 3.0)
82
- rubocop-ast (1.14.0)
83
- parser (>= 3.0.1.1)
84
- rubocop-performance (1.12.0)
85
- rubocop (>= 1.7.0, < 2.0)
86
- rubocop-ast (>= 0.4.0)
87
- rubocop-rspec (2.6.0)
88
- rubocop (~> 1.19)
89
- ruby-progressbar (1.11.0)
90
- ruby_parser (3.18.1)
91
- sexp_processor (~> 4.16)
92
- sexp_processor (4.16.0)
93
- simplecov (0.17.1)
94
- docile (~> 1.1)
95
- json (>= 1.8, < 3)
96
- simplecov-html (~> 0.10.0)
97
- simplecov-html (0.10.2)
98
- simpleidn (0.2.1)
99
- unf (~> 0.1.4)
100
- thor (1.1.0)
101
- truemail-rspec (0.7.0)
102
- ffaker (~> 2.18)
103
- rspec (~> 3.10)
104
- truemail (>= 2.4)
105
- unf (0.1.4)
106
- unf_ext
107
- unf_ext (0.0.8)
108
- unicode-display_width (2.1.0)
109
- webmock (3.14.0)
110
- addressable (>= 2.8.0)
111
- crack (>= 0.3.2)
112
- hashdiff (>= 0.4.0, < 2.0.0)
113
-
114
- PLATFORMS
115
- x86_64-darwin-20
116
-
117
- DEPENDENCIES
118
- bundler (~> 2.2, >= 2.2.32)
119
- bundler-audit (~> 0.9.0.1)
120
- dns_mock (~> 1.4, >= 1.4.4)
121
- fasterer (~> 0.9.0)
122
- ffaker (~> 2.20)
123
- json_matchers (~> 0.11.1)
124
- overcommit (~> 0.58.0)
125
- pry-byebug (~> 3.9)
126
- rake (~> 13.0, >= 13.0.6)
127
- reek (~> 6.0, >= 6.0.6)
128
- rspec (~> 3.10)
129
- rubocop (~> 1.23)
130
- rubocop-performance (~> 1.12)
131
- rubocop-rspec (~> 2.6)
132
- simplecov (~> 0.17.1)
133
- truemail!
134
- truemail-rspec (~> 0.7.0)
135
- webmock (~> 3.14)
136
-
137
- BUNDLED WITH
138
- 2.2.32