Class: EasyGeoIP::GeoData
- Inherits:
-
Object
- Object
- EasyGeoIP::GeoData
- Defined in:
- lib/easy_geoip/geo_data.rb
Instance Attribute Summary collapse
-
#city ⇒ Object
readonly
Returns the value of attribute city.
-
#continent_code ⇒ Object
readonly
Returns the value of attribute continent_code.
-
#country ⇒ Object
readonly
Returns the value of attribute country.
-
#country_code ⇒ Object
readonly
Returns the value of attribute country_code.
-
#ip ⇒ Object
readonly
Returns the value of attribute ip.
-
#isp ⇒ Object
readonly
Returns the value of attribute isp.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#postal_code ⇒ Object
readonly
Returns the value of attribute postal_code.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#region_code ⇒ Object
readonly
Returns the value of attribute region_code.
-
#time_zone ⇒ Object
readonly
Returns the value of attribute time_zone.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ GeoData
constructor
A new instance of GeoData.
- #to_hash ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ GeoData
Returns a new instance of GeoData.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/easy_geoip/geo_data.rb', line 7 def initialize(attributes = {}) @ip = attributes[:ip] @country = attributes[:country] @country_code = attributes[:country_code] @city = attributes[:city] @region = attributes[:region] @region_code = attributes[:region_code] @postal_code = attributes[:postal_code] @continent_code = attributes[:continent_code] @latitude = attributes[:latitude] @longitude = attributes[:longitude] @time_zone = attributes[:time_zone] @isp = attributes[:isp] end |
Instance Attribute Details
#city ⇒ Object (readonly)
Returns the value of attribute city.
3 4 5 |
# File 'lib/easy_geoip/geo_data.rb', line 3 def city @city end |
#continent_code ⇒ Object (readonly)
Returns the value of attribute continent_code.
3 4 5 |
# File 'lib/easy_geoip/geo_data.rb', line 3 def continent_code @continent_code end |
#country ⇒ Object (readonly)
Returns the value of attribute country.
3 4 5 |
# File 'lib/easy_geoip/geo_data.rb', line 3 def country @country end |
#country_code ⇒ Object (readonly)
Returns the value of attribute country_code.
3 4 5 |
# File 'lib/easy_geoip/geo_data.rb', line 3 def country_code @country_code end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
3 4 5 |
# File 'lib/easy_geoip/geo_data.rb', line 3 def ip @ip end |
#isp ⇒ Object (readonly)
Returns the value of attribute isp.
3 4 5 |
# File 'lib/easy_geoip/geo_data.rb', line 3 def isp @isp end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
3 4 5 |
# File 'lib/easy_geoip/geo_data.rb', line 3 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
3 4 5 |
# File 'lib/easy_geoip/geo_data.rb', line 3 def longitude @longitude end |
#postal_code ⇒ Object (readonly)
Returns the value of attribute postal_code.
3 4 5 |
# File 'lib/easy_geoip/geo_data.rb', line 3 def postal_code @postal_code end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
3 4 5 |
# File 'lib/easy_geoip/geo_data.rb', line 3 def region @region end |
#region_code ⇒ Object (readonly)
Returns the value of attribute region_code.
3 4 5 |
# File 'lib/easy_geoip/geo_data.rb', line 3 def region_code @region_code end |
#time_zone ⇒ Object (readonly)
Returns the value of attribute time_zone.
3 4 5 |
# File 'lib/easy_geoip/geo_data.rb', line 3 def time_zone @time_zone end |
Instance Method Details
#to_hash ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/easy_geoip/geo_data.rb', line 22 def to_hash { ip: ip, country: country, country_code: country_code, city: city, region: region, region_code: region_code, postal_code: postal_code, continent_code: continent_code, latitude: latitude, longitude: longitude, time_zone: time_zone, isp: isp } end |