truemail 2.4.0 → 2.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93c31449fbc6da2f25c4ded78c2a976e67f71e2b7112aac70db27bf6e1b75f20
4
- data.tar.gz: 53599be276e8b72ff3f338c2991c7a10bbdd0c5876e506c40f0965e06941f8c8
3
+ metadata.gz: ab60bc15dde3624894487439f95781eb83a963954b32370f1f64a4a750ce2895
4
+ data.tar.gz: cf9ebab60730796e864bd5a0626bf66162b46060d475aaf6d38536f7307d7e09
5
5
  SHA512:
6
- metadata.gz: fc0e3012563e61ee123486a4aa2b27e2b81da60668eccef8ed5d998ca82884f6365cc25c9cabe1cf6ef444eecc4663435b661b7de6b4100dcc5e83dbe65868cb
7
- data.tar.gz: 4a27edc3f01d46eb948f172eeb95bcabe5f47a10eb770f8e0f2769454bb94fe8b30f55ec9a19f388592cf70cfd36f224343a879f02ab7b67c13db97b2a3329a2
6
+ metadata.gz: 690463e2659813d51b72bdb29e8ae543395f4b8d8c42dbe2d2b4e47d32391a3eab7118911a968c1801afc55078420d9968b1af96dc86bf902a5326fad2a2034e
7
+ data.tar.gz: 7cdc49f89121810be4623cb1cd00a9ba29aa9ef0b2f73e0ab7ea87da20ddc8c9273876223923948cba63616e4d29fa298175b525dcca1b46897b00fad712621a
data/.circleci/config.yml CHANGED
@@ -3,14 +3,19 @@ version: 2.1
3
3
  defaults: &defaults
4
4
  working_directory: ~/truemail
5
5
  docker:
6
- - image: circleci/ruby:2.5.0-node
6
+ - image: cimg/ruby:<< parameters.ruby-version >>
7
7
  environment:
8
8
  CC_TEST_REPORTER_ID: 693272a1328521f6f7c09d7ffd419b21c00410da26e98e94c687fdd38b26e2cb
9
9
 
10
10
  orbs:
11
- ruby: circleci/ruby@1.1.2
11
+ ruby: circleci/ruby@1.1.3
12
12
 
13
13
  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
+
14
19
  restore_bundle_cache: &restore_bundle_cache
15
20
  restore_cache:
16
21
  keys:
@@ -29,63 +34,71 @@ references:
29
34
 
30
35
  install_codeclimate_reporter: &install_codeclimate_reporter
31
36
  run:
32
- name: Install Code Climate Test Reporter
37
+ name: Installing CodeClimate test reporter
33
38
  command: |
34
39
  curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
35
40
  chmod +x ./cc-test-reporter
36
41
 
37
42
  jobs:
38
- linters:
43
+ linters-ruby:
44
+ parameters:
45
+ ruby-version:
46
+ type: string
47
+
39
48
  <<: *defaults
40
49
 
41
50
  steps:
42
51
  - checkout
43
52
 
53
+ - <<: *install_bundler
44
54
  - <<: *restore_bundle_cache
45
55
  - <<: *bundle_install
46
56
  - <<: *save_bundle_cache
47
57
 
48
58
  - run:
49
- name: Running overcommit
59
+ name: Running Overcommit
50
60
  command: |
51
61
  bundle exec overcommit -s
52
62
  SKIP=AuthorEmail,AuthorName bundle exec overcommit -r
53
63
 
54
- tests:
64
+ tests-ruby:
65
+ parameters:
66
+ ruby-version:
67
+ type: string
68
+
55
69
  <<: *defaults
56
70
 
57
71
  steps:
58
72
  - checkout
59
73
 
74
+ - <<: *install_bundler
60
75
  - <<: *restore_bundle_cache
61
76
  - <<: *bundle_install
62
77
  - <<: *save_bundle_cache
63
78
  - <<: *install_codeclimate_reporter
64
79
 
65
80
  - run:
66
- name: Running tests
81
+ name: Running RSpec
67
82
  command: |
68
- mkdir /tmp/test-results
69
83
  ./cc-test-reporter before-build
70
84
  bundle exec rspec
71
85
 
72
86
  - run:
73
- name: Code Climate Test Coverage
87
+ name: Creating CodeClimate test coverage report
74
88
  command: |
75
89
  ./cc-test-reporter format-coverage -t simplecov -o "coverage/codeclimate.$CIRCLE_NODE_INDEX.json"
76
90
 
77
- - store_test_results:
78
- path: /tmp/test-results
79
-
80
91
  - store_artifacts:
81
- path: /tmp/test-results
82
- destination: test-results
92
+ name: Saving Simplecov coverage artifacts
93
+ path: ~/truemail/coverage
94
+ destination: coverage
83
95
 
84
96
  - deploy:
97
+ name: Uploading CodeClimate test coverage report
85
98
  command: |
86
99
  ./cc-test-reporter sum-coverage --output - --parts $CIRCLE_NODE_TOTAL coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --debug --input -
