email_address 0.1.16 → 0.1.17

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: 46541e8de9140acd70cc23c1f60515c077ea919e0b04444a83d681e19fcbd4e1
4
- data.tar.gz: 34f52f8bfa70a33d8e40c5986d1c9d4a49956a4c12d6bc69df8037705f76c417
3
+ metadata.gz: 8835c0835419dbf67cab6698b47d8641e5839036685727d4e5ed0e455caef6f4
4
+ data.tar.gz: 553e9787f16788dce7bcff2d9b0d1f962deb03c575b35d2131a93a1c6795fd08
5
5
  SHA512:
6
- metadata.gz: adde7e6139b151e6759861a0b7054c7f179a7f590d8180141c31b786ebba81aba2d01657c4073158779e879ec27b3c76389679131061661dae46cf1f1c315b92
7
- data.tar.gz: 3420904e9bbe4713bf6e57e7bd6d1d059c7616f529a650c07828c9e45eb1a1ce3566412d86358b8c04c335ad49f55aed1f5e715d08a7eb8e4e066a703231f28e
6
+ metadata.gz: b1be9796aa6e245c623b940e0254cd303726439c0382c8f30e4b3d444c97dbd5575bbec5e61745621c1a8e5a39e764dad0b19a1200c64a1187978db8c9664a04
7
+ data.tar.gz: 7c395ddbacdb048c96b8ceeeed2504ebbf42acc8c68b9d1424811cb22156789f2844704ba2919841065421242830ec180fa13fbd810976f2ea02bec0626c60a3
data/README.md CHANGED
@@ -50,7 +50,7 @@ It does not check:
50
50
  By default, MX records are required in DNS. MX or "mail exchanger" records
51
51
  tell where to deliver email for the domain. Many domains run their
52
52
  website on one provider (ISP, Heroku, etc.), and email on a different
53
- provider (such as Google Apps). Note that `example.com`, while
53
+ provider (such as G Suite). Note that `example.com`, while
54
54
  a valid domain name, does not have MX records.
55
55
 
56
56
  ```ruby
@@ -248,6 +248,16 @@ EmailAddress.normal("HIRO@こんにちは世界.com")
248
248
  EmailAddress.normal("hiro@xn--28j2a3ar1pp75ovm7c.com", host_encoding: :unicode)
249
249
  #=> "hiro@こんにちは世界.com"
250
250
  ```
251
+ As of release 0.1.17, exchanger_match is no longer used for host provider
252
+ determination, which designated the set of rules for that domain.
253
+ Sometimes, as in Google-hosted domains, the address
254
+ rules are different, notably the optional dots in mailboxes for gmail.com
255
+ accounts do not apply to other private domains hosted at google.
256
+
257
+ To access the provider service, you can now call:
258
+
259
+ EmailAddress.new("user@hosteddomain.com").host.hosted_provider
260
+
251
261
 
252
262
  #### Rails Validator
253
263
 
@@ -143,6 +143,7 @@ module EmailAddress
143
143
  },
144
144
  msn: {
145
145
  host_match: %w[msn. hotmail. outlook. live.],
146
+ exchanger_match: %w[outlook.com],
146
147
  mailbox_validator: ->(m, t) { m =~ /\A\w[\-\w]*(?:\.[\-\w]+)*\z/i }
147
148
  },
148
149
  yahoo: {
@@ -217,12 +217,6 @@ module EmailAddress
217
217
 
218
218
  return set_provider(:default) unless dns_enabled?
219
219
 
220
- provider = exchangers.provider
221
- if provider != :default
222
- set_provider(provider,
223
- EmailAddress::Config.provider(provider))
224
- end
225
-
226
220
  self.provider ||= set_provider(:default)
227
221
  end
228
222
 
@@ -238,6 +232,10 @@ module EmailAddress
238
232
  tld2: tld2, tld: tld, ip_address: ip_address,}
239
233
  end
240
234
 
235
+ def hosted_provider
236
+ EmailAddress::Exchanger.cached(dns_name).provider
237
+ end
238
+
241
239
  ############################################################################
242
240
  # Access and Queries
243
241
  ############################################################################
@@ -1,3 +1,3 @@
1
1
  module EmailAddress
2
- VERSION = "0.1.16"
2
+ VERSION = "0.1.17"
3
3
  end
@@ -37,6 +37,11 @@ class TestAddress < Minitest::Test
37
37
  assert_equal "6bdd00c53645790ad9bbcb50caa93880", EmailAddress.reference("Gmail.User+tag@gmail.com")
38
38
  end
39
39
 
40
+ def test_google_hosted
41
+ a = EmailAddress.new("Ex.am.ple+tag@boomer.com")
42
+ assert_equal a.canonical, "ex.am.ple@boomer.com"
43
+ end
44
+
40
45
  # COMPARISON & MATCHING
41
46
  def test_compare
42
47
  a = ("User+tag@example.com")
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.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Allen Fair
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-31 00:00:00.000000000 Z
11
+ date: 2020-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake