geoip 0.9.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +17 -10
- data/lib/geoip.rb +2 -2
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -18,16 +18,24 @@ This release adds support for timezone names, thanks to Tonni Aagesen.
|
|
18
18
|
require 'geoip'
|
19
19
|
|
20
20
|
# Use the country database:
|
21
|
-
GeoIP.new('GeoIP.dat').country('www.
|
22
|
-
=> ["www.
|
21
|
+
c = GeoIP.new('GeoIP.dat').country('www.nokia.com')
|
22
|
+
=> ["www.nokia.com", "147.243.3.83", 69, "FI", "FIN", "Finland", "EU"]
|
23
|
+
c.country_code3
|
24
|
+
=> "FIN"
|
25
|
+
c.to_hash
|
26
|
+
=> {:country_code3=>"FIN", :country_name=>"Finland", :continent_code=>"EU", :request=>"www.nokia.com", :country_code=>69, :country_code2=>"FI", :ip=>"147.243.3.83"}
|
23
27
|
|
24
28
|
Returned values are the requested hostname, the IP address as a dotted quad,
|
25
29
|
Maxmind's country code, the ISO3166-1 alpha-2 country code, the ISO3166-2 alpha-3
|
26
30
|
country code, the ISO3166 country name, and the continent code.
|
27
31
|
|
28
32
|
# Use the city database:
|
29
|
-
GeoIP.new('GeoLiteCity.dat').
|
30
|
-
=> ["
|
33
|
+
c = GeoIP.new('GeoLiteCity.dat').city('github.com')
|
34
|
+
=> ["github.com", "207.97.227.239", "US", "USA", "United States", "NA", "CA", "San Francisco", "94110", 37.7484, -122.4156, 807, 415, "America/Los_Angeles"]
|
35
|
+
>> c.longitude
|
36
|
+
=> -122.4156
|
37
|
+
>> c.timezone
|
38
|
+
=> "America/Los_Angeles"
|
31
39
|
|
32
40
|
GeoIP.new('GeoCity.dat').city('github.com')
|
33
41
|
=> ["github.com", "207.97.227.239", "US", "USA", "United States", "NA", "CA", "San Francisco", "94110", 37.7484, -122.4156, 807, 415, "America/Los_Angeles"]
|
@@ -38,7 +46,7 @@ This release adds support for timezone names, thanks to Tonni Aagesen.
|
|
38
46
|
city name, postal_code/zipcode, latitude, longitude, USA DMA code, USA area code,
|
39
47
|
timezone name.
|
40
48
|
|
41
|
-
Result arrays from both city and country
|
49
|
+
Result arrays from both city and country have mixed-in accessor methods as appropriate:
|
42
50
|
request, ip, country_code, country_code2, country_code3, country_name, continent_code,
|
43
51
|
region_name, city_name, postal_code, latitude, longitude, dma_code, area_code, timezone
|
44
52
|
|
@@ -47,11 +55,10 @@ This release adds support for timezone names, thanks to Tonni Aagesen.
|
|
47
55
|
|
48
56
|
== REQUIREMENTS:
|
49
57
|
|
50
|
-
You need
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
The ASN database location is
|
58
|
+
You need one of the free GeoLite country, city or ASN databases, or a subscription database version.
|
59
|
+
The last known download locations for the GeoLite database versions are
|
60
|
+
<http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz>,
|
61
|
+
<http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz>,
|
55
62
|
<http://geolite.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz>.
|
56
63
|
|
57
64
|
This API requires the file to be decompressed for searching. Other versions
|
data/lib/geoip.rb
CHANGED
@@ -51,7 +51,7 @@ end
|
|
51
51
|
|
52
52
|
class GeoIP
|
53
53
|
# The GeoIP GEM version number
|
54
|
-
VERSION = "0.
|
54
|
+
VERSION = "1.0.0"
|
55
55
|
|
56
56
|
private
|
57
57
|
# Ordered list of the ISO3166 2-character country codes, ordered by GeoIP ID
|
@@ -1064,7 +1064,7 @@ class GeoIP
|
|
1064
1064
|
end
|
1065
1065
|
|
1066
1066
|
module ASNAccessors #:nodoc:
|
1067
|
-
def
|
1067
|
+
def as_num
|
1068
1068
|
self[0]
|
1069
1069
|
end
|
1070
1070
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geoip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
|
+
- 1
|
7
8
|
- 0
|
8
|
-
- 9
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 1.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Clifford Heath
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-02-
|
19
|
+
date: 2011-02-08 00:00:00 +11:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|