Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Simple client for the IP2Location API

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .document
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rspec
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Guardfile
Octocat-spinner-32 LICENSE.txt
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 gemspec.yml
Octocat-spinner-32 ip2location.gemspec
README.md

ip2location

Description

This is a stupid simple client for IP2LocationAPI written with David Balatero's awesome monster_mash library. I wrote it more or less as practice and to continue to familiarize myself with Ruby 1.9, RSpec, and Typhoeus.

Usage

require 'ip2location'

# Ip2Location.api_key = YOUR_API_KEY
# Ip2Location.user = YOUR_API_USERNAME
#
#  OR

Ip2Location.setup do |s|
  s.api_key = YOUR_API_KEY
  s.user    = YOUR_API_USERNAME
end

puts Ip2Location.ip2l('8.8.8.8')
#=> <struct Ip2Location::Location ip="8.8.8.8", country_code="US", country="United States", region="California", city="Mountain View", latitude="34.305", longitude="-86.2981">

Requirements

  • monster_mash (~> 0.2.3)
  • A username and API key from IP2LocationAPI (free)

Install

gem install ip2location

Copyright

Copyright (c) 2011 Ezekiel Templin

See LICENSE.txt for details.

Something went wrong with that request. Please try again.