Class: NiriIpTrack::IpTrack

Inherits:
Object
  • Object
show all
Defined in:
lib/niri_ip_track.rb

Class Method Summary collapse

Class Method Details

.locate_ip(ip) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/niri_ip_track.rb', line 9

def self.locate_ip(ip)
  client_ip = ip
  # ip_call ="http://freegeoip.io/json/#{client_ip}"
  # require 'open-uri'
  # require 'json'
  ip_call ="http://freegeoip.io/json/#{client_ip}"
  content = open(ip_call).read
  data=JSON.parse(content)
  return data
end

.locate_ip_csv(ip) ⇒ Object



26
27
28
29
30
31
# File 'lib/niri_ip_track.rb', line 26

def self.locate_ip_csv(ip)
  client_ip = ip
  ip_call = "http://freegeoip.io/csv/#{client_ip}"
  content = open(ip_call).read
  return content
end

.locate_ip_xml(ip) ⇒ Object



19
20
21
22
23
24
# File 'lib/niri_ip_track.rb', line 19

def self.locate_ip_xml(ip)
  client_ip = ip
  ip_call = "http://freegeoip.io/xml/#{client_ip}"
  content = open(ip_call).read
  return content
end