gman 0.0.1 → 0.0.2
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.
- data/README.md +14 -8
- data/gman.gemspec +2 -2
- data/lib/gman.rb +2 -2
- metadata +2 -2
data/README.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# Gman Gem
|
2
2
|
|
3
|
-
A ruby gem to check if the owner of a given email address or website is working for THE MAN (a.k.a verifies government domains).
|
3
|
+
A ruby gem to check if the owner of a given email address or website is working for THE MAN (a.k.a verifies government domains). It does this by leveraging the power of the [Public Suffix List](http://publicsuffix.org/), and the associated [Ruby Gem](https://github.com/weppos/publicsuffix-ruby).
|
4
|
+
|
5
|
+
You could theoretically [use regex](https://gist.github.com/benbalter/6147066), but either you'll a bunch of false positives, or your regex will be insanely complicated. `gov.uk`, may be valid, for example, but `gov.fr` is not (it's `gouv.fr`, for what it's worth).
|
6
|
+
|
7
|
+
The solution? Use Public Suffix to verify that it's a valid public domain, then maintain [a crowd-sourced sub-list of known global government and military domains](https://github.com/benbalter/gman/blob/master/lib/domains.yml). It should cover all US and international, government and military domains for both email and website verification.
|
8
|
+
|
9
|
+
See a domains that's missing or one that shouldn't be there? [We'd love you to contribute](CONTRIBUTING.md).
|
4
10
|
|
5
11
|
## Installation
|
6
12
|
|
@@ -17,21 +23,21 @@ Or add this to your `Gemfile` before doing a `bundle install`:
|
|
17
23
|
### Verify email addresses
|
18
24
|
|
19
25
|
```ruby
|
20
|
-
Gman
|
21
|
-
Gman
|
26
|
+
Gman.valid? "foo@bar.gov" #true
|
27
|
+
Gman.valid? "foo@bar.com" #false
|
22
28
|
```
|
23
29
|
### Verify domain
|
24
30
|
|
25
31
|
```ruby
|
26
|
-
Gman
|
27
|
-
Gman
|
28
|
-
Gman
|
29
|
-
Gman
|
32
|
+
Gman.valid? "http://foo.bar.gov" #true
|
33
|
+
Gman.valid? "foo.bar.gov" #true
|
34
|
+
Gman.valid? "foo.gov" #true
|
35
|
+
Gman.valid? "foo.biz" #false
|
30
36
|
```
|
31
37
|
|
32
38
|
## Contributing
|
33
39
|
|
34
|
-
Contributions welcome! Please see [the contribution guidelines](
|
40
|
+
Contributions welcome! Please see [the contribution guidelines](CONTRIBUTING.md) for code contributions or for details on how to add, update, or delete government domains.
|
35
41
|
|
36
42
|
## Credits
|
37
43
|
|
data/gman.gemspec
CHANGED
@@ -2,9 +2,9 @@ Gem::Specification.new do |s|
|
|
2
2
|
s.name = "gman"
|
3
3
|
s.summary = "Check if a given domain or email address belong to a governemnt entity"
|
4
4
|
s.description = "A ruby gem to check if the owner of a given email address is working for THE MAN."
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.2"
|
6
6
|
s.authors = ["Ben Balter"]
|
7
|
-
s.date = "2013-08-
|
7
|
+
s.date = "2013-08-30"
|
8
8
|
s.email = "ben.balter@github.com"
|
9
9
|
s.homepage = "https://github.com/benbalter/gman"
|
10
10
|
s.licenses = ["MIT"]
|
data/lib/gman.rb
CHANGED
@@ -3,7 +3,7 @@ require 'yaml'
|
|
3
3
|
|
4
4
|
module Gman
|
5
5
|
|
6
|
-
VERSION='0.0.
|
6
|
+
VERSION='0.0.2'
|
7
7
|
|
8
8
|
class << self
|
9
9
|
|
@@ -16,7 +16,7 @@ module Gman
|
|
16
16
|
# "http://foo.bar.gov"
|
17
17
|
#
|
18
18
|
# Returns boolean true if a government domain
|
19
|
-
def
|
19
|
+
def valid?(text)
|
20
20
|
return false if text.nil?
|
21
21
|
text.strip!
|
22
22
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
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: 2013-08-
|
12
|
+
date: 2013-08-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: public_suffix
|