emailist 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/emailist.gemspec +2 -0
- data/lib/emailist/errors.rb +2 -0
- data/lib/emailist/version.rb +1 -1
- data/lib/emailist.rb +26 -7
- data/spec/emailist_spec.rb +8 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e65a28727b5d6bc9bf8c8e42a39458ae027d544
|
4
|
+
data.tar.gz: 8aac13086f43425a1d04b6c78e9a69b3c00c17b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff231264a2e0791919081318fd27d731d2f10d8b4ac7d120149bd8201f21c85130b570d26de6ac10ea02844ae0881e3cdf9821f2cd8ee48fed9bd4c6afa4de85
|
7
|
+
data.tar.gz: db20eaa77586a5050ac3d3bc71602a6128f4e7e5310c30ed5f1853f16c1d458d7bb4d3e09c58a0e652acbe9eed3e47a4279f3414add0d373d29099a397082f8f
|
data/emailist.gemspec
CHANGED
data/lib/emailist/errors.rb
CHANGED
data/lib/emailist/version.rb
CHANGED
data/lib/emailist.rb
CHANGED
@@ -7,13 +7,19 @@ class Emailist < Array
|
|
7
7
|
File.expand_path(File.join(File.dirname(__FILE__), '..', 'data', 'valid_tlds.txt'))
|
8
8
|
).lines.to_a.map {|tld| tld.gsub(/[^A-Z\-]/, '') }
|
9
9
|
|
10
|
-
INVALID_START_WITH =
|
11
|
-
|
12
|
-
|
10
|
+
INVALID_START_WITH = [
|
11
|
+
'TO.', 'To.', 'E-mail', 'AS', 'TO:', 'To:'
|
12
|
+
]
|
13
|
+
|
14
|
+
INVALID_END_WITH = [
|
15
|
+
'.TO', '.To', 'E'
|
16
|
+
]
|
17
|
+
|
18
|
+
|
19
|
+
def initialize(verify_profiles: false)
|
20
|
+
@verify_profiles = verify_profiles
|
21
|
+
end
|
13
22
|
|
14
|
-
INVALID_END_WITH = [
|
15
|
-
'.TO', '.To', 'E'
|
16
|
-
]
|
17
23
|
|
18
24
|
alias_method :_push, :push
|
19
25
|
def push(email)
|
@@ -125,7 +131,20 @@ private
|
|
125
131
|
end
|
126
132
|
domain = new_domain.join('.')
|
127
133
|
|
128
|
-
"#{local}@#{domain}".downcase
|
134
|
+
email = "#{local}@#{domain}".downcase
|
135
|
+
|
136
|
+
if @verify_profiles
|
137
|
+
begin
|
138
|
+
response = [PossibleEmail.find_profile(email)].flatten
|
139
|
+
if response.empty?
|
140
|
+
raise Emailist::CantVerifyProfile
|
141
|
+
end
|
142
|
+
rescue PossibleEmail::InvalidEmailFormat
|
143
|
+
raise Emailist::InvalidEmailFormat
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
email
|
129
148
|
end
|
130
149
|
|
131
150
|
end
|
data/spec/emailist_spec.rb
CHANGED
@@ -77,6 +77,14 @@ describe "Emailist" do
|
|
77
77
|
it "when an email contains no valid TLD" do
|
78
78
|
expect { @email_list.add('bob.jones@yahoo.gloopoopoop') }.to raise_error Emailist::InvalidTLD
|
79
79
|
end
|
80
|
+
|
81
|
+
#it "when an email is in an invalid format (for possible_email)" do
|
82
|
+
# @email_list = Emailist.new(verify_profiles: true)
|
83
|
+
# expect { @email_list._push('bob.jones@gloopoopoop') }.to raise_error Emailist::InvalidEmailFormat
|
84
|
+
#end
|
85
|
+
|
86
|
+
#it "when a profile can't be verified" do
|
87
|
+
#end
|
80
88
|
end
|
81
89
|
|
82
90
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emailist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan Barron
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: possible_email
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: "\n Provides a Ruby array wrapper that helps
|
70
84
|
in managing a list of \n email addresses. Automagically
|
71
85
|
uniquifies the list, as well as\n attempting to clean invalid
|