Class: EarthTools::Result::Base
- Inherits:
-
Object
- Object
- EarthTools::Result::Base
- Defined in:
- lib/earth_tools/result/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(data) ⇒ Base
constructor
Takes a hash of result data from a parsed Google result document.
-
#latitude ⇒ Object
Get the latitude See http://en.wikipedia.org/wiki/Latitude.
-
#location ⇒ Object
Get the geographical location.
-
#longitude ⇒ Object
Get the longitude See http://en.wikipedia.org/wiki/Longitude.
-
#version ⇒ Object
The version of the response format.
Constructor Details
#initialize(data) ⇒ Base
Takes a hash of result data from a parsed Google result document.
13 14 15 |
# File 'lib/earth_tools/result/base.rb', line 13 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
8 9 10 |
# File 'lib/earth_tools/result/base.rb', line 8 def data @data end |
Instance Method Details
#latitude ⇒ Object
Get the latitude See http://en.wikipedia.org/wiki/Latitude.
28 29 30 |
# File 'lib/earth_tools/result/base.rb', line 28 def latitude @data['latitude'].to_f end |
#location ⇒ Object
Get the geographical location
20 21 22 |
# File 'lib/earth_tools/result/base.rb', line 20 def location [latitude, longitude] end |
#longitude ⇒ Object
Get the longitude See http://en.wikipedia.org/wiki/Longitude.
36 37 38 |
# File 'lib/earth_tools/result/base.rb', line 36 def longitude @data['longitude'].to_f end |
#version ⇒ Object
The version of the response format
43 44 45 |
# File 'lib/earth_tools/result/base.rb', line 43 def version @data['version'].to_f end |