email_homepage 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8db8bc7d005a3d12d739050fbb9f7281ea768779
4
+ data.tar.gz: ac32742beaecf79b8d56dd65903b128b370443ba
5
+ SHA512:
6
+ metadata.gz: fdfff4f1ca8eec92dc39109b313fbc3ac1d6b8188e64249ef03a658608858f3e353eff6233158f0a230b533732e6a9800fca0fc75100439899e6cbb819000525
7
+ data.tar.gz: f1dfdc0c54a07e8c1883c1ca5e00a8af2b340f2ba9a34554b7831a477c516dc0978455fc7c23b71f871572935b05e8c0c35e58508c536728a9ed9b31b5355065
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in email_homepage.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,38 @@
1
+ ## Installation
2
+
3
+ Add this line to your application's Gemfile:
4
+
5
+ ```ruby
6
+ gem 'email_homepage'
7
+ ```
8
+
9
+ And then execute:
10
+
11
+ $ bundle
12
+
13
+ Or install it yourself as:
14
+
15
+ $ gem install email_homepage
16
+
17
+ ## Description
18
+ This gem can return email homepege url if you provide a email address.</br>
19
+ It supports:
20
+ ####Personal Mailbox
21
+ ```
22
+ google, qq, 163, 126, sohu, sina, aliyun, yahoo, tom, yeah, 21cn, outlook, hotmail, live, sogou, 188, 139, 189, zoho
23
+ ```
24
+ ####Enterprise Mailbox
25
+ ```
26
+ qq, 163, google, aliyun, sina, zoho, sohu, 189
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ```ruby
32
+ EmailHomepage.get("my@qq.com") # return "http://mail.qq.com"
33
+ EmailHomepage.get("my@163.com") # return "http://mail.163.com"
34
+ ```
35
+
36
+ ## Contributing
37
+
38
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/email_homepage.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "email_homepage"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'email_homepage/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "email_homepage"
8
+ spec.version = EmailHomepage::VERSION
9
+ spec.authors = ["ycwei"]
10
+ spec.email = ["tardis9527@gmail.com"]
11
+
12
+ spec.summary = %q{"find email homepage url by email address"}
13
+ spec.description = %q{"return homepage url if provide users email"}
14
+ spec.homepage = "https://github.com/gallifreyer/email-homepage"
15
+
16
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17
+ # delete this section to allow pushing this gem to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
22
+ end
23
+
24
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_development_dependency "bundler", "~> 1.11"
30
+ spec.add_development_dependency "rake", "~> 10.0"
31
+ end
@@ -0,0 +1,3 @@
1
+ module EmailHomepage
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,71 @@
1
+ require "email_homepage/version"
2
+
3
+ module EmailHomepage
4
+ def self.get email_address
5
+ return nil unless email_address.match /^.+@.+$/
6
+ email_address.downcase!
7
+ if (email_address.match /@qq.com/) || (email_address.match /@foxmail.com/)
8
+ return "http://mail.qq.com"
9
+ elsif email_address.match /@163.com/
10
+ return "http://mail.163.com"
11
+ elsif email_address.match /@vip.163.com/
12
+ return "http://vip.163.com"
13
+ elsif email_address.match /@126.com/
14
+ return "http://mail.126.com"
15
+ elsif email_address.match /@gmail.com/
16
+ return "http://mail.google.com"
17
+ elsif email_address.match /@sohu.com/
18
+ return "http://mail.sohu.com"
19
+ elsif (email_address.match /@sina.com.cn/) || (email_address.match /@sina.com/)
20
+ return "http://mail.sina.com.cn"
21
+ elsif email_address.match /@vip.sina.com/
22
+ return "http://vip.sina.com"
23
+ elsif email_address.match /@aliyun.com/
24
+ return "https://mail.aliyun.com/"
25
+ elsif email_address.match /@yahoo.com/
26
+ return "http://mail.yahoo.com"
27
+ elsif email_address.match /@tom.com/
28
+ return "http://tom.com"
29
+ elsif email_address.match /@yeah.net/
30
+ return "http://yeah.net"
31
+ elsif email_address.match /@21cn.com/
32
+ return "http://mail.21cn.com"
33
+ elsif (email_address.match /@hotmail.com/) || (email_address.match /@outlook.com/) || (email_address.match /@live.com/)
34
+ return "outlook.office.com"
35
+ elsif email_address.match /@sogou.com/
36
+ return "http://mail.sogou.com"
37
+ elsif email_address.match /@188.com/
38
+ return "http://www.188.com"
39
+ elsif email_address.match /@139.com/
40
+ return "http://mail.10086.cn/"
41
+ elsif email_address.match /@189.cn/
42
+ return "http://webmail30.189.cn/w2/"
43
+ elsif email_address.match /@zoho.com/
44
+ return "https://www.zoho.com.cn/mail/"
45
+ else
46
+ domain_name = email_address.split(/@/).last
47
+ host_name = `host #{domain_name} | grep mail | awk 'NR==1{print $7}'`
48
+ if host_name.match /qq.com/
49
+ return "http://exmail.qq.com/"
50
+ elsif (host_name.match /163.com/) || (host_name.match /netease.com/)
51
+ return "http://ym.163.com/"
52
+ elsif (host_name.match /google.com/) || (host_name.match /googlemail.com/)
53
+ return "https://www.google.com/intl/zh-CN/mail/help/work.html"
54
+ elsif (host_name.match /outlook.com/) || (email_address.match /@hotmail.com/) || (email_address.match /@live.com/)
55
+ return "outlook.office.com"
56
+ elsif host_name.match /aliyun.com/
57
+ return "https://mail.aliyun.com/"
58
+ elsif host_name.match /sina.net/
59
+ return "http://mail.sina.net/"
60
+ elsif host_name.match /zoho.com/
61
+ return "https://www.zoho.com.cn/mail/"
62
+ elsif host_name.match /sohu.net/
63
+ return "http://mail.sohu.net/"
64
+ elsif host_name.match /21cn.com/
65
+ return "http://exmail.189.cn/"
66
+ else
67
+ return nil
68
+ end
69
+ end
70
+ end
71
+ end
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: email_homepage
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - ycwei
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-01-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.11'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.11'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: '"return homepage url if provide users email"'
42
+ email:
43
+ - tardis9527@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - README.md
51
+ - Rakefile
52
+ - bin/console
53
+ - bin/setup
54
+ - email_homepage.gemspec
55
+ - lib/email_homepage.rb
56
+ - lib/email_homepage/version.rb
57
+ homepage: https://github.com/gallifreyer/email-homepage
58
+ licenses: []
59
+ metadata:
60
+ allowed_push_host: https://rubygems.org
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.4.8
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: '"find email homepage url by email address"'
81
+ test_files: []