Class: FreeGeoIP::Response
- Inherits:
-
Object
- Object
- FreeGeoIP::Response
- Defined in:
- lib/freegeoip/response.rb
Instance Attribute Summary collapse
-
#city ⇒ Object
readonly
Returns the value of attribute city.
-
#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.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#metro_code ⇒ Object
readonly
Returns the value of attribute metro_code.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#region_code ⇒ Object
readonly
Returns the value of attribute region_code.
-
#zip_code ⇒ Object
readonly
Returns the value of attribute zip_code.
Instance Method Summary collapse
-
#initialize(response_body) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(response_body) ⇒ Response
Returns a new instance of Response.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/freegeoip/response.rb', line 5 def initialize(response_body) @city = response_body['city'] @region = response_body['region_name'] @region_code = response_body['region_code'] @longitude = response_body['longitude'] @latitude = response_body['latitude'] @country = response_body['country_name'] @country_code = response_body['country_code'] @ip = response_body['ip'] @zip_code = response_body['zipcode'] @metro_code = response_body['metrocode'] end |
Instance Attribute Details
#city ⇒ Object (readonly)
Returns the value of attribute city.
3 4 5 |
# File 'lib/freegeoip/response.rb', line 3 def city @city end |
#country ⇒ Object (readonly)
Returns the value of attribute country.
3 4 5 |
# File 'lib/freegeoip/response.rb', line 3 def country @country end |
#country_code ⇒ Object (readonly)
Returns the value of attribute country_code.
3 4 5 |
# File 'lib/freegeoip/response.rb', line 3 def country_code @country_code end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
3 4 5 |
# File 'lib/freegeoip/response.rb', line 3 def ip @ip end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
3 4 5 |
# File 'lib/freegeoip/response.rb', line 3 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
3 4 5 |
# File 'lib/freegeoip/response.rb', line 3 def longitude @longitude end |
#metro_code ⇒ Object (readonly)
Returns the value of attribute metro_code.
3 4 5 |
# File 'lib/freegeoip/response.rb', line 3 def metro_code @metro_code end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
3 4 5 |
# File 'lib/freegeoip/response.rb', line 3 def region @region end |
#region_code ⇒ Object (readonly)
Returns the value of attribute region_code.
3 4 5 |
# File 'lib/freegeoip/response.rb', line 3 def region_code @region_code end |
#zip_code ⇒ Object (readonly)
Returns the value of attribute zip_code.
3 4 5 |
# File 'lib/freegeoip/response.rb', line 3 def zip_code @zip_code end |