Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
coverage
rdoc
pkg
Gemfile.lock
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gemspec
13 changes: 10 additions & 3 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@ Installation

Dependencies
------------
* active_support
* [shoulda](http://github.com/thoughtbot/shoulda/) (used in tests only)
* [matchy](http://github.com/jeremymcanally/matchy/) (used in tests only)
A `Gemfile` pointing to `gemspec` has been added so that bundler can be used to update dependencies. Just run

bundler install

Running Tests
-------------

Run `bundle install` to make sure you have all the dependencies. In some cases it may be necessary to install
ActiveSupport by hand, `gem install activesupport`. Once that's done, run:

rake test

Usage
-----
Expand Down
7 changes: 4 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ http://www.maxmind.com/app/ccv_overview
gem.email = "tm@iprog.com"
gem.homepage = "http://github.com/zarqman/maxmind"
gem.authors = ["Adam Daniels", "Tinu Cleatus", 't.e.morgan']
gem.add_dependency 'activesupport', '>= 2.3'
gem.add_development_dependency('shoulda')
gem.add_development_dependency('matchy')
gem.add_dependency 'activesupport', '>= 3.0.0'
gem.add_development_dependency('shoulda', '>= 2.11.3')
gem.add_development_dependency('mcmire-matchy', '>= 0.5.2')
gem.add_development_dependency('fakeweb', '>= 1.3.0')
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end
Jeweler::GemcutterTasks.new
Expand Down
4 changes: 3 additions & 1 deletion lib/maxmind.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# require 'rubygems'
require 'active_support'
unless Module.respond_to?(:mattr_accessor)
require 'active_support/core_ext/module/attribute_accessors'# rescue nil # this may be needed for ActiveSupport versions >= 3.x
end
require 'net/http'
require 'net/https'
require 'uri'
Expand Down
4 changes: 2 additions & 2 deletions lib/maxmind/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def query

# Upon a failure at the first URL, will automatically retry with the second one before finally raising an exception
def post(query_params)
servers ||= ["https://minfraud1.maxmind.com/app/ccv2r", "https://minfraud3.maxmind.com/app/ccv2r"]
servers ||= ["https://minfraud2.maxmind.com/app/ccv2r", "https://minfraud1.maxmind.com/app/ccv2r", "https://minfraud3.maxmind.com/app/ccv2r"]
url = URI.parse(servers.shift)

# req = Net::HTTP::Get.new("#{url.path}?#{query_string}")
Expand Down Expand Up @@ -142,4 +142,4 @@ def validate
raise ArgumentError, 'Country is required' unless country
end
end
end
end
2 changes: 1 addition & 1 deletion lib/maxmind/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def initialize(response = nil)
def attributes_from_response
hash_to_return = {}
self.instance_variables.each do |var|
hash_to_return[var.gsub("@","")] = self.instance_variable_get(var)
hash_to_return[var.to_s.gsub("@","")] = self.instance_variable_get(var)
end
return hash_to_return
end
Expand Down
79 changes: 38 additions & 41 deletions maxmind-rb.gemspec
Original file line number Diff line number Diff line change
@@ -1,67 +1,64 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = %q{maxmind-rb}
s.name = "maxmind-rb"
s.version = "0.4.0"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Adam Daniels", "Tinu Cleatus", "t.e.morgan"]
s.date = %q{2010-03-06}
s.description = %q{A wrapper around MaxMind's minFraud anti-fraud service.

http://www.maxmind.com/app/ccv_overview
}
s.email = %q{tm@iprog.com}
s.date = "2011-11-12"
s.description = "A wrapper around MaxMind's minFraud anti-fraud service. \n\nhttp://www.maxmind.com/app/ccv_overview\n"
s.email = "tm@iprog.com"
s.extra_rdoc_files = [
"LICENSE",
"README.markdown"
"README.markdown"
]
s.files = [
".document",
".gitignore",
"LICENSE",
"README.markdown",
"Rakefile",
"VERSION",
"examples/example.rb",
"lib/maxmind.rb",
"lib/maxmind/request.rb",
"lib/maxmind/response.rb",
"test/fixtures/response.txt",
"test/maxmind_test.rb",
"test/test_helper.rb"
]
s.homepage = %q{http://github.com/zarqman/maxmind}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.4}
s.summary = %q{Wrapper for MaxMind's minFraud service}
s.test_files = [
"Gemfile",
"LICENSE",
"README.markdown",
"Rakefile",
"VERSION",
"examples/example.rb",
"lib/maxmind.rb",
"lib/maxmind/request.rb",
"lib/maxmind/response.rb",
"maxmind-rb.gemspec",
"test/fixtures/response.txt",
"test/maxmind_test.rb",
"test/test_helper.rb",
"examples/example.rb"
"test/test_helper.rb"
]
s.homepage = "http://github.com/zarqman/maxmind"
s.require_paths = ["lib"]
s.rubygems_version = "1.8.10"
s.summary = "Wrapper for MaxMind's minFraud service"

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3

if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<activesupport>, [">= 2.3"])
s.add_development_dependency(%q<shoulda>, [">= 0"])
s.add_development_dependency(%q<matchy>, [">= 0"])
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<maxmind-rb>, [">= 0"])
s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0"])
s.add_development_dependency(%q<shoulda>, [">= 2.11.3"])
s.add_development_dependency(%q<mcmire-matchy>, [">= 0.5.2"])
s.add_development_dependency(%q<fakeweb>, [">= 1.3.0"])
else
s.add_dependency(%q<activesupport>, [">= 2.3"])
s.add_dependency(%q<shoulda>, [">= 0"])
s.add_dependency(%q<matchy>, [">= 0"])
s.add_dependency(%q<maxmind-rb>, [">= 0"])
s.add_dependency(%q<activesupport>, [">= 3.0.0"])
s.add_dependency(%q<shoulda>, [">= 2.11.3"])
s.add_dependency(%q<mcmire-matchy>, [">= 0.5.2"])
s.add_dependency(%q<fakeweb>, [">= 1.3.0"])
end
else
s.add_dependency(%q<activesupport>, [">= 2.3"])
s.add_dependency(%q<shoulda>, [">= 0"])
s.add_dependency(%q<matchy>, [">= 0"])
s.add_dependency(%q<maxmind-rb>, [">= 0"])
s.add_dependency(%q<activesupport>, [">= 3.0.0"])
s.add_dependency(%q<shoulda>, [">= 2.11.3"])
s.add_dependency(%q<mcmire-matchy>, [">= 0.5.2"])
s.add_dependency(%q<fakeweb>, [">= 1.3.0"])
end
end