truemail 1.9.0 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,28 +6,28 @@ Following these guidelines helps to communicate that you respect the time of the
6
6
 
7
7
  ## Using the issue tracker
8
8
 
9
- The issue tracker is the preferred channel for [bug reports](#bugs), [features requests](#features) and [submitting pull requests](#pull-requests).
9
+ The issue tracker is the preferred channel for [issue/bug reports](#issuebug-reports), [feature requests](#feature-requests), [questions](#questions) and submitting [pull requests](#pull-requests).
10
10
 
11
- <a name="bugs"></a>
12
- ## Bug/issue reports
11
+ ## Issue/bug reports
13
12
 
14
- A bug is a _demonstrable problem_ that is caused by the code in the repository.
15
- Good bug reports are extremely helpful - thank you!
13
+ A bug is a _demonstrable problem_ that is caused by the code in the repository. Good bug reports are extremely helpful - thank you!
16
14
 
17
- Guidelines for bug reports:
15
+ Guidelines for issue/bug reports:
18
16
 
19
17
  1. **Use the GitHub issue search** &mdash; check if the issue has already been reported
20
- 2. **Check if the issue has been fixed** &mdash; try to reproduce it using the latest `master` or development branch in the repository
21
- 3. Truemail [issue template](.github/ISSUE_TEMPLATE.md)
18
+ 2. **Check if the issue has been fixed** &mdash; try to reproduce it using the latest `master` or `develop` branch in the repository
19
+ 3. Truemail [issue template](.github/ISSUE_TEMPLATE/issue_report.md)/[bug template](.github/ISSUE_TEMPLATE/bug_report.md)
22
20
 
23
21
  A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What would you expect to be the outcome? All these details will help people to fix any potential bugs.
24
22
 
25
- <a name="features"></a>
26
23
  ## Feature requests
27
24
 
28
25
  Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to *you* to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible.
29
26
 
30
- <a name="pull-requests"></a>
27
+ ## Questions
28
+
29
+ We're always open to a new conversations. So if you have any questions just ask us.
30
+
31
31
  ## Pull requests
32
32
 
33
33
  Good pull requests - patches, improvements, new features - are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.
@@ -39,7 +39,8 @@ Please adhere to the coding conventions used throughout a project (indentation,
39
39
  Guidelines for pull requests:
40
40
 
41
41
  1. Truemail [pull request template](.github/PULL_REQUEST_TEMPLATE.md)
42
- 2. Fork the repo
43
- 3. Run the tests. This is to make sure your starting point works. Tests can be run via ```rspec```
44
- 4. Create a new branch and make your changes. This includes tests for features!
45
- 5. Push to your fork and submit a pull request
42
+ 2. Fork the repo, checkout to `develop` branch
43
+ 3. Run the tests. This is to make sure your starting point works
44
+ 4. Read our [branch naming convention](.github/BRANCH_NAMING_CONVENTION.md)
45
+ 5. Create a new branch and make your changes. This includes tests for features!
46
+ 6. Push to your fork and submit a pull request to `develop` branch
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- truemail (1.9.0)
4
+ truemail (2.0.2)
5
5
  simpleidn (~> 0.1.1)
6
6
 
7
7
  GEM
@@ -28,11 +28,11 @@ GEM
28
28
  json_schema (0.20.9)
29
29
  kwalify (0.7.2)
30
30
  method_source (1.0.0)
31
- overcommit (0.55.0)
31
+ overcommit (0.57.0)
32
32
  childprocess (>= 0.6.3, < 5)
33
33
  iniparse (~> 1.4)
34
- parallel (1.19.2)
35
- parser (2.7.1.4)
34
+ parallel (1.20.0)
35
+ parser (2.7.2.0)
36
36
  ast (~> 2.4.1)
37
37
  pry (0.13.1)
38
38
  coderay (~> 1.1)
@@ -40,48 +40,50 @@ GEM
40
40
  pry-byebug (3.9.0)
41
41
  byebug (~> 11.0)
42
42
  pry (~> 0.13.0)
43
- psych (3.1.0)
43
+ psych (3.2.0)
44
44
  rainbow (3.0.0)
45
45
  rake (13.0.1)
46
- reek (6.0.1)
46
+ reek (6.0.2)
47
47
  kwalify (~> 0.7.0)
48
48
  parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
49
- psych (~> 3.1.0)
49
+ psych (~> 3.1)
50
50
  rainbow (>= 2.0, < 4.0)
51
- regexp_parser (1.7.1)
51
+ regexp_parser (1.8.2)
52
52
  rexml (3.2.4)
53
- rspec (3.9.0)
54
- rspec-core (~> 3.9.0)
55
- rspec-expectations (~> 3.9.0)
56
- rspec-mocks (~> 3.9.0)
57
- rspec-core (3.9.2)
58
- rspec-support (~> 3.9.3)
59
- rspec-expectations (3.9.2)
53
+ rspec (3.10.0)
54
+ rspec-core (~> 3.10.0)
55
+ rspec-expectations (~> 3.10.0)
56
+ rspec-mocks (~> 3.10.0)
57
+ rspec-core (3.10.0)
58
+ rspec-support (~> 3.10.0)
59
+ rspec-expectations (3.10.0)
60
60
  diff-lcs (>= 1.2.0, < 2.0)
61
- rspec-support (~> 3.9.0)
62
- rspec-mocks (3.9.1)
61
+ rspec-support (~> 3.10.0)
62
+ rspec-mocks (3.10.0)
63
63
  diff-lcs (>= 1.2.0, < 2.0)
64
- rspec-support (~> 3.9.0)
65
- rspec-support (3.9.3)
66
- rubocop (0.89.1)
64
+ rspec-support (~> 3.10.0)
65
+ rspec-support (3.10.0)
66
+ rubocop (1.3.0)
67
67
  parallel (~> 1.10)
68
- parser (>= 2.7.1.1)
68
+ parser (>= 2.7.1.5)
69
69
  rainbow (>= 2.2.2, < 4.0)
70
- regexp_parser (>= 1.7)
70
+ regexp_parser (>= 1.8)
71
71
  rexml
72
- rubocop-ast (>= 0.3.0, < 1.0)
72
+ rubocop-ast (>= 1.1.1)
73
73
  ruby-progressbar (~> 1.7)
74
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)
75
+ rubocop-ast (1.1.1)
76
+ parser (>= 2.7.1.5)
77
+ rubocop-performance (1.8.1)
78
+ rubocop (>= 0.87.0)
79
+ rubocop-ast (>= 0.4.0)
80
+ rubocop-rspec (2.0.0)
81
+ rubocop (~> 1.0)
82
+ rubocop-ast (>= 1.1.0)
81
83
  ruby-progressbar (1.10.1)
82
- ruby_parser (3.14.2)
84
+ ruby_parser (3.15.0)
83
85
  sexp_processor (~> 4.9)
84
- sexp_processor (4.15.0)
86
+ sexp_processor (4.15.1)
85
87
  simplecov (0.17.1)
86
88
  docile (~> 1.1)
87
89
  json (>= 1.8, < 3)
@@ -90,7 +92,7 @@ GEM
90
92
  simpleidn (0.1.1)
91
93
  unf (~> 0.1.4)
92
94
  thor (1.0.1)
93
- truemail-rspec (0.2.0)
95
+ truemail-rspec (0.2.1)
94
96
  rspec (~> 3.9)
95
97
  truemail (~> 1.4, >= 1.4.1)
96
98
  unf (0.1.4)
@@ -107,17 +109,17 @@ DEPENDENCIES
107
109
  fasterer (~> 0.8.3)
108
110
  ffaker (~> 2.17)
109
111
  json_matchers (~> 0.11.1)
110
- overcommit (~> 0.55.0)
112
+ overcommit (~> 0.57.0)
111
113
  pry-byebug (~> 3.9)
112
114
  rake (~> 13.0, >= 13.0.1)
113
- reek (~> 6.0, >= 6.0.1)
114
- rspec (~> 3.9)
115
- rubocop (~> 0.89.1)
116
- rubocop-performance (~> 1.7, >= 1.7.1)
117
- rubocop-rspec (~> 1.43, >= 1.43.2)
115
+ reek (~> 6.0, >= 6.0.2)
116
+ rspec (~> 3.10)
117
+ rubocop (~> 1.3)
118
+ rubocop-performance (~> 1.8, >= 1.8.1)
119
+ rubocop-rspec (~> 2.0)
118
120
  simplecov (~> 0.17.1)
119
121
  truemail!
120
- truemail-rspec (~> 0.2.0)
122
+ truemail-rspec (~> 0.2.1)
121
123
 
122
124
  BUNDLED WITH
123
125
  1.16.6
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019 Vladislav Trotsenko
3
+ Copyright (c) 2019-2020 Vladislav Trotsenko
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,9 +1,19 @@
1
- ![Truemail - configurable framework agnostic plain Ruby email validator](https://truemail-rb.org/assets/images/truemail_logo.png)
2
-
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)
1
+ # ![Truemail - configurable framework agnostic plain Ruby email validator](https://truemail-rb.org/assets/images/truemail_logo.png)
2
+
3
+ [![Maintainability](https://api.codeclimate.com/v1/badges/0fea6d2e64d78d66b149/maintainability)](https://codeclimate.com/github/truemail-rb/truemail/maintainability)
4
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/0fea6d2e64d78d66b149/test_coverage)](https://codeclimate.com/github/truemail-rb/truemail/test_coverage)
5
+ [![CircleCI](https://circleci.com/gh/truemail-rb/truemail/tree/master.svg?style=svg)](https://circleci.com/gh/truemail-rb/truemail/tree/master)
6
+ [![Gem Version](https://badge.fury.io/rb/truemail.svg)](https://badge.fury.io/rb/truemail)
7
+ [![Downloads](https://img.shields.io/gem/dt/truemail.svg?colorA=004d99&colorB=0073e6)](https://rubygems.org/gems/truemail)
8
+ [![SemVer compatibility](https://api.dependabot.com/badges/compatibility_score?dependency-name=truemail&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=truemail&package-manager=bundler&version-scheme=semver)
9
+ [![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)
10
+ [![GitHub](https://img.shields.io/github/license/truemail-rb/truemail)](LICENSE.txt)
11
+ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
4
12
 
5
13
  Configurable framework agnostic plain Ruby email validator. Verify email via Regex, DNS and SMTP. Be sure that email address valid and exists.
6
14
 
15
+ > Actual and maintainable documentation :books: for developers is living [here](https://truemail-rb.org/truemail-gem).
16
+
7
17
  ## Table of Contents
8
18
 
9
19
  - [Synopsis](#synopsis)
@@ -53,7 +63,6 @@ Configurable framework agnostic plain Ruby email validator. Verify email via Reg
53
63
  - [Credits](#credits)
54
64
  - [Versioning](#versioning)
55
65
  - [Changelog](CHANGELOG.md)
56
- - [Developers Documentation](https://truemail-rb.org/truemail-gem/)
57
66
 
58
67
  ## Synopsis
59
68
 
@@ -126,7 +135,7 @@ You can use global gem configuration or custom independent configuration. Availa
126
135
 
127
136
  #### Setting global configuration
128
137
 
129
- To have an access for ```Truemail.configuration``` and gem configuration features, you must configure it first as in the example below:
138
+ To have an access for `Truemail.configuration` and gem configuration features, you must configure it first as in the example below:
130
139
 
131
140
  ```ruby
132
141
  require 'truemail'
@@ -145,10 +154,12 @@ Truemail.configure do |config|
145
154
  # Optional parameter. You can override default regex pattern
146
155
  config.smtp_error_body_pattern = /regex_pattern/
147
156
 
148
- # Optional parameter. Connection timeout is equal to 2 ms by default.
157
+ # Optional parameter. Connection timeout in seconds.
158
+ # It is equal to 2 by default.
149
159
  config.connection_timeout = 1
150
160
 
151
- # Optional parameter. A SMTP server response timeout is equal to 2 ms by default.
161
+ # Optional parameter. A SMTP server response timeout in seconds.
162
+ # It is equal to 2 by default.
152
163
  config.response_timeout = 1
153
164
 
154
165
  # Optional parameter. Total of connection attempts. It is equal to 2 by default.
@@ -288,11 +299,12 @@ Please note, you should have global or custom configuration for use Truemail gem
288
299
 
289
300
  #### Whitelist/Blacklist check
290
301
 
291
- Whitelist/Blacklist check is zero validation level. You can define white and black list domains. It means that validation of email which contains whitelisted domain always will return ```true```, and for blacklisted domain will return ```false```.
302
+ Whitelist/Blacklist check is zero validation level. You can define white and black list domains. It means that validation of email which contains whitelisted domain always will return `true`, and for blacklisted domain will return `false`.
292
303
 
293
- Please note, other validations will not processed even if it was defined in ```validation_type_for```.
304
+ Please note, other validations will not processed even if it was defined in `validation_type_for`.
294
305
 
295
306
  **Sequence of domain list check:**
307
+
296
308
  1. Whitelist check
297
309
  2. Whitelist validation check
298
310
  3. Blacklist check
@@ -355,8 +367,7 @@ Truemail.configure do |config|
355
367
  end
356
368
  ```
357
369
 
358
- When email domain in whitelist and ```whitelist_validation``` is sets equal to ```true``` validation type will be passed to other validators.
359
- Validation of email which not contains whitelisted domain always will return ```false```.
370
+ When email domain in whitelist and `whitelist_validation` is sets equal to `true` validation type will be passed to other validators. Validation of email which not contains whitelisted domain always will return `false`.
360
371
 
361
372
  ###### Email has whitelisted domain
362
373
 
@@ -458,7 +469,7 @@ Truemail.validate('email@black-domain.com')
458
469
 
459
470
  ##### Duplication case
460
471
 
461
- Validation result for this email returns ```true```, because it was found in whitelisted domains list first. Also ```validation_type``` for this case will be redefined.
472
+ Validation result for this email returns `true`, because it was found in whitelisted domains list first. Also `validation_type` for this case will be redefined.
462
473
 
463
474
  ```ruby
464
475
  Truemail.validate('email@somedomain.com')
@@ -590,7 +601,7 @@ In fact it's DNS validation because it checks not MX records only. DNS validatio
590
601
  [Whitelist/Blacklist] -> [Regex validation] -> [MX validation]
591
602
  ```
592
603
 
593
- Please note, Truemail MX validator [not performs](https://github.com/rubygarage/truemail/issues/26) strict compliance of the [RFC 5321](https://tools.ietf.org/html/rfc5321#section-5) standard for best validation outcome.
604
+ Please note, Truemail MX validator [not performs](https://github.com/truemail-rb/truemail/issues/26) strict compliance of the [RFC 5321](https://tools.ietf.org/html/rfc5321#section-5) standard for best validation outcome.
594
605
 
595
606
  ##### RFC MX lookup flow
596
607
 
@@ -687,13 +698,13 @@ SMTP validation is a final, third validation level. This type of validation trie
687
698
  [Whitelist/Blacklist] -> [Regex validation] -> [MX validation] -> [SMTP validation]
688
699
  ```
689
700
 
690
- If total count of MX servers is equal to one, ```Truemail::Smtp``` validator will use value from ```Truemail.configuration.connection_attempts``` as connection attempts. By default it's equal 2.
701
+ If total count of MX servers is equal to one, `Truemail::Smtp` validator will use value from `Truemail.configuration.connection_attempts` as connection attempts. By default it's equal `2`.
691
702
 
692
703
  By default, you don't need pass with-parameter to use it. Example of usage is specified below:
693
704
 
694
705
  ##### SMTP safe check disabled
695
706
 
696
- With ```smtp_safe_check = false```
707
+ With `smtp_safe_check = false`
697
708
 
698
709
  ```ruby
699
710
  require 'truemail'
@@ -756,10 +767,7 @@ Truemail.validate('email@example.com')
756
767
  #<struct Truemail::Validate::Smtp::Response
757
768
  port_opened=true,
758
769
  connection=true,
759
- helo=
760
- #<Net::SMTP::Response:0x0000000002d5aca8
761
- @status="250",
762
- @string="250 127.0.1.1 Hello example.com\n">,
770
+ helo=true,
763
771
  mailfrom=
764
772
  #<Net::SMTP::Response:0x0000000002d5a618
765
773
  @status="250",
@@ -787,7 +795,7 @@ Truemail.validate('email@example.com')
787
795
 
788
796
  ##### SMTP safe check enabled
789
797
 
790
- With ```smtp_safe_check = true```
798
+ With `smtp_safe_check = true`
791
799
 
792
800
  ```ruby
793
801
  require 'truemail'
@@ -823,10 +831,7 @@ Truemail.validate('email@example.com')
823
831
  #<struct Truemail::Validate::Smtp::Response
824
832
  port_opened=true,
825
833
  connection=false,
826
- helo=
827
- #<Net::SMTP::Response:0x0000000002c934c8
828
- @status="250",
829
- @string="250 127.0.1.1\n">,
834
+ helo=true,
830
835
  mailfrom=false,
831
836
  rcptto=nil,
832
837
  errors={:mailfrom=>"554 5.7.1 Client host blocked\n", :connection=>"server dropped connection after response"}>>,]>,
@@ -872,10 +877,7 @@ Truemail.validate('email@example.com')
872
877
  #<struct Truemail::Validate::Smtp::Response
873
878
  port_opened=true,
874
879
  connection=true,
875
- helo=
876
- #<Net::SMTP::Response:0x0000000002d5aca8
877
- @status="250",
878
- @string="250 127.0.1.1 Hello example.com\n">,
880
+ helo=true,
879
881
  mailfrom=#<Net::SMTP::Response:0x0000000002d5a618 @status="250", @string="250 OK\n">,
880
882
  rcptto=false,
881
883
  errors={:rcptto=>"550 User not found\n"}>>]>,
@@ -1173,11 +1175,12 @@ All Truemail solutions: https://truemail-rb.org
1173
1175
  | [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 |
1174
1176
  | [truemail-ruby-client](https://github.com/truemail-rb/truemail-ruby-client) | ruby gem | Web API Ruby client for Truemail Server |
1175
1177
  | [truemail-crystal-client](https://github.com/truemail-rb/truemail-crystal-client) | crystal shard | Web API Crystal client for Truemail Server |
1178
+ | [truemail-java-client](https://github.com/truemail-rb/truemail-java-client) | java lib | Web API Java client for Truemail Server |
1176
1179
  | [truemail-rspec](https://github.com/truemail-rb/truemail-rspec) | ruby gem | Truemail configuration, auditor and validator RSpec helpers |
1177
1180
 
1178
1181
  ## Contributing
1179
1182
 
1180
- Bug reports and pull requests are welcome on GitHub at https://github.com/rubygarage/truemail. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. Please check the [open tikets](https://github.com/rubygarage/truemail/issues). Be shure to follow Contributor Code of Conduct below and our [Contributing Guidelines](CONTRIBUTING.md).
1183
+ Bug reports and pull requests are welcome on GitHub at https://github.com/truemail-rb/truemail. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. Please check the [open tikets](https://github.com/truemail-rb/truemail/issues). Be shure to follow Contributor Code of Conduct below and our [Contributing Guidelines](CONTRIBUTING.md).
1181
1184
 
1182
1185
  ## License
1183
1186
 
@@ -1189,8 +1192,8 @@ Everyone interacting in the Truemail project’s codebases, issue trackers, chat
1189
1192
 
1190
1193
  ## Credits
1191
1194
 
1192
- - [The Contributors](https://github.com/rubygarage/truemail/graphs/contributors) for code and awesome suggestions
1193
- - [The Stargazers](https://github.com/rubygarage/truemail/stargazers) for showing their support
1195
+ - [The Contributors](https://github.com/truemail-rb/truemail/graphs/contributors) for code and awesome suggestions
1196
+ - [The Stargazers](https://github.com/truemail-rb/truemail/stargazers) for showing their support
1194
1197
 
1195
1198
  ## Versioning
1196
1199
 
@@ -5,6 +5,7 @@ require_relative 'truemail/core'
5
5
  module Truemail
6
6
  INCOMPLETE_CONFIG = 'verifier_email is required parameter'
7
7
  NOT_CONFIGURED = 'use Truemail.configure before or pass custom configuration'
8
+ INVALID_TYPE = 'email should be a String'
8
9
 
9
10
  class << self
10
11
  def configuration(&block)
@@ -25,10 +26,12 @@ module Truemail
25
26
  end
26
27
 
27
28
  def validate(email, custom_configuration: nil, **options)
29
+ check_argument_type(email)
28
30
  Truemail::Validator.new(email, configuration: determine_configuration(custom_configuration), **options).run
29
31
  end
30
32
 
31
33
  def valid?(email, **options)
34
+ check_argument_type(email)
32
35
  validate(email, **options).result.valid?
33
36
  end
34
37
 
@@ -38,8 +41,12 @@ module Truemail
38
41
 
39
42
  private
40
43
 
41
- def raise_unless(condition, message)
42
- raise Truemail::ConfigurationError, message unless condition
44
+ def raise_unless(condition, message, error_class = Truemail::ConfigurationError)
45
+ raise error_class, message unless condition
46
+ end
47
+
48
+ def check_argument_type(argument)
49
+ raise_unless(argument.is_a?(String), Truemail::INVALID_TYPE, Truemail::TypeError)
43
50
  end
44
51
 
45
52
  def determine_configuration(custom_configuration)
@@ -6,6 +6,7 @@ module Truemail
6
6
  DEFAULT_RESPONSE_TIMEOUT = 2
7
7
  DEFAULT_CONNECTION_ATTEMPTS = 2
8
8
  DEFAULT_VALIDATION_TYPE = :smtp
9
+ DEFAULT_LOGGER_OPTIONS = { tracking_event: :error, stdout: false, log_absolute_path: nil }.freeze
9
10
 
10
11
  attr_reader :email_pattern,
11
12
  :smtp_error_body_pattern,
@@ -71,7 +72,8 @@ module Truemail
71
72
  end
72
73
  end
73
74
 
74
- def logger=(tracking_event: :error, stdout: false, log_absolute_path: nil)
75
+ def logger=(options)
76
+ tracking_event, stdout, log_absolute_path = logger_options(options)
75
77
  valid_event = Truemail::Log::Event::TRACKING_EVENTS.key?(tracking_event)
76
78
  stdout_only = stdout && log_absolute_path.nil?
77
79
  file_only = log_absolute_path.is_a?(String)
@@ -140,5 +142,9 @@ module Truemail
140
142
  check_validation_type(validation_type)
141
143
  end
142
144
  end
145
+
146
+ def logger_options(current_options)
147
+ Truemail::Configuration::DEFAULT_LOGGER_OPTIONS.merge(current_options).values
148
+ end
143
149
  end
144
150
  end
@@ -11,6 +11,7 @@ module Truemail
11
11
  require_relative '../truemail/logger'
12
12
 
13
13
  ConfigurationError = Class.new(StandardError)
14
+ TypeError = Class.new(StandardError)
14
15
 
15
16
  ArgumentError = Class.new(StandardError) do
16
17
  def initialize(arg_value, arg_name)
@@ -31,7 +32,7 @@ module Truemail
31
32
 
32
33
  module RegexConstant
33
34
  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
35
+ REGEX_EMAIL_PATTERN = /(?=\A.{6,255}\z)(\A([\p{L}0-9]+[\w|\-.+]*)@(#{REGEX_DOMAIN})\z)/.freeze
35
36
  REGEX_DOMAIN_PATTERN = /(?=\A.{4,255}\z)(\A#{REGEX_DOMAIN}\z)/.freeze
36
37
  REGEX_DOMAIN_FROM_EMAIL = /\A.+@(.+)\z/.freeze
37
38
  REGEX_SMTP_ERROR_BODY_PATTERN = /(?=.*550)(?=.*(user|account|customer|mailbox)).*/i.freeze