class Geolocation

Attributes

callingCode[R]
city[R]
connectionType[R]
continentCode[R]
continentName[R]
countryCapital[R]
countryCode2[R]
countryCode3[R]
countryFlag[R]
countryName[R]
countryTLD[R]
currency[R]
district[R]
geonameID[R]
ip[R]
isEU[R]
isp[R]
languages[R]
latitude[R]
longitude[R]
message[R]
organization[R]
stateProvince[R]
status[R]
timezone[R]
zipCode[R]

Public Class Methods

new(json) click to toggle source
# File lib/ipgeolocation_io/Geolocation.rb, line 32
def initialize(json)
  @status = json["status"].to_i;
  if @status != 200 || json["message"] != nil
    @message = json["message"].to_s;
  else
    @ip = json["ip"];
    @continentCode = json["continent_code"];
    @continentName = json["continent_name"];
    @countryCode2 = json["country_code2"];
    @countryCode3 = json["country_code3"];
    @countryName = json["country_name"];
    @countryCapital = json["country_capital"];
    @stateProvince = json["state_prov"];
    @district = json["district"];
    @city = json["city"];
    @zipcode = json["zipcode"];
    @latitude = json["latitude"];
    @longitude = json["longitude"];
    @isEU = json["is_eu"];
    @callingCode = json["calling_code"];
    @countryTLD = json["country_tld"];
    @languages = json["languages"];
    @countryFlag = json["country_flag"];
    @isp = json["isp"];
    @connectionType = json["connection_type"];
    @organization = json["organization"];
    @geonameID = json["geoname_id"];
    if(json["currency"] != nil)
      @currency = GeolocationCurrency.new(json["currency"]);
    end
    if(json["time_zone"] != nil)
      @timezone = GeolocationTimezone.new(json["time_zone"]);
    end
  end
end