Module: GeoMagic::Remote::ClassMethods

Included in:
GeoMagic::Remote
Defined in:
lib/geo_magic/remote.rb

Instance Method Summary collapse

Instance Method Details

#location_of(ip) ⇒ Object



31
32
33
# File 'lib/geo_magic/remote.rb', line 31

def location_of ip
  create_location HTTParty.get("http://freegeoip.net/json/#{ip}")
end

#my_ipObject



22
23
24
25
# File 'lib/geo_magic/remote.rb', line 22

def my_ip
  response = HTTParty.get('http://freegeoip.net/json/')
  response.parsed_response['ip']
end

#my_location(mode = :location) ⇒ Object



27
28
29
# File 'lib/geo_magic/remote.rb', line 27

def my_location mode = :location
  create_location HTTParty.get('http://freegeoip.net/json/')
end