Module: FreeGeoIP

Defined in:
lib/freegeoip.rb,
lib/freegeoip/version.rb,
lib/freegeoip/response.rb

Defined Under Namespace

Classes: Response

Constant Summary collapse

CONNECTION =
Faraday.new(:url => "http://freegeoip.net/json/") do |builder|
  builder.adapter Faraday.default_adapter
end
VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.locate(address) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/freegeoip.rb', line 9

def self.locate(address)
  if (response = CONNECTION.get(address)).success?
    MultiJson.decode(response.body)
  else
    false
  end
end