email_inquire 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,29 +6,30 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
6
  require "email_inquire/version"
7
7
 
8
8
  Gem::Specification.new do |spec|
9
- spec.name = "email_inquire"
10
- spec.version = EmailInquire::VERSION
11
- spec.authors = ["Maxime Garcia"]
12
- spec.email = ["maxime.garcia@gmail.com"]
9
+ spec.name = "email_inquire"
10
+ spec.version = EmailInquire::VERSION
11
+ spec.authors = ["Maxime Garcia"]
12
+ spec.email = ["maxime.garcia@gmail.com"]
13
13
 
14
- spec.summary = "Library to validate email for format, common typos and one-time email providers"
15
- spec.description = "Library to validate email for format, common typos and one-time email providers"
16
- spec.homepage = "https://github.com/maximeg/email_inquire"
17
- spec.license = "MIT"
14
+ spec.summary = "Library to validate email for format, common typos and one-time email providers"
15
+ spec.description = "Library to validate email for format, common typos and one-time email providers"
16
+ spec.homepage = "https://github.com/maximeg/email_inquire"
17
+ spec.license = "MIT"
18
18
 
19
19
  spec.required_ruby_version = ">= 2.0.0"
20
20
 
21
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
22
- f.match(%r{^(test|spec|features)/})
23
- end
24
- spec.bindir = "exe"
25
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.files =
22
+ `git ls-files -z`.split("\x0").reject do |f|
23
+ f.match(%r{^(test|spec|features)/})
24
+ end
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
27
  spec.require_paths = ["lib"]
27
28
 
28
29
  spec.add_runtime_dependency "damerau-levenshtein", "~> 1.2"
29
30
 
30
- spec.add_development_dependency "bundler", "~> 1.14"
31
+ spec.add_development_dependency "bundler", "~> 1.15"
31
32
  spec.add_development_dependency "rake", "~> 10.0"
32
- spec.add_development_dependency "rspec", "~> 3.0"
33
- spec.add_development_dependency "rubocop", "0.48.1"
33
+ spec.add_development_dependency "rubocop", "0.49.0"
34
+ spec.add_development_dependency "rspec", "~> 3.6.0"
34
35
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EmailInquire
4
-
5
4
  # Relevant literature:
6
5
  # http://emailregex.com/email-validation-summary/
7
6
  # http://www.regular-expressions.info/email.html
@@ -64,5 +63,4 @@ module EmailInquire
64
63
  end
65
64
 
66
65
  end
67
-
68
66
  end
@@ -4,7 +4,6 @@ require "damerau-levenshtein"
4
4
  require "set"
5
5
 
6
6
  module EmailInquire
7
-
8
7
  class Inquirer
9
8
 
10
9
  class << self
@@ -32,6 +31,7 @@ module EmailInquire
32
31
  VALIDATORS = %i[
33
32
  validate_common_domains
34
33
  validate_one_time_providers
34
+ validate_known_invalid_domains
35
35
  validate_common_domain_mistakes
36
36
  validate_cc_tld
37
37
  validate_common_tld_mistakes
@@ -63,9 +63,10 @@ module EmailInquire
63
63
  end
64
64
 
65
65
  def response
66
- @response ||= Response.new.tap do |response|
67
- response.email = email
68
- end
66
+ @response ||=
67
+ Response.new.tap do |response|
68
+ response.email = email
69
+ end
69
70
  end
70
71
 
71
72
  COMMON_DOMAIN_MISTAKES = {
@@ -161,6 +162,11 @@ module EmailInquire
161
162
  response.invalid! if ONE_TIME_EMAIL_PROVIDERS.include?(domain)
162
163
  end
163
164
 
164
- end
165
+ KNOWN_INVALID_DOMAINS = load_data("known_invalid_domains").freeze
165
166
 
167
+ def validate_known_invalid_domains
168
+ response.invalid! if KNOWN_INVALID_DOMAINS.include?(domain)
169
+ end
170
+
171
+ end
166
172
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EmailInquire
4
-
5
4
  class Response
6
5
 
7
6
  attr_accessor :email, :replacement, :status
@@ -38,5 +37,4 @@ module EmailInquire
38
37
  end
39
38
 
40
39
  end
41
-
42
40
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module EmailInquire
4
4
 
5
- VERSION = "0.6.0"
5
+ VERSION = "0.7.0"
6
6
 
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_inquire
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxime Garcia
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-16 00:00:00.000000000 Z
11
+ date: 2017-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: damerau-levenshtein
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.14'
33
+ version: '1.15'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.14'
40
+ version: '1.15'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,33 +53,33 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '10.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rspec
56
+ name: rubocop
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: '3.0'
61
+ version: 0.49.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: '3.0'
68
+ version: 0.49.0
69
69
  - !ruby/object:Gem::Dependency
70
- name: rubocop
70
+ name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '='
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.48.1
75
+ version: 3.6.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '='
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.48.1
82
+ version: 3.6.0
83
83
  description: Library to validate email for format, common typos and one-time email
84
84
  providers
85
85
  email:
@@ -104,6 +104,7 @@ files:
104
104
  - data/br_tld.txt
105
105
  - data/common_providers.txt
106
106
  - data/jp_tld.txt
107
+ - data/known_invalid_domains.txt
107
108
  - data/one_time_email_providers.txt
108
109
  - data/uk_tld.txt
109
110
  - data/unique_domain_providers.txt
@@ -133,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
134
  version: '0'
134
135
  requirements: []
135
136
  rubyforge_project:
136
- rubygems_version: 2.6.11
137
+ rubygems_version: 2.6.12
137
138
  signing_key:
138
139
  specification_version: 4
139
140
  summary: Library to validate email for format, common typos and one-time email providers