sgeoip 0.0.8 → 0.0.9
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/Rakefile +3 -0
- data/lib/sgeoip/version.rb +1 -1
- data/lib/sgeoip.rb +3 -3
- data/sgeoip-0.0.8.gem +0 -0
- data/sgeoip.gemspec +2 -1
- metadata +19 -2
data/Rakefile
CHANGED
data/lib/sgeoip/version.rb
CHANGED
data/lib/sgeoip.rb
CHANGED
@@ -4,7 +4,7 @@ require 'open-uri'
|
|
4
4
|
|
5
5
|
module Sgeoip
|
6
6
|
def self.scrape(ip)
|
7
|
-
url = "http://www.geoiptool.com/en
|
7
|
+
url = "http://www.geoiptool.com/en/?IP=#{ip}"
|
8
8
|
doc = Nokogiri::HTML(open(url))
|
9
9
|
geoip = { "host" => doc.at_css(".tbl_style tr:nth-child(1) td.arial_bold").text,
|
10
10
|
"country" => doc.at_css(".tbl_style tr:nth-child(3) td.arial_bold").text,
|
@@ -13,8 +13,8 @@ module Sgeoip
|
|
13
13
|
"city" => doc.at_css(".tbl_style tr:nth-child(6) td.arial_bold").text,
|
14
14
|
"zip" => doc.at_css(".tbl_style tr:nth-child(7) td.arial_bold").text
|
15
15
|
}
|
16
|
-
if geoip[
|
17
|
-
geoip[
|
16
|
+
if geoip["host"].empty?
|
17
|
+
geoip["error"] = "Results Not Found"
|
18
18
|
end
|
19
19
|
geoip
|
20
20
|
end
|
data/sgeoip-0.0.8.gem
ADDED
Binary file
|
data/sgeoip.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.email = ["contact@travisberry.com"]
|
11
11
|
gem.description = %q{Scrape http://www.geoiptool.com/ for ip information}
|
12
12
|
gem.summary = %q{Scrape http://www.geoiptool.com/}
|
13
|
-
gem.homepage = ""
|
13
|
+
gem.homepage = "https://github.com/ninetwentyfour/scrape-geoip"
|
14
14
|
|
15
15
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
16
16
|
gem.files = `git ls-files`.split("\n")
|
@@ -18,4 +18,5 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
20
|
gem.add_dependency 'nokogiri'
|
21
|
+
gem.add_development_dependency 'rspec'
|
21
22
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sgeoip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
30
46
|
description: Scrape http://www.geoiptool.com/ for ip information
|
31
47
|
email:
|
32
48
|
- contact@travisberry.com
|
@@ -41,8 +57,9 @@ files:
|
|
41
57
|
- Rakefile
|
42
58
|
- lib/sgeoip.rb
|
43
59
|
- lib/sgeoip/version.rb
|
60
|
+
- sgeoip-0.0.8.gem
|
44
61
|
- sgeoip.gemspec
|
45
|
-
homepage:
|
62
|
+
homepage: https://github.com/ninetwentyfour/scrape-geoip
|
46
63
|
licenses: []
|
47
64
|
post_install_message:
|
48
65
|
rdoc_options: []
|