email_address 0.1.10 → 0.1.11
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/lib/email_address/host.rb +5 -5
- data/lib/email_address/local.rb +2 -1
- data/lib/email_address/version.rb +1 -1
- data/test/email_address/test_local.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5129f7fbc9c34749550a07cf447c0ae0ec1fadf711af9aa2f1dc193c0e1c5322
|
4
|
+
data.tar.gz: 5fb49593e6ad95576d400d9f4d3918fa2949b52a44540454c5016ccce00ca695
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd741fa47ed63923c1cb83bce7139efe5469282d24c57bc987eda9e4686d89ac8aaa650b815324005cb792342395002c29648c0439ad5d4341bb0ae80fb58352
|
7
|
+
data.tar.gz: '0194608171e7fd2dcc68c1fb827ce12051a7cfc9e42d47cef6935503b0a6ae5f257b36e30bd977201b60193bfffa0a55bf7a11a039c8c9c5f90395cb9225cc59'
|
data/lib/email_address/host.rb
CHANGED
@@ -345,7 +345,7 @@ module EmailAddress
|
|
345
345
|
# Returns an array of EmailAddress::Exchanger hosts configured in DNS.
|
346
346
|
# The array will be empty if none are configured.
|
347
347
|
def exchangers
|
348
|
-
return nil if @config[:host_type] != :email || !self.dns_enabled?
|
348
|
+
#return nil if @config[:host_type] != :email || !self.dns_enabled?
|
349
349
|
@_exchangers ||= EmailAddress::Exchanger.cached(self.dns_name, @config)
|
350
350
|
end
|
351
351
|
|
@@ -412,7 +412,7 @@ module EmailAddress
|
|
412
412
|
|
413
413
|
# True if the host name has valid MX servers configured in DNS
|
414
414
|
def valid_mx?
|
415
|
-
if self.exchangers.
|
415
|
+
if self.exchangers.nil?
|
416
416
|
set_error(:domain_unknown)
|
417
417
|
elsif self.exchangers.mx_ips.size > 0
|
418
418
|
if self.localhost? && !@config[:host_local]
|
@@ -430,10 +430,10 @@ module EmailAddress
|
|
430
430
|
# True if the host_name passes Regular Expression match and size limits.
|
431
431
|
def valid_format?
|
432
432
|
if self.host_name =~ CANONICAL_HOST_REGEX && self.to_s.size <= MAX_HOST_LENGTH
|
433
|
-
true
|
434
|
-
|
435
|
-
set_error(:domain_invalid)
|
433
|
+
return true if localhost?
|
434
|
+
return true if self.host_name.include?(".") # require FQDN
|
436
435
|
end
|
436
|
+
set_error(:domain_invalid)
|
437
437
|
end
|
438
438
|
|
439
439
|
# Returns true if the IP address given in that form of the host name
|
data/lib/email_address/local.rb
CHANGED
@@ -307,8 +307,9 @@ module EmailAddress
|
|
307
307
|
return set_error(:local_size_long) if self.local.size > STANDARD_MAX_SIZE
|
308
308
|
if @host && @host.hosted_service?
|
309
309
|
return false if @config[:local_private_size] && !valid_size_checks(@config[:local_private_size])
|
310
|
+
else
|
311
|
+
return false if @config[:local_size] && !valid_size_checks(@config[:local_size])
|
310
312
|
end
|
311
|
-
return false if @config[:local_size] && !valid_size_checks(@config[:local_size])
|
312
313
|
return false if @config[:mailbox_size] && !valid_size_checks(@config[:mailbox_size])
|
313
314
|
true
|
314
315
|
end
|
@@ -93,4 +93,10 @@ class TestLocal < MiniTest::Test
|
|
93
93
|
assert_equal "us*****", EmailAddress::Local.new("User+tag").munge
|
94
94
|
end
|
95
95
|
|
96
|
+
def test_hosted
|
97
|
+
assert EmailAddress.valid?("x@exposure.co")
|
98
|
+
assert EmailAddress.error("xxxx+subscriber@gmail.com")
|
99
|
+
assert EmailAddress.valid?("xxxxx+subscriber@gmail.com")
|
100
|
+
end
|
101
|
+
|
96
102
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: email_address
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Allen Fair
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|