Class: Freegeoip::Response
- Inherits:
-
Object
- Object
- Freegeoip::Response
- Defined in:
- lib/freegeoip/response.rb
Overview
Class to contain main api response parsing
Instance Attribute Summary collapse
-
#city ⇒ Object
readonly
Returns the value of attribute city.
-
#country_code ⇒ Object
readonly
Returns the value of attribute country_code.
-
#country_name ⇒ Object
readonly
Returns the value of attribute country_name.
-
#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_code ⇒ Object
readonly
Returns the value of attribute region_code.
-
#region_name ⇒ Object
readonly
Returns the value of attribute region_name.
-
#remote ⇒ Object
readonly
Returns the value of attribute remote.
-
#time_zone ⇒ Object
readonly
Returns the value of attribute time_zone.
-
#zip_code ⇒ Object
readonly
Returns the value of attribute zip_code.
Instance Method Summary collapse
-
#initialize(remote, data) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(remote, data) ⇒ Response
Returns a new instance of Response.
10 11 12 13 14 15 |
# File 'lib/freegeoip/response.rb', line 10 def initialize(remote, data) @remote = remote data.each do |key, value| instance_variable_set "@#{key}", value end end |
Instance Attribute Details
#city ⇒ Object (readonly)
Returns the value of attribute city.
6 7 8 |
# File 'lib/freegeoip/response.rb', line 6 def city @city end |
#country_code ⇒ Object (readonly)
Returns the value of attribute country_code.
6 7 8 |
# File 'lib/freegeoip/response.rb', line 6 def country_code @country_code end |
#country_name ⇒ Object (readonly)
Returns the value of attribute country_name.
6 7 8 |
# File 'lib/freegeoip/response.rb', line 6 def country_name @country_name end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
6 7 8 |
# File 'lib/freegeoip/response.rb', line 6 def ip @ip end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
6 7 8 |
# File 'lib/freegeoip/response.rb', line 6 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
6 7 8 |
# File 'lib/freegeoip/response.rb', line 6 def longitude @longitude end |
#metro_code ⇒ Object (readonly)
Returns the value of attribute metro_code.
6 7 8 |
# File 'lib/freegeoip/response.rb', line 6 def metro_code @metro_code end |
#region_code ⇒ Object (readonly)
Returns the value of attribute region_code.
6 7 8 |
# File 'lib/freegeoip/response.rb', line 6 def region_code @region_code end |
#region_name ⇒ Object (readonly)
Returns the value of attribute region_name.
6 7 8 |
# File 'lib/freegeoip/response.rb', line 6 def region_name @region_name end |
#remote ⇒ Object (readonly)
Returns the value of attribute remote.
6 7 8 |
# File 'lib/freegeoip/response.rb', line 6 def remote @remote end |
#time_zone ⇒ Object (readonly)
Returns the value of attribute time_zone.
6 7 8 |
# File 'lib/freegeoip/response.rb', line 6 def time_zone @time_zone end |
#zip_code ⇒ Object (readonly)
Returns the value of attribute zip_code.
6 7 8 |
# File 'lib/freegeoip/response.rb', line 6 def zip_code @zip_code end |