class GksGeoIp
Constants
- BaseURL
- COLUMNS
- IPV4_REGEXP
- VERSION
Attributes
ip[R]
Public Class Methods
new(ip)
click to toggle source
# File lib/gks_geo_ip.rb, line 12 def initialize ip @ip = ip raise 'Invalid IP address' unless ip.to_s =~ IPV4_REGEXP @datas = JSON(open("#{BaseURL}#{@ip}").gets) end
Public Instance Methods
status?()
click to toggle source
# File lib/gks_geo_ip.rb, line 19 def status? @datas["code"] == 0 ? true : false end