fastgeoip 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,11 +1,33 @@
1
1
  = fastgeoip
2
2
 
3
- Small and simple wrapper for MaxMind GeoIP. Partly based on the MaxMind GeoIP C Code and the Net/GeoIP extension.
3
+ Small and simple wrapper for MaxMind GeoIP (country). Partly based on the MaxMind GeoIP C Code and the Net/GeoIP extension.
4
+
5
+ Currently the only supported operations are:
6
+ * open a database
7
+ * ip to country iso code lookup
8
+
9
+ ... but it is fast ;-)
10
+
11
+ == How to use
12
+
13
+ gem install fastgeoip
14
+
15
+ Download the GeoIP database http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
16
+
17
+ require 'fastgeoip'
18
+
19
+ db = FastGeoIp.open 'path-to-yor-data-file/GeoIP.dat'
20
+ db.country_code_by_addr('81.1.1.1') # should yield 'US'
4
21
 
5
22
  == Todo
6
23
 
7
24
  * add tests
8
25
 
26
+ == Changelog
27
+
28
+ 0.2.0 - Ruby 1.9 support
29
+ 0.1.0 - initial release
30
+
9
31
  == Copyright
10
32
 
11
33
  Copyright (c) 2010 Martin Karlsch. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
data/ext/fastgeoip.c CHANGED
@@ -9,7 +9,7 @@ VALUE geoip_country_code_by_addr(VALUE self, VALUE addr) {
9
9
 
10
10
  Check_Type(addr, T_STRING);
11
11
  Data_Get_Struct(self, fast_geoip, fgi);
12
- cc = (char *)GeoIP_country_code_by_addr(fgi->db, STR2CSTR(addr));
12
+ cc = (char *)GeoIP_country_code_by_addr(fgi->db, StringValuePtr(addr));
13
13
  if (cc == NULL) {
14
14
  return(Qnil);
15
15
  } else {
@@ -36,7 +36,7 @@ VALUE geoip_open(int argc, VALUE *argv, VALUE class) {
36
36
  rb_raise(rb_eArgError, "wrong number of arguments (needs 1 : filename of db)");
37
37
 
38
38
  fgi = ALLOC(fast_geoip);
39
- fgi->db = GeoIP_open(STR2CSTR(filename), GEOIP_MEMORY_CACHE);
39
+ fgi->db = GeoIP_open( StringValuePtr(filename), GEOIP_MEMORY_CACHE);
40
40
  return(Data_Wrap_Struct(class, 0, geoip_free, fgi));
41
41
  }
42
42
 
data/fastgeoip.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fastgeoip}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Martin Karlsch"]
12
- s.date = %q{2010-07-13}
12
+ s.date = %q{2010-07-20}
13
13
  s.description = %q{A much longer description will follow ...}
14
14
  s.email = %q{martin@karlsch.com}
15
15
  s.extensions = ["ext/extconf.rb"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastgeoip
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Martin Karlsch
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-13 00:00:00 +02:00
18
+ date: 2010-07-20 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21