email_verifier 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -18,3 +18,4 @@ tmp
18
18
  *~
19
19
  *.swp
20
20
  *.swo
21
+ .ruby-version
data/README.md CHANGED
@@ -5,6 +5,8 @@ Many times as developers we've put in our models statements for checking email a
5
5
  *format*. This gem will complete your existing setups with validator that actually
6
6
  connects with given mail server and asks if given email address exists for real.
7
7
 
8
+ **New**: Now it supports Heroku!
9
+
8
10
  ## Installation
9
11
 
10
12
  Add this line to your application's Gemfile:
@@ -17,4 +17,5 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
  gem.add_runtime_dependency(%q<rails>, [">= 3.0.0"])
20
+ gem.add_runtime_dependency(%q<dnsruby>, [">= 1.5"])
20
21
  end
@@ -1,4 +1,5 @@
1
1
  require 'net/smtp'
2
+ require 'dnsruby'
2
3
 
3
4
  class EmailVerifier::Checker
4
5
 
@@ -21,11 +22,12 @@ class EmailVerifier::Checker
21
22
 
22
23
  def list_mxs(domain)
23
24
  return [] unless domain
24
- `host -t MX #{domain}`.scan(/(?<=by ).+/).map do |mx|
25
- res = mx.split(" ")
26
- next if res.last[0..-2].strip.empty?
27
- { priority: res.first.to_i, address: res.last[0..-2] }
28
- end.reject(&:nil?).sort_by { |mx| mx[:priority] }
25
+ res = Dnsruby::DNS.new
26
+ mxs = []
27
+ res.each_resource(domain, 'MX') do |rr|
28
+ mxs << { priority: rr.preference, address: rr.exchange.to_s }
29
+ end
30
+ mxs.sort_by { |mx| mx[:priority] }
29
31
  end
30
32
 
31
33
  def is_connected
@@ -1,3 +1,3 @@
1
1
  module EmailVerifier
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_verifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-17 00:00:00.000000000 Z
12
+ date: 2013-09-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: 3.0.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: dnsruby
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '1.5'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '1.5'
30
46
  description: Helper utility checking if given email address exists or not
31
47
  email:
32
48
  - kamil@endpoint.com
@@ -61,7 +77,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
61
77
  version: '0'
62
78
  segments:
63
79
  - 0
64
- hash: -590969574408865567
80
+ hash: 382711456140948445
65
81
  required_rubygems_version: !ruby/object:Gem::Requirement
66
82
  none: false
67
83
  requirements:
@@ -70,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
86
  version: '0'
71
87
  segments:
72
88
  - 0
73
- hash: -590969574408865567
89
+ hash: 382711456140948445
74
90
  requirements: []
75
91
  rubyforge_project:
76
92
  rubygems_version: 1.8.23