geo_ip 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +7 -0
- data/VERSION +1 -1
- data/geo_ip.gemspec +57 -0
- data/lib/geo_ip.rb +1 -4
- metadata +4 -2
data/CHANGES
ADDED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/geo_ip.gemspec
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{geo_ip}
|
8
|
+
s.version = "0.1.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Jeroen Jacobs"]
|
12
|
+
s.date = %q{2010-02-15}
|
13
|
+
s.description = %q{A call to the ipinfodb.com will be done to retreive the geolocation based on the IP address. No need to include a database file in the application.}
|
14
|
+
s.email = %q{jj@redstorm.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"CHANGES",
|
23
|
+
"LICENSE",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"geo_ip.gemspec",
|
28
|
+
"init.rb",
|
29
|
+
"lib/geo_ip.rb",
|
30
|
+
"spec/geo_ip_spec.rb",
|
31
|
+
"spec/spec.opts",
|
32
|
+
"spec/spec_helper.rb"
|
33
|
+
]
|
34
|
+
s.homepage = %q{http://github.com/jeroenj/geo_ip}
|
35
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
36
|
+
s.require_paths = ["lib"]
|
37
|
+
s.rubygems_version = %q{1.3.5}
|
38
|
+
s.summary = %q{Retreive the geolocation of an IP address based on the ipinfodb.com webservice}
|
39
|
+
s.test_files = [
|
40
|
+
"spec/geo_ip_spec.rb",
|
41
|
+
"spec/spec_helper.rb"
|
42
|
+
]
|
43
|
+
|
44
|
+
if s.respond_to? :specification_version then
|
45
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
46
|
+
s.specification_version = 3
|
47
|
+
|
48
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
49
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
50
|
+
else
|
51
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
52
|
+
end
|
53
|
+
else
|
54
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
data/lib/geo_ip.rb
CHANGED
@@ -10,7 +10,7 @@ class GeoIp
|
|
10
10
|
def self.remote_geolocation(ip)
|
11
11
|
raise "Invalid IP address" unless ip.to_s =~ IPV4_REGEXP
|
12
12
|
|
13
|
-
uri = SERVICE_URL + "?ip=#{ip}&output=json"
|
13
|
+
uri = SERVICE_URL + "?ip=#{ip}&output=json&timezone=false"
|
14
14
|
url = URI.parse(uri)
|
15
15
|
reply = JSON.parse(Net::HTTP.get(url))
|
16
16
|
location = convert_keys reply
|
@@ -29,9 +29,6 @@ class GeoIp
|
|
29
29
|
location[:zip_postal_code] = hash["ZipPostalCode"]
|
30
30
|
location[:latitude] = hash["Latitude"]
|
31
31
|
location[:longitude] = hash["Longitude"]
|
32
|
-
location[:timezone] = hash["Timezone"]
|
33
|
-
location[:gmt_offset] = hash["Gmtoffset"]
|
34
|
-
location[:dst_offset] = hash["Dstoffset"]
|
35
32
|
location
|
36
33
|
end
|
37
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geo_ip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeroen Jacobs
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-02-15 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -34,10 +34,12 @@ extra_rdoc_files:
|
|
34
34
|
files:
|
35
35
|
- .document
|
36
36
|
- .gitignore
|
37
|
+
- CHANGES
|
37
38
|
- LICENSE
|
38
39
|
- README.rdoc
|
39
40
|
- Rakefile
|
40
41
|
- VERSION
|
42
|
+
- geo_ip.gemspec
|
41
43
|
- init.rb
|
42
44
|
- lib/geo_ip.rb
|
43
45
|
- spec/geo_ip_spec.rb
|