max_mind 1.0.0

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/.gitignore ADDED
@@ -0,0 +1 @@
1
+ max_mind-*.gem
data/Manifest.txt ADDED
@@ -0,0 +1,13 @@
1
+ History.txt
2
+ Manifest.txt
3
+ PostInstall.txt
4
+ README.rdoc
5
+ Rakefile
6
+ lib/maxmind.rb
7
+ script/console
8
+ script/destroy
9
+ script/generate
10
+ spec/maxmind_spec.rb
11
+ spec/spec.opts
12
+ spec/spec_helper.rb
13
+ tasks/rspec.rake
data/README.rdoc ADDED
@@ -0,0 +1,42 @@
1
+ = max_mind
2
+
3
+ http://github.com/crushlovely/max_mind
4
+
5
+ == DESCRIPTION:
6
+
7
+ Ruby library for interacting with the MaxMind GeoIP Web Services.
8
+
9
+ == SYNOPSIS:
10
+
11
+ Just set your license key (an initializer is a good spot if you're using a Rails app):
12
+
13
+ MaxMind::Service.license_key = 'abcdefg'
14
+
15
+ == INSTALL:
16
+
17
+ sudo gem install max_mind
18
+
19
+ == LICENSE:
20
+
21
+ (The MIT License)
22
+
23
+ Copyright (c) 2009 Crush + Lovely
24
+
25
+ Permission is hereby granted, free of charge, to any person obtaining
26
+ a copy of this software and associated documentation files (the
27
+ 'Software'), to deal in the Software without restriction, including
28
+ without limitation the rights to use, copy, modify, merge, publish,
29
+ distribute, sublicense, and/or sell copies of the Software, and to
30
+ permit persons to whom the Software is furnished to do so, subject to
31
+ the following conditions:
32
+
33
+ The above copyright notice and this permission notice shall be
34
+ included in all copies or substantial portions of the Software.
35
+
36
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
37
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
38
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
39
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
40
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
41
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
42
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,44 @@
1
+ %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
2
+ require File.dirname(__FILE__) + '/lib/max_mind'
3
+
4
+ # Jeweler 1.0.0
5
+ begin
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |gemspec|
8
+ gemspec.name = "max_mind"
9
+ gemspec.summary = "Ruby library for interacting with the MaxMind GeoIP Web Services."
10
+ gemspec.email = ["pj@crushlovely.com", "nate@nateclark.com"]
11
+ gemspec.homepage = "http://github.com/crushlovely/max_mind"
12
+ gemspec.description = "Ruby library for interacting with the MaxMind GeoIP Web Services."
13
+ gemspec.authors = ["PJ Kelly", "Nate Clark"]
14
+ end
15
+ rescue LoadError
16
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
17
+ end
18
+
19
+
20
+ # # Generate all the Rake tasks
21
+ # # Run 'rake -T' to see list of generated tasks (from gem root directory)
22
+ # $hoe = Hoe.new('max_mind', MaxMind::VERSION) do |p|
23
+ # p.developer('FIXME full name', 'FIXME email')
24
+ # p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
25
+ # p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
26
+ # p.rubyforge_name = p.name # TODO this is default value
27
+ # # p.extra_deps = [
28
+ # # ['activesupport','>= 2.0.2'],
29
+ # # ]
30
+ # p.extra_dev_deps = [
31
+ # ['newgem', ">= #{::Newgem::VERSION}"]
32
+ # ]
33
+ #
34
+ # p.clean_globs |= %w[**/.DS_Store tmp *.log]
35
+ # path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
36
+ # p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
37
+ # p.rsync_args = '-av --delete --ignore-errors'
38
+ # end
39
+
40
+ # require 'newgem/tasks' # load /tasks/*.rake
41
+ Dir['tasks/**/*.rake'].each { |t| load t }
42
+
43
+ # TODO - want other tests/tasks run by default? Add them to the list
44
+ # task :default => [:spec, :features]
data/VERSION.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :major: 1
3
+ :minor: 0
4
+ :patch: 0
@@ -0,0 +1,5 @@
1
+ $:.push(File.join(File.dirname(__FILE__), %w[.. .. rspec]))
2
+
3
+ Autotest.add_discovery do
4
+ "rspec"
5
+ end
data/lib/max_mind.rb ADDED
@@ -0,0 +1,32 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+
3
+ require 'rubygems'
4
+ require 'active_support'
5
+
6
+ require 'uri'
7
+ require 'cgi'
8
+ require 'net/http'
9
+ require 'logger'
10
+ require 'yaml'
11
+ require 'csv'
12
+
13
+ class Hash
14
+ def to_query_string
15
+ self.to_a.collect { |p| "#{p.first.to_s}=#{p.last}" }.join("&")
16
+ end
17
+ end
18
+
19
+ require 'max_mind/service'
20
+ require 'max_mind/service/country'
21
+ require 'max_mind/service/city'
22
+ require 'max_mind/service/city_isp_org'
23
+
24
+ module MaxMind
25
+ class LicenseError < StandardError; end
26
+ class ConfigurationError < StandardError; end
27
+ class ConnectionError < StandardError; end
28
+ class RequestError < StandardError; end
29
+ class ResponseError < StandardError; end
30
+
31
+ VERSION = '1.0.0'
32
+ end
@@ -0,0 +1,55 @@
1
+ module MaxMind
2
+ class Service
3
+ cattr_accessor :license_key
4
+
5
+ cattr_accessor :base_url
6
+ self.base_url = 'http://geoip1.maxmind.com'
7
+
8
+ class_inheritable_accessor :base_path
9
+
10
+ attr_accessor :response
11
+
12
+ def self.fetch_for_ip(ip)
13
+ raise RequestError.new("Cannot make a request without an IP address") if ip.nil?
14
+ service = self.new
15
+ service.make_request(ip)
16
+ service.parsed_response
17
+ end
18
+
19
+ # This method should be implemented in subclasses
20
+ # Here, we're only returning the raw data returned by the server
21
+ def parsed_response
22
+ self.response
23
+ end
24
+
25
+ def make_request(ip)
26
+ if license_key.nil?
27
+ raise LicenseError.new("License Key is missing")
28
+ end
29
+
30
+ uri = URI.parse(base_url)
31
+
32
+ begin
33
+ self.response = Net::HTTP.get(uri.host, build_path(:l => license_key, :i => ip), uri.port)
34
+ rescue EOFError => e
35
+ raise ConnectionError, "The remote server dropped the connection"
36
+ rescue Errno::ECONNRESET => e
37
+ raise ConnectionError, "The remote server reset the connection"
38
+ rescue Errno::ECONNREFUSED => e
39
+ raise ConnectionError, "The remote server refused the connection"
40
+ rescue Timeout::Error, Errno::ETIMEDOUT => e
41
+ raise ConnectionError, "The connection to the remote server timed out"
42
+ end
43
+
44
+ end
45
+
46
+ def build_path(params = {})
47
+ raise RequestError.new("Cannot build a valid request path!") unless !base_path.nil? && params.is_a?(Hash)
48
+ base_path + '?' + params.to_query_string
49
+ end
50
+
51
+ def valid_response?
52
+ !self.response.blank?
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,29 @@
1
+ module MaxMind
2
+ class CityService < Service
3
+
4
+ self.base_path = '/b'
5
+
6
+ def parsed_response
7
+ if self.valid_response?
8
+ parsed_response = CSV.parse_line(self.response)
9
+ {
10
+ :country => parsed_response[0],
11
+ :state => parsed_response[1],
12
+ :city => parsed_response[2],
13
+ :latitude => parsed_response[3],
14
+ :longitude => parsed_response[4],
15
+ :api_response => self.response
16
+ }
17
+ else
18
+ {
19
+ :api_response => self.response
20
+ }
21
+ end
22
+ end
23
+
24
+ def valid_response?
25
+ super && !(self.response =~ /,,,,,(.+?)/)
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,30 @@
1
+ module MaxMind
2
+ class CityIspOrgService < Service
3
+
4
+ self.base_path = '/f'
5
+
6
+ def parsed_response
7
+ if self.valid_response?
8
+ parsed_response = CSV.parse_line(self.response)
9
+ {
10
+ :country => parsed_response[0],
11
+ :state => parsed_response[1],
12
+ :city => parsed_response[2],
13
+ :postal_code => parsed_response[3],
14
+ :latitude => parsed_response[4],
15
+ :longitude => parsed_response[5],
16
+ :api_response => self.response
17
+ }
18
+ else
19
+ {
20
+ :api_response => self.response
21
+ }
22
+ end
23
+ end
24
+
25
+ def valid_response?
26
+ super && !(self.response =~ /,,,,,,,,,,(.+?)/)
27
+ end
28
+
29
+ end
30
+ end
@@ -0,0 +1,25 @@
1
+ module MaxMind
2
+ class CountryService < Service
3
+
4
+ self.base_path = '/a'
5
+
6
+ def parsed_response
7
+ if self.valid_response?
8
+ parsed_response = CSV.parse_line(self.response)
9
+ {
10
+ :country => parsed_response[0],
11
+ :api_response => self.response
12
+ }
13
+ else
14
+ {
15
+ :api_response => self.response
16
+ }
17
+ end
18
+ end
19
+
20
+ def valid_response?
21
+ super && !(self.response =~ /\(NULL\),(.+?)/)
22
+ end
23
+
24
+ end
25
+ end
data/max_mind.gemspec ADDED
@@ -0,0 +1,66 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{max_mind}
8
+ s.version = "1.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["PJ Kelly", "Nate Clark"]
12
+ s.date = %q{2009-10-22}
13
+ s.description = %q{Ruby library for interacting with the MaxMind GeoIP Web Services.}
14
+ s.email = ["pj@crushlovely.com", "nate@nateclark.com"]
15
+ s.extra_rdoc_files = [
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ ".gitignore",
20
+ "Manifest.txt",
21
+ "README.rdoc",
22
+ "Rakefile",
23
+ "VERSION.yml",
24
+ "lib/autotest/discover.rb",
25
+ "lib/max_mind.rb",
26
+ "lib/max_mind/service.rb",
27
+ "lib/max_mind/service/city.rb",
28
+ "lib/max_mind/service/city_isp_org.rb",
29
+ "lib/max_mind/service/country.rb",
30
+ "max_mind.gemspec",
31
+ "script/console",
32
+ "script/destroy",
33
+ "script/generate",
34
+ "spec/city_isp_org_spec.rb",
35
+ "spec/city_spec.rb",
36
+ "spec/country_spec.rb",
37
+ "spec/max_mind_spec.rb",
38
+ "spec/service_spec.rb",
39
+ "spec/spec.opts",
40
+ "spec/spec_helper.rb",
41
+ "tasks/rspec.rake"
42
+ ]
43
+ s.homepage = %q{http://github.com/crushlovely/max_mind}
44
+ s.rdoc_options = ["--charset=UTF-8"]
45
+ s.require_paths = ["lib"]
46
+ s.rubygems_version = %q{1.3.5}
47
+ s.summary = %q{Ruby library for interacting with the MaxMind GeoIP Web Services.}
48
+ s.test_files = [
49
+ "spec/city_isp_org_spec.rb",
50
+ "spec/city_spec.rb",
51
+ "spec/country_spec.rb",
52
+ "spec/max_mind_spec.rb",
53
+ "spec/service_spec.rb",
54
+ "spec/spec_helper.rb"
55
+ ]
56
+
57
+ if s.respond_to? :specification_version then
58
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
59
+ s.specification_version = 3
60
+
61
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
62
+ else
63
+ end
64
+ else
65
+ end
66
+ end
data/script/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/maxmind.rb'}"
9
+ puts "Loading maxmind gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
data/script/destroy ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1,34 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe MaxMind::CityIspOrgService do
4
+
5
+ it "base_path should be /f by default" do
6
+ MaxMind::CityIspOrgService.base_path.should == '/f'
7
+ end
8
+
9
+ describe "response parsing" do
10
+
11
+ before(:each) do
12
+ @ip = '12.12.12.12'
13
+ MaxMind::CityIspOrgService.license_key = '1234'
14
+ end
15
+
16
+ it "should return a hash of values if response is valid" do
17
+ @valid_response = 'US,NY,Brooklyn,11222,40.728001,-73.945297,501,718,"Road Runner","Road Runner"'
18
+ Net::HTTP.stub!(:get).and_return(@valid_response)
19
+ @response = MaxMind::CityIspOrgService.fetch_for_ip(@ip)
20
+ @response.should == {:latitude=>"40.728001", :longitude=>"-73.945297", :country=>"US", :city=>"Brooklyn", :postal_code=>"11222", :state=>"NY", :api_response => @valid_response}
21
+ end
22
+
23
+ ['WHAteVEr', 'g@rbag3', '432153'].each do |r|
24
+ it "should return nil if response is invalid" do
25
+ @invalid_response = ",,,,,,,,,,#{r}"
26
+ Net::HTTP.stub!(:get).and_return(@invalid_response)
27
+ @response = MaxMind::CityIspOrgService.fetch_for_ip(@ip)
28
+ @response.should == {:api_response => @invalid_response}
29
+ end
30
+ end
31
+
32
+ end
33
+
34
+ end
data/spec/city_spec.rb ADDED
@@ -0,0 +1,34 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe MaxMind::CityService do
4
+
5
+ it "base_path should be /b by default" do
6
+ MaxMind::CityService.base_path.should == '/b'
7
+ end
8
+
9
+ describe "response parsing" do
10
+
11
+ before(:each) do
12
+ @ip = '12.12.12.12'
13
+ MaxMind::CityService.license_key = '1234'
14
+ end
15
+
16
+ it "should return a hash of values if response is valid" do
17
+ @valid_response = 'US,NY,Brooklyn,40.728001,-73.945297'
18
+ Net::HTTP.stub!(:get).and_return(@valid_response)
19
+ @response = MaxMind::CityService.fetch_for_ip(@ip)
20
+ @response.should == {:latitude=>"40.728001", :longitude=>"-73.945297", :country=>"US", :city=>"Brooklyn", :state=>"NY", :api_response => @valid_response}
21
+ end
22
+
23
+ ['WHAteVEr', 'g@rbag3', '432153'].each do |r|
24
+ it "should return nil if response is invalid" do
25
+ @invalid_response = ",,,,,#{r}"
26
+ Net::HTTP.stub!(:get).and_return(@invalid_response)
27
+ @response = MaxMind::CityService.fetch_for_ip(@ip)
28
+ @response.should == {:api_response => @invalid_response}
29
+ end
30
+ end
31
+
32
+ end
33
+
34
+ end
@@ -0,0 +1,34 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe MaxMind::CountryService do
4
+
5
+ it "base_path should be /a by default" do
6
+ MaxMind::CountryService.base_path.should == '/a'
7
+ end
8
+
9
+ describe "response parsing" do
10
+
11
+ before(:each) do
12
+ @ip = '12.12.12.12'
13
+ MaxMind::CountryService.license_key = '1234'
14
+ end
15
+
16
+ it "should return a hash of values if response is valid" do
17
+ @valid_response = 'US'
18
+ Net::HTTP.stub!(:get).and_return(@valid_response)
19
+ @response = MaxMind::CountryService.fetch_for_ip(@ip)
20
+ @response.should == {:country=>"US", :api_response => @valid_response}
21
+ end
22
+
23
+ ['WHAteVEr', 'g@rbag3', '432153'].each do |r|
24
+ it "should return nil if response is invalid" do
25
+ @invalid_response = "(NULL),#{r}"
26
+ Net::HTTP.stub!(:get).and_return(@invalid_response)
27
+ @response = MaxMind::CountryService.fetch_for_ip(@ip)
28
+ @response.should == {:api_response => @invalid_response}
29
+ end
30
+ end
31
+
32
+ end
33
+
34
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe MaxMind do
4
+
5
+ it "should specify version as a constant" do
6
+ MaxMind::VERSION.should_not be_nil
7
+ end
8
+
9
+ end
@@ -0,0 +1,103 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe MaxMind::Service do
4
+
5
+ before(:each) do
6
+ MaxMind::Service.license_key = nil
7
+ end
8
+
9
+ describe "class attributes" do
10
+
11
+ it "should have a @@base_url defined" do
12
+ MaxMind::Service.base_url.should_not be_nil
13
+ end
14
+
15
+ it "@@base_url should be http://geoip1.maxmind.com by default" do
16
+ MaxMind::Service.base_url.should == 'http://geoip1.maxmind.com'
17
+ end
18
+
19
+ it "should have no license_key initially" do
20
+ MaxMind::Service.license_key.should == nil
21
+ end
22
+
23
+ it "should have no base_path initially" do
24
+ MaxMind::Service.base_path.should == nil
25
+ end
26
+
27
+ end
28
+
29
+ describe "class and instance methods" do
30
+
31
+ before(:each) do
32
+ @ip = '12.12.12.12'
33
+ @sample_response = 'US,NY,Brooklyn,11222,40.728001,-73.945297,501,718,"Road Runner","Road Runner"'
34
+ @base_path = '/z'
35
+ Net::HTTP.stub!(:get).and_return(@sample_response)
36
+ MaxMind::Service.stub!(:base_path).and_return(@base_path)
37
+ end
38
+
39
+ describe ".fetch_for_ip" do
40
+
41
+ it "should raise a license error if api key is not set" do
42
+ lambda {
43
+ MaxMind::Service.fetch_for_ip(@ip)
44
+ }.should raise_error(MaxMind::LicenseError)
45
+ end
46
+
47
+ describe "with license key" do
48
+
49
+ it "should return response" do
50
+ MaxMind::Service.license_key = '1234'
51
+ MaxMind::Service.fetch_for_ip(@ip).should == @sample_response
52
+ end
53
+
54
+ end
55
+
56
+ end
57
+
58
+ describe ".license_key=" do
59
+
60
+ it "allows the service subclass to inherit the license key" do
61
+ MaxMind::Service.license_key = 'abcdefg'
62
+ MaxMind::CityService.license_key.should == 'abcdefg'
63
+ end
64
+
65
+ end
66
+
67
+ describe ".base_url=" do
68
+ it "allows the service subclass to inherit the license key" do
69
+ MaxMind::Service.base_url = 'http://geoip3.maxmind.com'
70
+ MaxMind::CityService.base_url.should == 'http://geoip3.maxmind.com'
71
+ end
72
+ end
73
+
74
+
75
+
76
+ describe "instance methods" do
77
+
78
+ before(:each) do
79
+ MaxMind::Service.license_key = '1234'
80
+ @service = MaxMind::Service.new
81
+ end
82
+
83
+ it "should make request" do
84
+ @service.make_request(@ip).should == @sample_response
85
+ end
86
+
87
+ it "should build a proper path" do
88
+ query_params = {:meow => '1', :woof => '2'}
89
+ @service.build_path(query_params).should == "#{@base_path}?#{query_params.to_query_string}"
90
+ end
91
+
92
+ it "valid_response? should ensure response is not blank" do
93
+ @service = MaxMind::Service.new
94
+ @service.valid_response?.should be_false
95
+ @service.response = @sample_response
96
+ @service.valid_response?.should be_true
97
+ end
98
+
99
+ end
100
+
101
+ end
102
+
103
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,10 @@
1
+ require File.dirname(__FILE__) + '/../lib/max_mind'
2
+
3
+ begin
4
+ require 'spec'
5
+ rescue LoadError
6
+ require 'rubygems'
7
+ gem 'rspec'
8
+ require 'spec'
9
+ end
10
+
data/tasks/rspec.rake ADDED
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ require 'spec'
6
+ end
7
+ begin
8
+ require 'spec/rake/spectask'
9
+ rescue LoadError
10
+ puts <<-EOS
11
+ To use rspec for testing you must install rspec gem:
12
+ gem install rspec
13
+ EOS
14
+ exit(0)
15
+ end
16
+
17
+ desc "Run the specs under spec/models"
18
+ Spec::Rake::SpecTask.new do |t|
19
+ t.spec_opts = ['--options', "spec/spec.opts"]
20
+ t.spec_files = FileList['spec/**/*_spec.rb']
21
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: max_mind
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - PJ Kelly
8
+ - Nate Clark
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2009-10-22 00:00:00 -07:00
14
+ default_executable:
15
+ dependencies: []
16
+
17
+ description: Ruby library for interacting with the MaxMind GeoIP Web Services.
18
+ email:
19
+ - pj@crushlovely.com
20
+ - nate@nateclark.com
21
+ executables: []
22
+
23
+ extensions: []
24
+
25
+ extra_rdoc_files:
26
+ - README.rdoc
27
+ files:
28
+ - .gitignore
29
+ - Manifest.txt
30
+ - README.rdoc
31
+ - Rakefile
32
+ - VERSION.yml
33
+ - lib/autotest/discover.rb
34
+ - lib/max_mind.rb
35
+ - lib/max_mind/service.rb
36
+ - lib/max_mind/service/city.rb
37
+ - lib/max_mind/service/city_isp_org.rb
38
+ - lib/max_mind/service/country.rb
39
+ - max_mind.gemspec
40
+ - script/console
41
+ - script/destroy
42
+ - script/generate
43
+ - spec/city_isp_org_spec.rb
44
+ - spec/city_spec.rb
45
+ - spec/country_spec.rb
46
+ - spec/max_mind_spec.rb
47
+ - spec/service_spec.rb
48
+ - spec/spec.opts
49
+ - spec/spec_helper.rb
50
+ - tasks/rspec.rake
51
+ has_rdoc: true
52
+ homepage: http://github.com/crushlovely/max_mind
53
+ licenses: []
54
+
55
+ post_install_message:
56
+ rdoc_options:
57
+ - --charset=UTF-8
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: "0"
65
+ version:
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: "0"
71
+ version:
72
+ requirements: []
73
+
74
+ rubyforge_project:
75
+ rubygems_version: 1.3.5
76
+ signing_key:
77
+ specification_version: 3
78
+ summary: Ruby library for interacting with the MaxMind GeoIP Web Services.
79
+ test_files:
80
+ - spec/city_isp_org_spec.rb
81
+ - spec/city_spec.rb
82
+ - spec/country_spec.rb
83
+ - spec/max_mind_spec.rb
84
+ - spec/service_spec.rb
85
+ - spec/spec_helper.rb