rails_email_checker 0.1.0 → 0.1.1

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: 8e99f8a15584efbbfe72bdd987c0b536ca53873dfab58d581c79c37107161754
4
- data.tar.gz: 03b26be23b4bb692781c43396526df1d4ecce7cf450c0da24c90b7ad60db2286
3
+ metadata.gz: 1f2b0c96266900173ed82fc4ec68d6bebfebae8c6f1396abb1d51acab04eccbb
4
+ data.tar.gz: ab4f7b894904731b4cdc8622ca263b1192cd6e0162f6a64b3c362e2574a9efae
5
5
  SHA512:
6
- metadata.gz: 8adb0084265a8b35e5c9d581f42c5691014690e9de2f8f343f164a06e26b172e75f39185abc6b3326e59c0f446030643b7d4306a18585824b53df97a578704fc
7
- data.tar.gz: 0a3b2e0618d0bf19c99972986fe7f54a82101aebd58f53a0860011d5549acdbd313ef4b44f68e9ffef60e5d20fa31e979ed2e5bead04246f935a23d4f3c0aa0c
6
+ metadata.gz: 25268d069850488ebadad8deeb78bb0d7b91c8c0f9a66b2506bc9ae8aeecd19faacf825558dae8dbeed6b97aebd79d18a056455255d7b45783a4bfe6019950ec
7
+ data.tar.gz: 507818fcc7dbb885894e17c4e94889950c56b7ad726397d8e6752b65d091e53945aef567c9754726e8080727e4b58f4cf11c78b15df86fffb1057017914ce1cf
data/.coveralls.yml ADDED
@@ -0,0 +1,2 @@
1
+ service_name: travis-pro
2
+ repo_token: 7nKS8dACFw7pKCDfK5m9Ic7ya5MA9v2tb
data/.travis.yml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- sudo: false
2
+ os: linux
3
3
  language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
+ - 2.5.5
6
7
  - 2.6.3
7
- before_install: gem install bundler -v 2.0.2
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
@@ -2,7 +2,7 @@ PATH
2
2
  remote: .
3
3
  specs:
4
4
  rails_email_checker (0.1.0)
5
- activemodel (~> 4.2)
5
+ activemodel (>= 4.2, < 7)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,8 +1,13 @@
1
1
  # RailsEmailChecker
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rails_email_checker`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ [![Gem Version](https://badge.fury.io/rb/rails_email_checker.svg)](https://badge.fury.io/rb/redis_web_manager)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/eecf90541668432d4d41/maintainability)](https://codeclimate.com/github/OpenGems/rails_email_checker/maintainability)
5
+ [![Build Status](https://travis-ci.org/OpenGems/rails_email_checker.svg?branch=master)](https://travis-ci.org/OpenGems/redis_web_manager)
6
+ [![security](https://hakiri.io/github/OpenGems/rails_email_checker/master.svg)](https://hakiri.io/github/OpenGems/redis_web_manager/master)
7
+ ![Gem](https://img.shields.io/gem/dt/rails_email_checker)
8
+ [![Coverage Status](https://coveralls.io/repos/github/OpenGems/rails_email_checker/badge.svg?branch=master)](https://coveralls.io/github/OpenGems/rails_email_checker?branch=master)
4
9
 
5
- TODO: Delete this and the text above, and describe your gem
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
- TODO: Write usage instructions here
30
+ ### Use with ActiveModel
26
31
 
27
- ## Development
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
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
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
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
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/[USERNAME]/rails_email_checker.
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
 
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'activemodel', '~> 4.2.0'
4
+
5
+ gemspec path: '..'
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'activemodel', '~> 5.2.0'
4
+
5
+ gemspec path: '..'
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'activemodel', '~> 6.0.2'
4
+
5
+ gemspec path: '..'
@@ -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 & domains are nil' if valid_argument?(path, domains)
19
- @blacklist_domains << load_domains(path) unless path.nil?
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 & domains are nil' if valid_argument?(path, domains)
28
- @whitelist_domains << load_domains(path) unless path.nil?
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsEmailChecker
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
@@ -31,5 +31,5 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency 'rspec', '~> 3.0'
32
32
  spec.add_development_dependency 'simplecov', '~> 0.16'
33
33
 
34
- spec.add_dependency 'activemodel', '~> 4.2'
34
+ spec.add_dependency 'activemodel', '>= 4.2', '< 7'
35
35
  end
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.0
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