Class: Geolocation
- Inherits:
-
Object
- Object
- Geolocation
- Defined in:
- lib/ipgeolocation_io/Geolocation.rb
Instance Attribute Summary collapse
-
#callingCode ⇒ Object
readonly
Returns the value of attribute callingCode.
-
#city ⇒ Object
readonly
Returns the value of attribute city.
-
#connectionType ⇒ Object
readonly
Returns the value of attribute connectionType.
-
#continentCode ⇒ Object
readonly
Returns the value of attribute continentCode.
-
#continentName ⇒ Object
readonly
Returns the value of attribute continentName.
-
#countryCapital ⇒ Object
readonly
Returns the value of attribute countryCapital.
-
#countryCode2 ⇒ Object
readonly
Returns the value of attribute countryCode2.
-
#countryCode3 ⇒ Object
readonly
Returns the value of attribute countryCode3.
-
#countryFlag ⇒ Object
readonly
Returns the value of attribute countryFlag.
-
#countryName ⇒ Object
readonly
Returns the value of attribute countryName.
-
#countryTLD ⇒ Object
readonly
Returns the value of attribute countryTLD.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#district ⇒ Object
readonly
Returns the value of attribute district.
-
#geonameID ⇒ Object
readonly
Returns the value of attribute geonameID.
-
#ip ⇒ Object
readonly
Returns the value of attribute ip.
-
#isEU ⇒ Object
readonly
Returns the value of attribute isEU.
-
#isp ⇒ Object
readonly
Returns the value of attribute isp.
-
#languages ⇒ Object
readonly
Returns the value of attribute languages.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#organization ⇒ Object
readonly
Returns the value of attribute organization.
-
#stateProvince ⇒ Object
readonly
Returns the value of attribute stateProvince.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#timezone ⇒ Object
readonly
Returns the value of attribute timezone.
-
#zipCode ⇒ Object
readonly
Returns the value of attribute zipCode.
Instance Method Summary collapse
-
#initialize(json) ⇒ Geolocation
constructor
A new instance of Geolocation.
Constructor Details
#initialize(json) ⇒ Geolocation
Returns a new instance of Geolocation.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# 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 |
Instance Attribute Details
#callingCode ⇒ Object (readonly)
Returns the value of attribute callingCode.
21 22 23 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 21 def callingCode @callingCode end |
#city ⇒ Object (readonly)
Returns the value of attribute city.
16 17 18 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 16 def city @city end |
#connectionType ⇒ Object (readonly)
Returns the value of attribute connectionType.
26 27 28 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 26 def connectionType @connectionType end |
#continentCode ⇒ Object (readonly)
Returns the value of attribute continentCode.
8 9 10 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 8 def continentCode @continentCode end |
#continentName ⇒ Object (readonly)
Returns the value of attribute continentName.
9 10 11 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 9 def continentName @continentName end |
#countryCapital ⇒ Object (readonly)
Returns the value of attribute countryCapital.
13 14 15 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 13 def countryCapital @countryCapital end |
#countryCode2 ⇒ Object (readonly)
Returns the value of attribute countryCode2.
10 11 12 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 10 def countryCode2 @countryCode2 end |
#countryCode3 ⇒ Object (readonly)
Returns the value of attribute countryCode3.
11 12 13 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 11 def countryCode3 @countryCode3 end |
#countryFlag ⇒ Object (readonly)
Returns the value of attribute countryFlag.
24 25 26 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 24 def countryFlag @countryFlag end |
#countryName ⇒ Object (readonly)
Returns the value of attribute countryName.
12 13 14 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 12 def countryName @countryName end |
#countryTLD ⇒ Object (readonly)
Returns the value of attribute countryTLD.
22 23 24 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 22 def countryTLD @countryTLD end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
29 30 31 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 29 def currency @currency end |
#district ⇒ Object (readonly)
Returns the value of attribute district.
15 16 17 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 15 def district @district end |
#geonameID ⇒ Object (readonly)
Returns the value of attribute geonameID.
28 29 30 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 28 def geonameID @geonameID end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
7 8 9 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 7 def ip @ip end |
#isEU ⇒ Object (readonly)
Returns the value of attribute isEU.
20 21 22 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 20 def isEU @isEU end |
#isp ⇒ Object (readonly)
Returns the value of attribute isp.
25 26 27 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 25 def isp @isp end |
#languages ⇒ Object (readonly)
Returns the value of attribute languages.
23 24 25 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 23 def languages @languages end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
18 19 20 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 18 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
19 20 21 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 19 def longitude @longitude end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
6 7 8 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 6 def @message end |
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
27 28 29 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 27 def organization @organization end |
#stateProvince ⇒ Object (readonly)
Returns the value of attribute stateProvince.
14 15 16 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 14 def stateProvince @stateProvince end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 5 def status @status end |
#timezone ⇒ Object (readonly)
Returns the value of attribute timezone.
30 31 32 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 30 def timezone @timezone end |
#zipCode ⇒ Object (readonly)
Returns the value of attribute zipCode.
17 18 19 |
# File 'lib/ipgeolocation_io/Geolocation.rb', line 17 def zipCode @zipCode end |