87
100
 
88
- compatibility-with-ruby:
101
+ compatibility-ruby:
89
102
  parameters:
90
103
  ruby-version:
91
104
  type: string
@@ -94,7 +107,6 @@ jobs:
94
107
  steps:
95
108
  - checkout
96
109
  - ruby/install-deps:
97
- bundler-version: '1.16.6'
98
110
  with-cache: false
99
111
  path: './vendor/custom_bundle'
100
112
  - run:
@@ -104,9 +116,15 @@ jobs:
104
116
  workflows:
105
117
  build_and_test:
106
118
  jobs:
107
- - linters
108
- - tests
109
- - compatibility-with-ruby:
119
+ - linters-ruby:
120
+ matrix:
121
+ parameters:
122
+ ruby-version: ["2.5"]
123
+ - tests-ruby:
124
+ matrix:
125
+ parameters:
126
+ ruby-version: ["2.5"]
127
+ - compatibility-ruby:
110
128
  matrix:
111
129
  parameters:
112
130
  ruby-version: ["2.6", "2.7", "3.0"]
data/.codeclimate.yml CHANGED
@@ -7,7 +7,7 @@ checks:
7
7
  plugins:
8
8
  rubocop:
9
9
  enabled: true
10
- channel: rubocop-1-13
10
+ channel: rubocop-1-18
11
11
 
12
12
  reek:
13
13
  enabled: true
data/.rubocop.yml CHANGED
@@ -28,6 +28,9 @@ Naming/VariableNumber:
28
28
  Naming/RescuedExceptionsVariableName:
29
29
  Enabled: false
30
30
 
31
+ Naming/InclusiveLanguage:
32
+ Enabled: false
33
+
31
34
  Style/Documentation:
32
35
  Enabled: false
33
36
 
@@ -154,6 +157,15 @@ Style/HashConversion:
154
157
  Style/StringChars:
155
158
  Enabled: true
156
159
 
160
+ Style/InPatternThen:
161
+ Enabled: true
162
+
163
+ Style/MultilineInPatternThen:
164
+ Enabled: true
165
+
166
+ Style/QuotedSymbols:
167
+ Enabled: true
168
+
157
169
  Layout/LineLength:
158
170
  Max: 140
159
171
 
@@ -188,6 +200,9 @@ Layout/BeginEndAlignment:
188
200
  Layout/SpaceBeforeBrackets:
189
201
  Enabled: true
190
202
 
203
+ Layout/LineEndStringConcatenationIndentation:
204
+ Enabled: true
205
+
191
206
  Lint/NonDeterministicRequireOrder:
192
207
  Enabled: false
193
208
 
@@ -308,6 +323,9 @@ Lint/SymbolConversion:
308
323
  Lint/TripleQuotes:
309
324
  Enabled: true
310
325
 
326
+ Lint/EmptyInPattern:
327
+ Enabled: true
328
+
311
329
  Gemspec/DateAssignment:
312
330
  Enabled: true
313
331
 
@@ -388,3 +406,9 @@ RSpec/MultipleMemoizedHelpers:
388
406
 
389
407
  RSpec/StubbedMock:
390
408
  Enabled: false
