rails_email_checker 0.1.0 → 0.1.1
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 +4 -4
- data/.coveralls.yml +2 -0
- data/.travis.yml +10 -2
- data/Gemfile.lock +1 -1
- data/README.md +44 -7
- data/gemfiles/Gemfile-4-0 +5 -0
- data/gemfiles/Gemfile-5-0 +5 -0
- data/gemfiles/Gemfile-6-0 +5 -0
- data/lib/rails_email_checker/configuration.rb +16 -12
- data/lib/rails_email_checker/version.rb +1 -1
- data/rails_email_checker.gemspec +1 -1
- metadata +13 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f2b0c96266900173ed82fc4ec68d6bebfebae8c6f1396abb1d51acab04eccbb
|
4
|
+
data.tar.gz: ab4f7b894904731b4cdc8622ca263b1192cd6e0162f6a64b3c362e2574a9efae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25268d069850488ebadad8deeb78bb0d7b91c8c0f9a66b2506bc9ae8aeecd19faacf825558dae8dbeed6b97aebd79d18a056455255d7b45783a4bfe6019950ec
|
7
|
+
data.tar.gz: 507818fcc7dbb885894e17c4e94889950c56b7ad726397d8e6752b65d091e53945aef567c9754726e8080727e4b58f4cf11c78b15df86fffb1057017914ce1cf
|
data/.coveralls.yml
ADDED
data/.travis.yml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
2
|
+
os: linux
|
3
3
|
language: ruby
|
4
4
|
cache: bundler
|
5
5
|
rvm:
|
6
|
+
- 2.5.5
|
6
7
|
- 2.6.3
|
7
|
-
|
8
|
+
- 2.7.0
|
9
|
+
gemfile:
|
10
|
+
- gemfiles/Gemfile-4-0
|
11
|
+
- gemfiles/Gemfile-5-0
|
12
|
+
- gemfiles/Gemfile-6-0
|
13
|
+
before_install: gem install bundler
|
14
|
+
before_script: bundle install
|
15
|
+
script: bundle exec rspec
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
# RailsEmailChecker
|
2
2
|
|
3
|
-
|
3
|
+
[](https://badge.fury.io/rb/redis_web_manager)
|
4
|
+
[](https://codeclimate.com/github/OpenGems/rails_email_checker/maintainability)
|
5
|
+
[](https://travis-ci.org/OpenGems/redis_web_manager)
|
6
|
+
[](https://hakiri.io/github/OpenGems/redis_web_manager/master)
|
7
|
+

|
8
|
+
[](https://coveralls.io/github/OpenGems/rails_email_checker?branch=master)
|
4
9
|
|
5
|
-
|
10
|
+
ActiveModel email validation. Checks MX records, sub address, regex, whitelisted and blacklisted check
|
6
11
|
|
7
12
|
## Installation
|
8
13
|
|
@@ -22,17 +27,49 @@ Or install it yourself as:
|
|
22
27
|
|
23
28
|
## Usage
|
24
29
|
|
25
|
-
|
30
|
+
### Use with ActiveModel
|
26
31
|
|
27
|
-
|
32
|
+
To validate that the domain has a good format (regex):
|
33
|
+
```ruby
|
34
|
+
class User < ActiveRecord::Base
|
35
|
+
validates_email :email, formatted: true
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
39
|
+
To validate that the domain is not blacklisted:
|
40
|
+
```ruby
|
41
|
+
class User < ActiveRecord::Base
|
42
|
+
validates_email :email, blacklisted: true
|
43
|
+
end
|
44
|
+
```
|
45
|
+
|
46
|
+
To validate that the domain has a MX record:
|
47
|
+
```ruby
|
48
|
+
class User < ActiveRecord::Base
|
49
|
+
validates_email :email, recorded: true
|
50
|
+
end
|
51
|
+
```
|
28
52
|
|
29
|
-
|
53
|
+
To validate that email is not sub addressed:
|
54
|
+
```ruby
|
55
|
+
class User < ActiveRecord::Base
|
56
|
+
validates_email :email, no_sub_addressed: true
|
57
|
+
end
|
58
|
+
```
|
30
59
|
|
31
|
-
|
60
|
+
### Use without ActiveModel
|
61
|
+
```ruby
|
62
|
+
address = RailsEmailChecker.address('test@gmail.com') # or RailsEmailChecker::Address.new('test@gmail.com')
|
63
|
+
address.formatted? # => true
|
64
|
+
address.sub_addressed? # => false
|
65
|
+
address.recorded? # => true
|
66
|
+
address.whitelisted? # => false
|
67
|
+
address.blacklisted? # => false
|
68
|
+
```
|
32
69
|
|
33
70
|
## Contributing
|
34
71
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
72
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/OpenGems/rails_email_checker. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
|
36
73
|
|
37
74
|
## License
|
38
75
|
|
@@ -15,21 +15,15 @@ module RailsEmailChecker
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def add_blacklist_domains(path: nil, domains: nil)
|
18
|
-
raise ListArgument, 'Path
|
19
|
-
|
20
|
-
unless domains.nil?
|
21
|
-
@blacklist_domains.concat(domains) if domains.is_a?(Array)
|
22
|
-
@blacklist_domains << domains if domains.is_a?(String)
|
23
|
-
end
|
18
|
+
raise ListArgument, 'Path or domains are nil' if valid_argument?(path, domains)
|
19
|
+
add_blacklist(load_domains(path)) unless path.nil?
|
20
|
+
add_blacklist(domains) unless domains.nil?
|
24
21
|
end
|
25
22
|
|
26
23
|
def add_whitelist_domains(path: nil, domains: nil)
|
27
|
-
raise ListArgument, 'Path
|
28
|
-
|
29
|
-
unless domains.nil?
|
30
|
-
@whitelist_domains.concat(domains) if domains.is_a?(Array)
|
31
|
-
@whitelist_domains << domains if domains.is_a?(String)
|
32
|
-
end
|
24
|
+
raise ListArgument, 'Path or domains are nil' if valid_argument?(path, domains)
|
25
|
+
add_whitelist(load_domains(path)) unless path.nil?
|
26
|
+
add_whitelist(domains) unless domains.nil?
|
33
27
|
end
|
34
28
|
|
35
29
|
private
|
@@ -57,5 +51,15 @@ module RailsEmailChecker
|
|
57
51
|
rescue StandardError => e
|
58
52
|
raise FileNotFound, "File not found: #{e}"
|
59
53
|
end
|
54
|
+
|
55
|
+
def add_blacklist(domains)
|
56
|
+
@blacklist_domains.concat(domains) if domains.is_a?(Array)
|
57
|
+
@blacklist_domains << domains if domains.is_a?(String)
|
58
|
+
end
|
59
|
+
|
60
|
+
def add_whitelist(domains)
|
61
|
+
@whitelist_domains.concat(domains) if domains.is_a?(Array)
|
62
|
+
@whitelist_domains << domains if domains.is_a?(String)
|
63
|
+
end
|
60
64
|
end
|
61
65
|
end
|
data/rails_email_checker.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_email_checker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boris BRESCIANI
|
@@ -84,16 +84,22 @@ dependencies:
|
|
84
84
|
name: activemodel
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '4.2'
|
90
|
+
- - "<"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '7'
|
90
93
|
type: :runtime
|
91
94
|
prerelease: false
|
92
95
|
version_requirements: !ruby/object:Gem::Requirement
|
93
96
|
requirements:
|
94
|
-
- - "
|
97
|
+
- - ">="
|
95
98
|
- !ruby/object:Gem::Version
|
96
99
|
version: '4.2'
|
100
|
+
- - "<"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '7'
|
97
103
|
description: ActiveModel email validation. Checks MX records, sub address, regex,
|
98
104
|
whitelisted and blacklisted check
|
99
105
|
email:
|
@@ -102,6 +108,7 @@ executables: []
|
|
102
108
|
extensions: []
|
103
109
|
extra_rdoc_files: []
|
104
110
|
files:
|
111
|
+
- ".coveralls.yml"
|
105
112
|
- ".gitignore"
|
106
113
|
- ".rspec"
|
107
114
|
- ".rubocop.yml"
|
@@ -113,6 +120,9 @@ files:
|
|
113
120
|
- Rakefile
|
114
121
|
- bin/console
|
115
122
|
- bin/setup
|
123
|
+
- gemfiles/Gemfile-4-0
|
124
|
+
- gemfiles/Gemfile-5-0
|
125
|
+
- gemfiles/Gemfile-6-0
|
116
126
|
- lib/rails_email_checker.rb
|
117
127
|
- lib/rails_email_checker/address.rb
|
118
128
|
- lib/rails_email_checker/configuration.rb
|