net-geoip 0.07

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 ADDED
@@ -0,0 +1,41 @@
1
+ $Id: README,v 1.5 2002/10/09 06:29:48 sean Exp $
2
+
3
+ README for Net::GeoIP
4
+
5
+ Prerequisites: libGeoIP
6
+
7
+ To compile:
8
+ ruby extconf.rb
9
+ make
10
+ make install
11
+
12
+ To test:
13
+ rubytest
14
+
15
+ To use:
16
+
17
+ require 'net/geoip'
18
+ Net::GeoIP::TYPE_DISK >> access type constant
19
+ Net::GeoIP::TYPE_RAM >> access type constant
20
+
21
+ g = Net::GeoIP.new([access_type])
22
+ g = Net::GeoIP.open(db_filename[, access_type])
23
+ Net::GeoIP.update_database(your_key_here[,debug])
24
+
25
+ g.country_code_by_addr('127.0.0.1') >> 'US'
26
+ g.country_code_by_name('yahoo.com') >> 'US'
27
+ g.country_code3_by_addr('127.0.0.1') >> 'USA'
28
+ g.country_code3_by_name('yahoo.com') >> 'USA'
29
+ g.country_name_by_addr('127.0.0.1') >> 'United States'
30
+ g.country_name_by_name('yahoo.com') >> 'United States'
31
+ g.country_id_by_addr('127.0.0.1') >> 225
32
+ g.country_id_by_name('yahoo.com') >> 225
33
+ g.region_by_addr('127.0.0.1') >> ?? Can't test this
34
+ g.region_by_name('yahoo.com') >> ?? Can't test this
35
+
36
+ g.database_info() >> Misc database info
37
+
38
+
39
+ If an address doesn't have a country code, code3, or name, the library
40
+ returns nil. For country_id_by_*, Net::GeoIP returns 0 for countries
41
+ it can't find.
data/TODO ADDED
@@ -0,0 +1,7 @@
1
+ $Id: TODO,v 1.3 2002/10/09 06:29:48 sean Exp $
2
+
3
+ Need to document Net::GeoIP with rubydoc
4
+
5
+ Need to be able to specify different types of databases
6
+
7
+ Figure out why there's a memory leak when using database_info
data/ext/extconf.rb ADDED
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # $Id: extconf.rb,v 1.8 2003/01/07 23:45:07 sean Exp $
4
+
5
+ require 'rbconfig'
6
+ require 'mkmf'
7
+
8
+ dir_config('libz')
9
+ dir_config('geoip')
10
+
11
+ $LIBPATH.push(Config::CONFIG['libdir'])
12
+ $CFLAGS += " -I#{Config::CONFIG['includedir']}"
13
+
14
+ def crash(str)
15
+ printf(" extconf failure: %s\n", str)
16
+ exit 1
17
+ end
18
+
19
+
20
+ unless have_library('z','gzopen')
21
+ crash(<<EOL)
22
+ need libz.
23
+
24
+ Install libz or try passing some of the following options
25
+ to extconf.rb:
26
+
27
+ --with-libz-dir=/path/to/libz
28
+ --with-libz-lib=/path/to/libz/lib
29
+ --with-libz-include=/path/to/libz/include
30
+ EOL
31
+ end
32
+
33
+ unless have_header('GeoIP.h') and
34
+ have_header('GeoIPUpdate.h') and
35
+ have_library('GeoIP', 'GeoIP_new') and
36
+ have_library('GeoIPUpdate', 'GeoIP_update_database')
37
+ crash(<<EOL)
38
+ need libGeoIP.
39
+
40
+ Install the library or try passing one of the following
41
+ options to extconf.rb:
42
+
43
+ --with-geoip-dir=/path/to/geoip
44
+ --with-geoip-lib=/path/to/geoip/lib
45
+ --with-geoip-include=/path/to/geoip/include
46
+
47
+ To obtain libGeoIP, yo ucan download it from:
48
+
49
+ http://maxmind.com/geoip/api/c.shtml
50
+ EOL
51
+ end
52
+
53
+ $CFLAGS = ' -g -Wall ' + $CFLAGS
54
+
55
+ create_header()
56
+ create_makefile('net/geoip')
data/ext/geoip.c ADDED
@@ -0,0 +1,326 @@
1
+ /* $Id: geoip.c,v 1.6 2002/11/19 21:21:38 sean Exp $ */
2
+
3
+ #include "ruby_geoip.h"
4
+ #include "GeoIP.h"
5
+ #include "GeoIPUpdate.h"
6
+
7
+ VALUE ruby_net_geoip_country_code_by_addr(VALUE self, VALUE addr) {
8
+ ruby_net_geoip *rng;
9
+ char *cc;
10
+
11
+ Check_Type(addr, T_STRING);
12
+ Data_Get_Struct(self, ruby_net_geoip, rng);
13
+ cc = (char *)GeoIP_country_code_by_addr(rng->g, STR2CSTR(addr));
14
+ if (cc == NULL) {
15
+ return(Qnil);
16
+ } else {
17
+ return(rb_str_new2(cc));
18
+ }
19
+ }
20
+
21
+
22
+ VALUE ruby_net_geoip_country_code3_by_addr(VALUE self, VALUE addr) {
23
+ ruby_net_geoip *rng;
24
+ char *cc;
25
+
26
+ Check_Type(addr, T_STRING);
27
+ Data_Get_Struct(self, ruby_net_geoip, rng);
28
+ cc = (char *)GeoIP_country_code3_by_addr(rng->g, STR2CSTR(addr));
29
+ if (cc == NULL) {
30
+ return(Qnil);
31
+ } else {
32
+ return(rb_str_new2(cc));
33
+ }
34
+ }
35
+
36
+
37
+ VALUE ruby_net_geoip_country_code_by_name(VALUE self, VALUE name) {
38
+ ruby_net_geoip *rng;
39
+ char *cc;
40
+
41
+ Check_Type(name, T_STRING);
42
+ Data_Get_Struct(self, ruby_net_geoip, rng);
43
+ cc = (char *)GeoIP_country_code_by_name(rng->g, STR2CSTR(name));
44
+ if (cc == NULL) {
45
+ return(Qnil);
46
+ } else {
47
+ return(rb_str_new2(cc));
48
+ }
49
+ }
50
+
51
+
52
+ VALUE ruby_net_geoip_country_code3_by_name(VALUE self, VALUE name) {
53
+ ruby_net_geoip *rng;
54
+ char *cc;
55
+
56
+ Check_Type(name, T_STRING);
57
+ Data_Get_Struct(self, ruby_net_geoip, rng);
58
+ cc = (char *)GeoIP_country_code3_by_name(rng->g, STR2CSTR(name));
59
+ if (cc == NULL) {
60
+ return(Qnil);
61
+ } else {
62
+ return(rb_str_new2(cc));
63
+ }
64
+ }
65
+
66
+
67
+ VALUE ruby_net_geoip_country_id_by_addr(VALUE self, VALUE addr) {
68
+ ruby_net_geoip *rng;
69
+ Check_Type(addr, T_STRING);
70
+ Data_Get_Struct(self, ruby_net_geoip, rng);
71
+ return(INT2NUM(GeoIP_country_id_by_addr(rng->g, STR2CSTR(addr))));
72
+ }
73
+
74
+
75
+ VALUE ruby_net_geoip_country_id_by_name(VALUE self, VALUE name) {
76
+ ruby_net_geoip *rng;
77
+ Check_Type(name, T_STRING);
78
+ Data_Get_Struct(self, ruby_net_geoip, rng);
79
+ return(INT2NUM(GeoIP_country_id_by_name(rng->g, STR2CSTR(name))));
80
+ }
81
+
82
+
83
+ VALUE ruby_net_geoip_country_name_by_addr(VALUE self, VALUE addr) {
84
+ ruby_net_geoip *rng;
85
+ char *cn;
86
+
87
+ Check_Type(addr, T_STRING);
88
+ Data_Get_Struct(self, ruby_net_geoip, rng);
89
+ cn = (char *)GeoIP_country_name_by_addr(rng->g, STR2CSTR(addr));
90
+ if (cn == NULL) {
91
+ return(Qnil);
92
+ } else {
93
+ return(rb_str_new2(cn));
94
+ }
95
+ }
96
+
97
+
98
+ VALUE ruby_net_geoip_country_name_by_name(VALUE self, VALUE name) {
99
+ ruby_net_geoip *rng;
100
+ char *cn;
101
+
102
+ Check_Type(name, T_STRING);
103
+ Data_Get_Struct(self, ruby_net_geoip, rng);
104
+ cn = (char *)GeoIP_country_name_by_name(rng->g, STR2CSTR(name));
105
+ if (cn == NULL) {
106
+ return(Qnil);
107
+ } else {
108
+ return(rb_str_new2(cn));
109
+ }
110
+ }
111
+
112
+
113
+ void ruby_net_geoip_free(ruby_net_geoip *rng) {
114
+ if (rng->g != NULL)
115
+ GeoIP_delete(rng->g);
116
+
117
+ free(rng);
118
+ }
119
+
120
+
121
+ VALUE ruby_net_geoip_new(int argc, VALUE *argv, VALUE class) {
122
+ ruby_net_geoip *rng;
123
+ int db_type;
124
+ VALUE type;
125
+
126
+ switch (argc) {
127
+ case 0:
128
+ db_type = GEOIP_STANDARD;
129
+ break;
130
+ case 1:
131
+ rb_scan_args(argc, argv, "01", &type);
132
+ Check_Type(type, T_FIXNUM);
133
+ switch (NUM2INT(type)) {
134
+ case GEOIP_STANDARD:
135
+ db_type = NUM2INT(type);
136
+ break;
137
+ case GEOIP_MEMORY_CACHE:
138
+ db_type = NUM2INT(type);
139
+ break;
140
+ default:
141
+ rb_raise(rb_eArgError, "invalid database type: bust be TYPE_DISK or TYPE_RAM");
142
+ }
143
+ break;
144
+ default:
145
+ rb_raise(rb_eArgError, "wrong number of arguments (needs 0 or 1)");
146
+ }
147
+ rng = ALLOC(ruby_net_geoip);
148
+ rng->g = GeoIP_new(db_type);
149
+
150
+ return(Data_Wrap_Struct(class, 0, ruby_net_geoip_free, rng));
151
+ }
152
+
153
+
154
+ VALUE ruby_net_geoip_open(int argc, VALUE *argv, VALUE class) {
155
+ ruby_net_geoip *rng;
156
+ int db_type;
157
+ VALUE filename, type;
158
+
159
+ switch (argc) {
160
+ case 1:
161
+ rb_scan_args(argc, argv, "01", &filename);
162
+ Check_Type(filename, T_STRING);
163
+ db_type = GEOIP_STANDARD;
164
+ break;
165
+ case 2:
166
+ rb_scan_args(argc, argv, "02", &filename, &type);
167
+ Check_Type(filename, T_STRING);
168
+ Check_Type(type, T_FIXNUM);
169
+
170
+ switch (NUM2INT(type)) {
171
+ case GEOIP_STANDARD:
172
+ db_type = NUM2INT(type);
173
+ break;
174
+ case GEOIP_MEMORY_CACHE:
175
+ db_type = NUM2INT(type);
176
+ break;
177
+ default:
178
+ rb_raise(rb_eArgError, "invalid database type");
179
+ }
180
+ break;
181
+ default:
182
+ rb_raise(rb_eArgError, "wrong number of arguments (needs 0 or 1)");
183
+ }
184
+ rng = ALLOC(ruby_net_geoip);
185
+ rng->g = GeoIP_open(STR2CSTR(filename), db_type);
186
+
187
+ return(Data_Wrap_Struct(class, 0, ruby_net_geoip_free, rng));
188
+ }
189
+
190
+
191
+ VALUE ruby_net_geoip_database_info(VALUE self) {
192
+ ruby_net_geoip *rng;
193
+ Data_Get_Struct(self, ruby_net_geoip, rng);
194
+ return(rb_str_new2(GeoIP_database_info(rng->g)));
195
+ }
196
+
197
+
198
+ VALUE ruby_net_geoip_region_by_addr(VALUE self, VALUE addr) {
199
+ ruby_net_geoip *rng;
200
+ GeoIPRegion *r;
201
+ VALUE reg;
202
+
203
+ Check_Type(addr, T_STRING);
204
+ Data_Get_Struct(self, ruby_net_geoip, rng);
205
+ r = GeoIP_region_by_addr(rng->g, STR2CSTR(addr));
206
+ if (r == NULL)
207
+ return(Qnil);
208
+
209
+ reg = rb_str_new2(r->region);
210
+ GeoIPRegion_delete(r);
211
+ return(reg);
212
+ }
213
+
214
+
215
+ VALUE ruby_net_geoip_region_by_name(VALUE self, VALUE name) {
216
+ ruby_net_geoip *rng;
217
+ GeoIPRegion *r;
218
+ VALUE reg;
219
+
220
+ Check_Type(name, T_STRING);
221
+ Data_Get_Struct(self, ruby_net_geoip, rng);
222
+ r = GeoIP_region_by_name(rng->g, STR2CSTR(name));
223
+ if (r == NULL)
224
+ return(Qnil);
225
+
226
+ reg = rb_str_new2(r->region);
227
+ GeoIPRegion_delete(r);
228
+ return(reg);
229
+ }
230
+
231
+
232
+ VALUE ruby_net_geoip_update_database(int argc, VALUE *argv, VALUE class) {
233
+ int ret, debug;
234
+ VALUE bool, key;
235
+
236
+ if (argc == 1) {
237
+ rb_scan_args(argc, argv, "10", &key);
238
+ Check_Type(key, T_STRING);
239
+ debug = 0;
240
+ } else if (argc == 2) {
241
+ rb_scan_args(argc, argv, "20", &key, &bool);
242
+ switch (TYPE(bool)) {
243
+ case T_TRUE:
244
+ debug = 1;
245
+ break;
246
+ case T_FALSE:
247
+ debug = 0;
248
+ break;
249
+ default:
250
+ rb_raise(rb_eArgError, "Invalid argument: debug flag must be boolean");
251
+ }
252
+ } else {
253
+ rb_raise(rb_eArgError, "wrong number of arguments (need 1 or 2)");
254
+ }
255
+
256
+ ret = GeoIP_update_database(STR2CSTR(key), debug, NULL);
257
+
258
+ switch (ret) {
259
+ case 0: /* Success, database updated */
260
+ return(Qtrue);
261
+ case 1: /* Database up-to-date, no action taken */
262
+ return(Qfalse);
263
+ case -1:
264
+ rb_raise(eNetGeoIPError, "Invalid License Key in %s", STR2CSTR(key));
265
+ case -11:
266
+ rb_raise(eNetGeoIPError, "Unable to resolve hostname");
267
+ case -12:
268
+ rb_raise(eNetGeoIPError, "Non-IPv4 addres");
269
+ case -13:
270
+ rb_raise(eNetGeoIPError, "Error opening socket");
271
+ case -14:
272
+ rb_raise(eNetGeoIPError, "Unable to connect");
273
+ case -15:
274
+ rb_raise(eNetGeoIPError, "Unable to write GeoIP.dat.gz file");
275
+ case -16:
276
+ rb_raise(eNetGeoIPError, "Unable to write GeoIP.dat file");
277
+ case -17:
278
+ rb_raise(eNetGeoIPError, "Unable to read gzip data");
279
+ case -18:
280
+ rb_raise(eNetGeoIPError, "Out of memory error");
281
+ case -19:
282
+ rb_raise(eNetGeoIPError, "Error reading from socket, see errno");
283
+ default:
284
+ rb_raise(eNetGeoIPError, "Unknown error: contact the maintainer");
285
+ }
286
+ }
287
+
288
+
289
+ void Init_geoip(void) {
290
+ mNet = rb_define_module("Net");
291
+ cNetGeoIP = rb_define_class_under(mNet, "GeoIP", rb_cObject);
292
+ eNetGeoIPError = rb_define_class_under(cNetGeoIP, "Error", rb_eException);
293
+
294
+ rb_define_const(cNetGeoIP, "TYPE_DISK", INT2NUM(GEOIP_STANDARD));
295
+ rb_define_const(cNetGeoIP, "TYPE_RAM", INT2NUM(GEOIP_MEMORY_CACHE));
296
+ rb_define_const(cNetGeoIP, "VERSION", rb_str_new2(RUBY_GEOIP_VERSION));
297
+ rb_define_const(cNetGeoIP, "VERNUM", INT2NUM(RUBY_GEOIP_VERNUM));
298
+
299
+ rb_define_singleton_method(cNetGeoIP, "new", ruby_net_geoip_new, -1);
300
+ rb_define_singleton_method(cNetGeoIP, "open", ruby_net_geoip_open, -1);
301
+ rb_define_singleton_method(cNetGeoIP, "update_database",
302
+ ruby_net_geoip_update_database, -1);
303
+
304
+ rb_define_method(cNetGeoIP, "country_code_by_addr",
305
+ ruby_net_geoip_country_code_by_addr, 1);
306
+ rb_define_method(cNetGeoIP, "country_code3_by_addr",
307
+ ruby_net_geoip_country_code3_by_addr, 1);
308
+ rb_define_method(cNetGeoIP, "country_code_by_name",
309
+ ruby_net_geoip_country_code_by_name, 1);
310
+ rb_define_method(cNetGeoIP, "country_code3_by_name",
311
+ ruby_net_geoip_country_code3_by_name, 1);
312
+ rb_define_method(cNetGeoIP, "country_id_by_addr",
313
+ ruby_net_geoip_country_id_by_addr, 1);
314
+ rb_define_method(cNetGeoIP, "country_id_by_name",
315
+ ruby_net_geoip_country_id_by_name, 1);
316
+ rb_define_method(cNetGeoIP, "country_name_by_addr",
317
+ ruby_net_geoip_country_name_by_addr, 1);
318
+ rb_define_method(cNetGeoIP, "country_name_by_name",
319
+ ruby_net_geoip_country_name_by_name, 1);
320
+ rb_define_method(cNetGeoIP, "database_info",
321
+ ruby_net_geoip_database_info, 0);
322
+ rb_define_method(cNetGeoIP, "region_by_addr",
323
+ ruby_net_geoip_region_by_addr, 1);
324
+ rb_define_method(cNetGeoIP, "region_by_name",
325
+ ruby_net_geoip_region_by_name, 1);
326
+ }
data/ext/ruby_geoip.h ADDED
@@ -0,0 +1,24 @@
1
+ /* $Id: geoip.h,v 1.2 2002/09/28 04:51:09 sean Exp $ */
2
+
3
+ #ifndef __RUBY_GEOIP_H__
4
+ #define __RUBY_GEOIP_H__
5
+
6
+ /* Don't nuke this block! It is used for automatically updating the
7
+ * versions below. VERSION = string formatting, VERNUM = numbered
8
+ * version for inline testing: increment both or none at all. */
9
+ #define RUBY_GEOIP_VERSION "0.01"
10
+ #define RUBY_GEOIP_VERNUM 1
11
+
12
+ #include <ruby.h>
13
+ #include <rubyio.h>
14
+ #include <GeoIP.h>
15
+
16
+ VALUE mNet;
17
+ VALUE cNetGeoIP;
18
+ VALUE eNetGeoIPError;
19
+
20
+ typedef struct ruby_net_geoip {
21
+ GeoIP *g;
22
+ } ruby_net_geoip;
23
+
24
+ #endif
data/net-geoip.gemspec ADDED
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ Gem::Specification.new do |s|
3
+ s.name = 'net-geoip'
4
+ s.date = "2011-05-02"
5
+ s.version = '0.07'
6
+
7
+ s.authors = ["Sean Chittenden", "Steven Baker", "MaxMind", "Ken Robertson"]
8
+ s.email = ["ken@invalidlogic.com"]
9
+
10
+ s.summary = 'Net::GeoIP'
11
+ s.description = "Gem for Net::GeoIP"
12
+
13
+ s.files = `git ls-files`.split("\n")
14
+ s.extensions = ["ext/extconf.rb"]
15
+
16
+ s.add_development_dependency 'rake-compiler'
17
+ end
@@ -0,0 +1,124 @@
1
+ # $Id: tc_Net::GeoIP.rb,v 1.4 2002/10/08 21:14:47 sean Exp $
2
+
3
+ class TC_Net_GeoIP < Test::Unit::TestCase
4
+ def set_up()
5
+ @g = Net::GeoIP.new()
6
+ assert(@g)
7
+ @bad_ips = ['66.250.180.0']
8
+ @bad_names = ['tgd.net']
9
+ @good_ips = [['64.81.67.0','US','USA','United States',225],['210.157.158.0','JP','JPN','Japan',111]]
10
+ @good_names = [['whitehouse.gov','US','United States',225],['freebsd.org','US','United States',225]]
11
+ end
12
+
13
+ def tear_down()
14
+ @g = nil
15
+ @bad_ips = nil
16
+ @bad_names = nil
17
+ @good_ips = nil
18
+ @good_names = nil
19
+ end
20
+
21
+
22
+ def test_net_geoip_constants()
23
+ assert_instance_of(String, Net::GeoIP::VERSION)
24
+ assert_instance_of(Fixnum, Net::GeoIP::VERNUM)
25
+ assert_instance_of(Fixnum, Net::GeoIP::TYPE_DISK)
26
+ assert_instance_of(Fixnum, Net::GeoIP::TYPE_RAM)
27
+ end
28
+
29
+
30
+ def test_net_geoip_country_code_by_addr()
31
+ for ip in @good_ips
32
+ assert_instance_of(ip[1].class, @g.country_code_by_addr(ip[0]))
33
+ assert_equal(ip[1], @g.country_code_by_addr(ip[0]))
34
+ end
35
+
36
+ for ip in @bad_ips
37
+ assert_instance_of(NilClass, @g.country_code_by_addr(ip))
38
+ end
39
+ end
40
+
41
+
42
+ def test_net_geoip_country_code3_by_addr()
43
+ for ip in @good_ips
44
+ assert_instance_of(ip[2].class, @g.country_code3_by_addr(ip[0]))
45
+ assert_equal(ip[2], @g.country_code3_by_addr(ip[0]))
46
+ end
47
+
48
+ for ip in @bad_ips
49
+ assert_instance_of(NilClass, @g.country_code3_by_addr(ip))
50
+ end
51
+ end
52
+
53
+
54
+ def test_net_geoip_country_name_by_addr()
55
+ for ip in @good_ips
56
+ assert_instance_of(ip[3].class, @g.country_name_by_addr(ip[0]))
57
+ assert_equal(ip[3], @g.country_name_by_addr(ip[0]))
58
+ end
59
+
60
+ for ip in @bad_ips
61
+ assert_instance_of(NilClass, @g.country_name_by_addr(ip))
62
+ end
63
+ end
64
+
65
+
66
+ def test_net_geoip_country_id_by_addr()
67
+ for ip in @good_ips
68
+ assert_instance_of(ip[4].class, @g.country_id_by_addr(ip[0]))
69
+ assert_equal(ip[4], @g.country_id_by_addr(ip[0]))
70
+ end
71
+
72
+ for ip in @bad_ips
73
+ assert_equal(0, @g.country_id_by_addr(ip))
74
+ end
75
+ end
76
+
77
+
78
+ def test_net_geoip_country_code_by_name()
79
+ for name in @good_names
80
+ assert_instance_of(name[1].class, @g.country_code_by_name(name[0]))
81
+ assert_equal(name[1], @g.country_code_by_addr(name[0]))
82
+ end
83
+
84
+ for name in @bad_names
85
+ assert_instance_of(NilClass, @g.country_code_by_name(name))
86
+ end
87
+ end
88
+
89
+
90
+ def test_net_geoip_country_name_by_name()
91
+ for name in @good_names
92
+ assert_instance_of(name[2].class, @g.country_name_by_name(name[0]))
93
+ assert_equal(name[2], @g.country_name_by_addr(name[0]))
94
+ end
95
+
96
+ for name in @bad_names
97
+ assert_instance_of(NilClass, @g.country_name_by_name(name))
98
+ end
99
+ end
100
+
101
+
102
+ def test_net_geoip_country_id_by_name()
103
+ for name in @good_names
104
+ assert_instance_of(name[3].class, @g.country_id_by_name(name[0]))
105
+ assert_equal(name[3], @g.country_id_by_addr(name[0]))
106
+ end
107
+
108
+ for name in @bad_names
109
+ assert_equal(0, @g.country_id_by_name(name))
110
+ end
111
+ end
112
+
113
+
114
+ def test_net_geoip_database_info()
115
+ assert_instance_of(String, @g.database_info)
116
+ end
117
+
118
+
119
+ def test_net_geoip_update_database()
120
+ # assert_raises(Net::GeoIP::Error) do
121
+ # @Net::GeoIP.update_database('ruby-Net::GeoIP-test-bad_key', false)
122
+ # end
123
+ end
124
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: net-geoip
3
+ version: !ruby/object:Gem::Version
4
+ hash: 5
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 7
9
+ version: "0.07"
10
+ platform: ruby
11
+ authors:
12
+ - Sean Chittenden
13
+ - Steven Baker
14
+ - MaxMind
15
+ - Ken Robertson
16
+ autorequire:
17
+ bindir: bin
18
+ cert_chain: []
19
+
20
+ date: 2011-05-02 00:00:00 -07:00
21
+ default_executable:
22
+ dependencies:
23
+ - !ruby/object:Gem::Dependency
24
+ name: rake-compiler
25
+ prerelease: false
26
+ requirement: &id001 !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ hash: 3
32
+ segments:
33
+ - 0
34
+ version: "0"
35
+ type: :development
36
+ version_requirements: *id001
37
+ description: Gem for Net::GeoIP
38
+ email:
39
+ - ken@invalidlogic.com
40
+ executables: []
41
+
42
+ extensions:
43
+ - ext/extconf.rb
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - README
48
+ - TODO
49
+ - ext/extconf.rb
50
+ - ext/geoip.c
51
+ - ext/ruby_geoip.h
52
+ - net-geoip.gemspec
53
+ - tests/tc_Net::GeoIP.rb
54
+ has_rdoc: true
55
+ homepage:
56
+ licenses: []
57
+
58
+ post_install_message:
59
+ rdoc_options: []
60
+
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ hash: 3
69
+ segments:
70
+ - 0
71
+ version: "0"
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ hash: 3
78
+ segments:
79
+ - 0
80
+ version: "0"
81
+ requirements: []
82
+
83
+ rubyforge_project:
84
+ rubygems_version: 1.3.7
85
+ signing_key:
86
+ specification_version: 3
87
+ summary: Net::GeoIP
88
+ test_files: []
89
+