409
+
410
+ RSpec/IdenticalEqualityAssertion:
411
+ Enabled: true
412
+
413
+ RSpec/Rails/AvoidSetupHook:
414
+ Enabled: true
data/CHANGELOG.md CHANGED
@@ -2,6 +2,58 @@
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.4.5] - 2021.07.09
6
+
7
+ ### Removed
8
+
9
+ - `Truemail::RegexConstant::REGEX_DOMAIN_FROM_EMAIL`
10
+
11
+ ### Updated
12
+
13
+ - `Truemail::Validate::Mx`
14
+ - Updated gem development dependencies
15
+ - Updated gem version
16
+
17
+ ## [2.4.4] - 2021.06.29
18
+
19
+ ### Updated
20
+
21
+ Allowed using special characters in email user names (following [RFC 3696](https://datatracker.ietf.org/doc/html/rfc3696#page-6)) for default regex email pattern.
22
+
23
+ - Updated `Truemail::RegexConstant::REGEX_EMAIL_PATTERN`, tests
24
+ - Updated gem development dependencies
25
+ - Updated Rubocop/Codeclimate config
26
+ - Updated gem documentation, version
27
+
28
+ ## [2.4.3] - 2021.06.15
29
+
30
+ ### Updated
31
+
32
+ - Updated gem development dependencies
33
+ - Updated Rubocop/Codeclimate config
34
+ - Updated gem documentation, version
35
+
36
+ ## [2.4.2] - 2021.05.13
37
+
38
+ ### Fixed
39
+
40
+ - Fixed security vulnerability for bundler ([CVE-2019-3881](https://github.com/advisories/GHSA-g98m-96g9-wfjq))
41
+ - Fixed test coverage issues
42
+
43
+ ### Updated
44
+
45
+ - Updated gem development dependencies
46
+ - Updated simplecov/CircleCi config
47
+ - Updated gem documentation, version
48
+
49
+ ## [2.4.1] - 2021.05.05
50
+
51
+ ### Updated
52
+
53
+ - `Truemail::Validate::MxBlacklist`, tests
54
+ - Updated gem development dependencies
55
+ - Updated gem documentation, version
56
+
5
57
  ## [2.4.0] - 2021.04.28
6
58
 
7
59
  ### Added
@@ -15,11 +67,8 @@ Truemail.configure do |config|
15
67
  # address) validations. It is equal to empty array by default.
16
68
  config.blacklisted_mx_ip_addresses = ['1.1.1.1', '2.2.2.2']
17
69
  end
18
-
19
70
  ```
20
71
 
21
- - Added `Truemail::Validate::MxBlacklist`, tests
22
-
23
72
  ### Changed
24
73
 
25
74
  - Updated `Truemail::Core`, tests
data/Gemfile.lock CHANGED
@@ -1,29 +1,29 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- truemail (2.4.0)
4
+ truemail (2.4.5)
5
5
  simpleidn (~> 0.2.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- addressable (2.7.0)
10
+ addressable (2.8.0)
11
11
  public_suffix (>= 2.0.2, < 5.0)
12
12
  ast (2.4.2)
13
13
  bundler-audit (0.8.0)
14
14
  bundler (>= 1.2.0, < 3)
15
15
  thor (~> 1.0)
16
16
  byebug (11.1.3)
17
- childprocess (4.0.0)
17
+ childprocess (4.1.0)
18
18
  coderay (1.1.3)
19
19
  colorize (0.8.1)
20
- concurrent-ruby (1.1.8)
20
+ concurrent-ruby (1.1.9)
21
21
  crack (0.4.5)
22
22
  rexml
23
23
  diff-lcs (1.4.4)
24
- dns_mock (1.2.1)
25
- docile (1.3.5)
26
- faker (2.17.0)
24
+ dns_mock (1.3.1)
25
+ docile (1.4.0)
26
+ faker (2.18.0)
27
27
  i18n (>= 1.6, < 2)
28
28
  fasterer (0.9.0)
29
29
  colorize (~> 0.7)
@@ -38,11 +38,12 @@ GEM
38
38
  json_schema (0.21.0)
39
39
  kwalify (0.7.2)
40
40
  method_source (1.0.0)
41
- overcommit (0.57.0)
41
+ overcommit (0.58.0)
42
42
  childprocess (>= 0.6.3, < 5)
43
43
  iniparse (~> 1.4)
44
+ rexml (~> 3.2)
44
45
  parallel (1.20.1)
45
- parser (3.0.1.0)
46
+ parser (3.0.2.0)
46
47
  ast (~> 2.4.1)
47
48
  pry (0.13.1)
48
49
  coderay (~> 1.1)
@@ -50,10 +51,10 @@ GEM
50
51
  pry-byebug (3.9.0)
51
52
  byebug (~> 11.0)
52
53
  pry (~> 0.13.0)
53
- psych (3.3.1)
54
+ psych (3.3.2)
54
55
  public_suffix (4.0.6)
55
56
  rainbow (3.0.0)
56
- rake (13.0.3)
57
+ rake (13.0.6)
57
58
  reek (6.0.4)
58
59
  kwalify (~> 0.7.0)
59
60
  parser (~> 3.0.0)
@@ -74,27 +75,27 @@ GEM
74
75
  diff-lcs (>= 1.2.0, < 2.0)
75
76
  rspec-support (~> 3.10.0)
76
77
  rspec-support (3.10.2)
77
- rubocop (1.13.0)
78
+ rubocop (1.18.3)
78
79
  parallel (~> 1.10)
79
80
  parser (>= 3.0.0.0)
80
81
  rainbow (>= 2.2.2, < 4.0)
81
82
  regexp_parser (>= 1.8, < 3.0)
82
83
  rexml
83
- rubocop-ast (>= 1.2.0, < 2.0)
84
+ rubocop-ast (>= 1.7.0, < 2.0)
84
85
  ruby-progressbar (~> 1.7)
85
86
  unicode-display_width (>= 1.4.0, < 3.0)
86
- rubocop-ast (1.4.1)
87
- parser (>= 2.7.1.5)
88
- rubocop-performance (1.11.0)
87
+ rubocop-ast (1.7.0)
88
+ parser (>= 3.0.1.1)
89
+ rubocop-performance (1.11.4)
89
90
  rubocop (>= 1.7.0, < 2.0)
90
91
  rubocop-ast (>= 0.4.0)
91
- rubocop-rspec (2.3.0)
92
+ rubocop-rspec (2.4.0)
92
93
  rubocop (~> 1.0)
93
94
  rubocop-ast (>= 1.1.0)
94
95
  ruby-progressbar (1.11.0)
95
- ruby_parser (3.15.1)
96
- sexp_processor (~> 4.9)
97
- sexp_processor (4.15.2)
96
+ ruby_parser (3.16.0)
97
+ sexp_processor (~> 4.15, >= 4.15.1)
98
+ sexp_processor (4.15.3)
98
99
  simplecov (0.17.1)
99
100
  docile (~> 1.1)
100
101
  json (>= 1.8, < 3)
@@ -103,41 +104,41 @@ GEM
103
104
  simpleidn (0.2.1)
104
105
  unf (~> 0.1.4)
105
106
  thor (1.1.0)
106
- truemail-rspec (0.4.0)
107
- faker (~> 2.16)
107
+ truemail-rspec (0.6.0)
108
+ faker (~> 2.17)
108
109
  rspec (~> 3.10)
109
- truemail (>= 2.3)
110
+ truemail (>= 2.4)
110
111
  unf (0.1.4)
111
112
  unf_ext
112
113
  unf_ext (0.0.7.7)
113
114
  unicode-display_width (2.0.0)
114
- webmock (3.12.2)
115
+ webmock (3.13.0)
115
116
  addressable (>= 2.3.6)
116
117
  crack (>= 0.3.2)
117
118
  hashdiff (>= 0.4.0, < 2.0.0)
118
119
 
119
120
  PLATFORMS
120
- ruby
121
+ x86_64-darwin-20
121
122
 
122
123
  DEPENDENCIES
123
- bundler (~> 1.16)
124
+ bundler (~> 2.2, >= 2.2.23)
124
125
  bundler-audit (~> 0.8.0)
125
- dns_mock (~> 1.2, >= 1.2.1)
126
- faker (~> 2.17)
126
+ dns_mock (~> 1.3, >= 1.3.1)
127
+ faker (~> 2.18)
127
128
  fasterer (~> 0.9.0)
128
129
  json_matchers (~> 0.11.1)
129
- overcommit (~> 0.57.0)
130
+ overcommit (~> 0.58.0)
130
131
  pry-byebug (~> 3.9)
131
- rake (~> 13.0, >= 13.0.3)
132
+ rake (~> 13.0, >= 13.0.6)
132
133
  reek (~> 6.0, >= 6.0.4)
133
134
  rspec (~> 3.10)
134
- rubocop (~> 1.13)
135
- rubocop-performance (~> 1.11)
136
- rubocop-rspec (~> 2.3)
135
+ rubocop (~> 1.18, >= 1.18.3)
136
+ rubocop-performance (~> 1.11, >= 1.11.4)
137
+ rubocop-rspec (~> 2.4)
137
138
  simplecov (~> 0.17.1)
138
139
  truemail!
139
- truemail-rspec (~> 0.4)
140
- webmock (~> 3.12, >= 3.12.2)
140
+ truemail-rspec (~> 0.6)
141
+ webmock (~> 3.13)
141
142
 
142
143
  BUNDLED WITH
143
- 1.16.6
144
+ 2.2.23
data/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
  [![GitHub](https://img.shields.io/github/license/truemail-rb/truemail)](LICENSE.txt)
11
11
  [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
12
12
 
13
- Configurable framework agnostic plain Ruby email validator. Verify email via Regex, DNS and SMTP. Be sure that email address valid and exists.
13
+ Configurable framework agnostic plain Ruby email validator. Verify email via Regex, DNS, SMTP and even more. Be sure that email address valid and exists.
14
14
 
15
15
  > Actual and maintainable documentation :books: for developers is living [here](https://truemail-rb.org/truemail-gem).
16
16
 
@@ -81,10 +81,11 @@ 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
- - Minimal runtime dependencies
84
+ - Only one runtime dependency
85
85
  - Supporting of internationalized emails ([EAI](https://en.wikipedia.org/wiki/Email_address#Internationalization))
86
86
  - Whitelist/blacklist validation layers
87
87
  - Ability to configure different MX/SMTP validation flows
88
+ - Ability to configure [DEA](https://en.wikipedia.org/wiki/Disposable_email_address) validation flow
88
89
  - Simple SMTP debugger
89
90
  - Event logger
90
91
  - Host auditor tools (helps to detect common host problems interfering to proper email verification)
@@ -177,11 +178,12 @@ Truemail.configure do |config|
177
178
 
178
179
  # Optional parameter. You can predefine default validation type for
179
180
  # Truemail.validate('email@email.com') call without with-parameter
180
- # Available validation types: :regex, :mx, :smtp
181
+ # Available validation types: :regex, :mx, :mx_blacklist, :smtp
181
182
  config.default_validation_type = :mx
182
183
 
183
184
  # Optional parameter. You can predefine which type of validation will be used for domains.
184
- # Also you can skip validation by domain. Available validation types: :regex, :mx, :smtp
185
+ # Also you can skip validation by domain.
186
+ # Available validation types: :regex, :mx, :mx_blacklist, :smtp
185
187
  # This configuration will be used over current or default validation type parameter
186
188
  # All of validations for 'somedomain.com' will be processed with regex validation only.
187
189
  # And all of validations for 'otherdomain.com' will be processed with mx validation only.
@@ -191,7 +193,7 @@ Truemail.configure do |config|
191
193
  # Optional parameter. Validation of email which contains whitelisted domain always will
192
194
  # return true. Other validations will not processed even if it was defined in validation_type_for
193
195
  # It is equal to empty array by default.
194
- config.whitelisted_domains = ['somedomain1.com', 'somedomain2.com']
196
+ config.whitelisted_domains = %w[somedomain1.com somedomain2.com]
195
197
 
196
198
  # Optional parameter. With this option Truemail will validate email which contains whitelisted
197
199
  # domain only, i.e. if domain whitelisted, validation will passed to Regex, MX or SMTP validators.
@@ -202,18 +204,18 @@ Truemail.configure do |config|
202
204
  # Optional parameter. Validation of email which contains blacklisted domain always will
203
205
  # return false. Other validations will not processed even if it was defined in validation_type_for
204
206
  # It is equal to empty array by default.
205
- config.blacklisted_domains = ['somedomain3.com', 'somedomain4.com']
207
+ config.blacklisted_domains = %w[somedomain3.com somedomain4.com]
206
208
 
207
209
  # Optional parameter. With this option Truemail will filter out unwanted mx servers via
208
210
  # predefined list of ip addresses. It can be used as a part of DEA (disposable email
209
211
  # address) validations. It is equal to empty array by default.
210
- config.blacklisted_mx_ip_addresses = ['1.1.1.1', '2.2.2.2']
212
+ config.blacklisted_mx_ip_addresses = %w[1.1.1.1 2.2.2.2]
211
213
 
212
214
  # Optional parameter. This option will provide to use custom DNS gateway when Truemail
213
215
  # interacts with DNS. Valid port numbers are in the range 1-65535. If you won't specify
214
216
  # nameserver's ports Truemail will use default DNS TCP/UDP port 53. By default Truemail
215
217
  # uses DNS gateway from system settings and this option is equal to empty array.
216
- config.dns = ['10.0.0.1', '10.0.0.2:54']
218
+ config.dns = %w[10.0.0.1 10.0.0.2:54]
217
219
 
218
220
  # Optional parameter. This option will provide to use not RFC MX lookup flow.
219
221
  # It means that MX and Null MX records will be cheked on the DNS validation layer only.
@@ -221,7 +223,7 @@ Truemail.configure do |config|
221
223
  config.not_rfc_mx_lookup_flow = true
222
224
 
223
225
  # Optional parameter. This option will provide to use smtp fail fast behaviour. When
224
- # smtp_fail_fast = true it means that truemail ends smtp validation session after first
226
+ # smtp_fail_fast = true it means that Truemail ends smtp validation session after first
225
227
  # attempt on the first mx server in any fail cases (network connection/timeout error,
226
228
  # smtp validation error). This feature helps to reduce total time of SMTP validation
227
229
  # session up to 1 second. By default this option is disabled.
@@ -349,8 +351,8 @@ require 'truemail'
349
351
 
350
352
  Truemail.configure do |config|
351
353
  config.verifier_email = 'verifier@example.com'
352
- config.whitelisted_domains = ['white-domain.com', 'somedomain.com']
353
- config.blacklisted_domains = ['black-domain.com', 'somedomain.com']
354
+ config.whitelisted_domains = %w[white-domain.com somedomain.com]
355
+ config.blacklisted_domains = %w[black-domain.com somedomain.com]
354
356
  config.validation_type_for = { 'somedomain.com' => :mx }
355
357
  end
356
358
  ```
@@ -398,7 +400,7 @@ require 'truemail'
398
400
 
399
401
  Truemail.configure do |config|
400
402
  config.verifier_email = 'verifier@example.com'
401
- config.whitelisted_domains = ['white-domain.com']
403
+ config.whitelisted_domains = %w[white-domain.com]
402
404
  config.whitelist_validation = true
403
405
  end
404
406
  ```
@@ -477,7 +479,7 @@ Truemail.validate('email@domain.com', with: :regex)
477
479
 
478
480
  ##### Blacklist case
479
481
 
480
- When email in blacklist, validation type will be redefined too. Validation result returns `false`
482
+ When email in blacklist, validation type will be redefined too. Validation result returns `false`.
481
483
 
482
484
  ```ruby
483
485
  Truemail.validate('email@black-domain.com')
@@ -575,7 +577,8 @@ Truemail.validate('email@example.com', with: :regex)
575
577
  => #<Truemail::Validator:0x000055590cc9bdb8
576
578
  @result=
577
579
  #<struct Truemail::Validator::Result
578
- success=true, email="email@example.com",
580
+ success=true,
581
+ email="email@example.com",
579
582
  domain=nil,
580
583
  mail_servers=[],
581
584
  errors={},
@@ -765,7 +768,7 @@ require 'truemail'
765
768
 
766
769
  Truemail.configure do |config|
767
770
  config.verifier_email = 'verifier@example.com'
768
- config.blacklisted_mx_ip_addresses = ['127.0.1.2']
771
+ config.blacklisted_mx_ip_addresses = %w[127.0.1.2]
769
772
  end
770
773
 
771
774
  Truemail.validate('email@example.com', with: :mx_blacklist)
data/lib/truemail/core.rb CHANGED
@@ -20,9 +20,8 @@ module Truemail
20
20
 
21
21
  module RegexConstant
22
22
  REGEX_DOMAIN = /[\p{L}0-9]+([\-.]{1}[\p{L}0-9]+)*\.\p{L}{2,63}/i.freeze
23
- REGEX_EMAIL_PATTERN = /(?=\A.{6,255}\z)(\A([\p{L}0-9]+[\w|\-.+]*)@(#{REGEX_DOMAIN})\z)/.freeze
23
+ REGEX_EMAIL_PATTERN = /(?=\A.{6,255}\z)(\A([\p{L}0-9]+[\W\w]*)@(#{REGEX_DOMAIN})\z)/.freeze
24
24
  REGEX_DOMAIN_PATTERN = /(?=\A.{4,255}\z)(\A#{REGEX_DOMAIN}\z)/.freeze
25
- REGEX_DOMAIN_FROM_EMAIL = /\A.+@(.+)\z/.freeze
26
25
  REGEX_SMTP_ERROR_BODY_PATTERN = /(?=.*550)(?=.*(user|account|customer|mailbox)).*/i.freeze
27
26
  REGEX_IP_ADDRESS = /((1\d|[1-9]|2[0-4])?\d|25[0-5])(\.\g<1>){3}/.freeze
28
27
  REGEX_IP_ADDRESS_PATTERN = /\A#{REGEX_IP_ADDRESS}\z/.freeze
@@ -40,20 +40,20 @@ module Truemail
40
40
 
41
41
  Truemail::Log::Serializer::Base::CONFIGURATION_ARRAY_ATTRS.each do |method|
42
42
  define_method(method) do
43
- value = executor_configuration.public_send(method)
44
- return if value.empty?
45
- value
43
+ executor_configuration_attr = executor_configuration.public_send(method)
44
+ return if executor_configuration_attr.empty?
45
+ executor_configuration_attr
46
46
  end
47
47
  end
48
48
 
49
49
  Truemail::Log::Serializer::Base::CONFIGURATION_REGEX_ATTRS.each do |method|
50
50
  define_method(method) do
51
- value = executor_configuration.public_send(method)
51
+ executor_configuration_attr = executor_configuration.public_send(method)
52
52
  default_pattern = Truemail::RegexConstant.const_get(
53
53
  (method.eql?(:email_pattern) ? :regex_email_pattern : :regex_smtp_error_body_pattern).upcase
54
54
  )
55
- return Truemail::Log::Serializer::Base::DEFAULT_GEM_VALUE if value.eql?(default_pattern)
56
- value
55
+ return Truemail::Log::Serializer::Base::DEFAULT_GEM_VALUE if executor_configuration_attr.eql?(default_pattern)
56
+ executor_configuration_attr
57
57
  end
58
58
  end
59
59
 
@@ -15,7 +15,7 @@ module Truemail
15
15
  private
16
16
 
17
17
  def email_domain
18
- @email_domain ||= result.email[Truemail::RegexConstant::REGEX_DOMAIN_FROM_EMAIL, 1]
18
+ @email_domain ||= result.email[Truemail::RegexConstant::REGEX_EMAIL_PATTERN, 3]
19
19
  end
20
20
 
21
21
  def whitelisted_domain?
@@ -8,7 +8,6 @@ module Truemail
8
8
 
9
9
  def run
10
10
  return false unless Truemail::Validate::Regex.check(result)
11
- result.domain = result.punycode_email[Truemail::RegexConstant::REGEX_DOMAIN_FROM_EMAIL, 1]
12
11
  return true if success(mx_lookup && domain_not_include_null_mx)
13
12
  mail_servers.clear && add_error(Truemail::Validate::Mx::ERROR)
14
13
  false
@@ -53,7 +52,10 @@ module Truemail
53
52
  end
54
53
 
55
54
  def domain
56
- result.domain
55
+ @domain ||= begin
56
+ result.domain = result.email[Truemail::RegexConstant::REGEX_EMAIL_PATTERN, 3]
57
+ result.punycode_email[Truemail::RegexConstant::REGEX_EMAIL_PATTERN, 3]
58
+ end
57
59
  end
58
60
 
59
61
  def hosts_from_mx_records?
@@ -7,7 +7,7 @@ module Truemail
7
7
 
8
8
  def run
9
9
  return false unless Truemail::Validate::Mx.check(result)
10
- return true if success(mail_servers.none?(&blacklisted_ip?))
10
+ return true if success(not_blacklisted_mail_servers?)
11
11
  add_error(Truemail::Validate::MxBlacklist::ERROR)
12
12
  false
13
13
  end
@@ -17,6 +17,10 @@ module Truemail
17
17
  def blacklisted_ip?
18
18
  ->(mail_server) { configuration.blacklisted_mx_ip_addresses.include?(mail_server) }
19
19
  end
20
+
21
+ def not_blacklisted_mail_servers?
22
+ mail_servers.none?(&blacklisted_ip?)
23
+ end
20
24
  end
21
25
  end
22
26
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Truemail
4
- VERSION = '2.4.0'
4
+ VERSION = '2.4.5'
5
5
  end
data/truemail.gemspec CHANGED
@@ -33,21 +33,21 @@ Gem::Specification.new do |spec|
33
33
 
34
34
  spec.add_runtime_dependency 'simpleidn', '~> 0.2.1'
35
35
 
36
- spec.add_development_dependency 'bundler', '~> 1.16'
36
+ spec.add_development_dependency 'bundler', '~> 2.2', '>= 2.2.23'
37
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'
38
+ spec.add_development_dependency 'dns_mock', '~> 1.3', '>= 1.3.1'
39
+ spec.add_development_dependency 'faker', '~> 2.18'
40
40
  spec.add_development_dependency 'fasterer', '~> 0.9.0'
41
41
  spec.add_development_dependency 'json_matchers', '~> 0.11.1'
42
- spec.add_development_dependency 'overcommit', '~> 0.57.0'
42
+ spec.add_development_dependency 'overcommit', '~> 0.58.0'
43
43
  spec.add_development_dependency 'pry-byebug', '~> 3.9'
44
- spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.3'
44
+ spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
45
45
  spec.add_development_dependency 'reek', '~> 6.0', '>= 6.0.4'
46
46
  spec.add_development_dependency 'rspec', '~> 3.10'
47
- spec.add_development_dependency 'rubocop', '~> 1.13'
48
- spec.add_development_dependency 'rubocop-performance', '~> 1.11'
49
- spec.add_development_dependency 'rubocop-rspec', '~> 2.3'
47
+ spec.add_development_dependency 'rubocop', '~> 1.18', '>= 1.18.3'
48
+ spec.add_development_dependency 'rubocop-performance', '~> 1.11', '>= 1.11.4'
49
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.4'
50
50
  spec.add_development_dependency 'simplecov', '~> 0.17.1'
51
- spec.add_development_dependency 'truemail-rspec', '~> 0.4'
52
- spec.add_development_dependency 'webmock', '~> 3.12', '>= 3.12.2'
51
+ spec.add_development_dependency 'truemail-rspec', '~> 0.6'
52
+ spec.add_development_dependency 'webmock', '~> 3.13'
53
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.0
4
+ version: 2.4.5
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-04-28 00:00:00.000000000 Z
11
+ date: 2021-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simpleidn
@@ -30,14 +30,20 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.16'
33
+ version: '2.2'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 2.2.23
34
37
  type: :development
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
41
  - - "~>"
39
42
  - !ruby/object:Gem::Version
40
- version: '1.16'
43
+ version: '2.2'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 2.2.23
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: bundler-audit
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -58,34 +64,34 @@ dependencies:
58
64
  requirements:
59
65
  - - "~>"
60
66
  - !ruby/object:Gem::Version
61
- version: '1.2'
67
+ version: '1.3'
62
68
  - - ">="
63
69
  - !ruby/object:Gem::Version
64
- version: 1.2.1
70
+ version: 1.3.1
65
71
  type: :development
66
72
  prerelease: false
67
73
  version_requirements: !ruby/object:Gem::Requirement
68
74
  requirements:
69
75
  - - "~>"
70
76
  - !ruby/object:Gem::Version
71
- version: '1.2'
77
+ version: '1.3'
72
78
  - - ">="
73
79
  - !ruby/object:Gem::Version
74
- version: 1.2.1
80
+ version: 1.3.1
75
81
  - !ruby/object:Gem::Dependency
76
82
  name: faker
77
83
  requirement: !ruby/object:Gem::Requirement
78
84
  requirements:
79
85
  - - "~>"
80
86
  - !ruby/object:Gem::Version
81
- version: '2.17'
87
+ version: '2.18'
82
88
  type: :development
83
89
  prerelease: false
84
90
  version_requirements: !ruby/object:Gem::Requirement
85
91
  requirements:
86
92
  - - "~>"
87
93
  - !ruby/object:Gem::Version
88
- version: '2.17'
94
+ version: '2.18'
89
95
  - !ruby/object:Gem::Dependency
90
96
  name: fasterer
91
97
  requirement: !ruby/object:Gem::Requirement
@@ -120,14 +126,14 @@ dependencies:
120
126
  requirements:
121
127
  - - "~>"
122
128
  - !ruby/object:Gem::Version
123
- version: 0.57.0
129
+ version: 0.58.0
124
130
  type: :development
125
131
  prerelease: false
126
132
  version_requirements: !ruby/object:Gem::Requirement
127
133
  requirements:
128
134
  - - "~>"
129
135
  - !ruby/object:Gem::Version
130
- version: 0.57.0
136
+ version: 0.58.0
131
137
  - !ruby/object:Gem::Dependency
132
138
  name: pry-byebug
133
139
  requirement: !ruby/object:Gem::Requirement
@@ -151,7 +157,7 @@ dependencies:
151
157
  version: '13.0'
152
158
  - - ">="
153
159
  - !ruby/object:Gem::Version
154
- version: 13.0.3
160
+ version: 13.0.6
155
161
  type: :development
156
162
  prerelease: false
157
163
  version_requirements: !ruby/object:Gem::Requirement
@@ -161,7 +167,7 @@ dependencies:
161
167
  version: '13.0'
162
168
  - - ">="
163
169
  - !ruby/object:Gem::Version
164
- version: 13.0.3
170
+ version: 13.0.6
165
171
  - !ruby/object:Gem::Dependency
166
172
  name: reek
167
173
  requirement: !ruby/object:Gem::Requirement
@@ -202,14 +208,20 @@ dependencies:
202
208
  requirements:
203
209
  - - "~>"
204
210
  - !ruby/object:Gem::Version
205
- version: '1.13'
211
+ version: '1.18'
212
+ - - ">="
213
+ - !ruby/object:Gem::Version
214
+ version: 1.18.3
206
215
  type: :development
207
216
  prerelease: false
208
217
  version_requirements: !ruby/object:Gem::Requirement
209
218
  requirements:
210
219
  - - "~>"
211
220
  - !ruby/object:Gem::Version
212
- version: '1.13'
221
+ version: '1.18'
222
+ - - ">="
223
+ - !ruby/object:Gem::Version
224
+ version: 1.18.3
213
225
  - !ruby/object:Gem::Dependency
214
226
  name: rubocop-performance
215
227
  requirement: !ruby/object:Gem::Requirement
@@ -217,6 +229,9 @@ dependencies:
217
229
  - - "~>"
218
230
  - !ruby/object:Gem::Version
219
231
  version: '1.11'
232
+ - - ">="
233
+ - !ruby/object:Gem::Version
234
+ version: 1.11.4
220
235
  type: :development
221
236
  prerelease: false
222
237
  version_requirements: !ruby/object:Gem::Requirement
@@ -224,20 +239,23 @@ dependencies:
224
239
  - - "~>"
225
240
  - !ruby/object:Gem::Version
226
241
  version: '1.11'
242
+ - - ">="
243
+ - !ruby/object:Gem::Version
244
+ version: 1.11.4
227
245
  - !ruby/object:Gem::Dependency
228
246
  name: rubocop-rspec
229
247
  requirement: !ruby/object:Gem::Requirement
230
248
  requirements:
231
249
  - - "~>"
232
250
  - !ruby/object:Gem::Version
233
- version: '2.3'
251
+ version: '2.4'
234
252
  type: :development
235
253
  prerelease: false
236
254
  version_requirements: !ruby/object:Gem::Requirement
237
255
  requirements:
238
256
  - - "~>"
239
257
  - !ruby/object:Gem::Version
240
- version: '2.3'
258
+ version: '2.4'
241
259
  - !ruby/object:Gem::Dependency
242
260
  name: simplecov
243
261
  requirement: !ruby/object:Gem::Requirement
@@ -258,34 +276,28 @@ dependencies:
258
276
  requirements:
259
277
  - - "~>"
260
278
  - !ruby/object:Gem::Version
261
- version: '0.4'
279
+ version: '0.6'
262
280
  type: :development
263
281
  prerelease: false
264
282
  version_requirements: !ruby/object:Gem::Requirement
265
283
  requirements:
266
284
  - - "~>"
267
285
  - !ruby/object:Gem::Version
268
- version: '0.4'
286
+ version: '0.6'
269
287
  - !ruby/object:Gem::Dependency
270
288
  name: webmock
271
289
  requirement: !ruby/object:Gem::Requirement
272
290
  requirements:
273
291
  - - "~>"
274
292
  - !ruby/object:Gem::Version
275
- version: '3.12'
276
- - - ">="
277
- - !ruby/object:Gem::Version
278
- version: 3.12.2
293
+ version: '3.13'
279
294
  type: :development
280
295
  prerelease: false
281
296
  version_requirements: !ruby/object:Gem::Requirement
282
297
  requirements:
283
298
  - - "~>"
284
299
  - !ruby/object:Gem::Version
285
- version: '3.12'
286
- - - ">="
287
- - !ruby/object:Gem::Version
288
- version: 3.12.2
300
+ version: '3.13'
289
301
  description: Configurable framework agnostic plain Ruby email validator. Verify email
290
302
  via Regex, DNS, SMTP and even more.
291
303
  email:
@@ -375,8 +387,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
375
387
  - !ruby/object:Gem::Version
376
388
  version: '0'
377
389
  requirements: []
378
- rubyforge_project:
379
- rubygems_version: 2.7.3
390
+ rubygems_version: 3.2.20
380
391
  signing_key:
381
392
  specification_version: 4
382
393
  summary: truemail