Class: EarthTools::Result::Base
- Inherits:
-
Object
- Object
- EarthTools::Result::Base
- Defined in:
- lib/earth_tools/result/base.rb
Overview
The base result object.
Contains shared domain fields. Extended by different results.
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 ⇒ Float
Get the latitude See http://en.wikipedia.org/wiki/Latitude.
-
#location ⇒ Array
Get the geographical location.
-
#longitude ⇒ Object
Get the longitude See http://en.wikipedia.org/wiki/Longitude.
-
#version ⇒ Float
The version of the response format.
Constructor Details
#initialize(data) ⇒ Base
Takes a hash of result data from a parsed Google result document.
15 16 17 |
# File 'lib/earth_tools/result/base.rb', line 15 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
10 11 12 |
# File 'lib/earth_tools/result/base.rb', line 10 def data @data end |
Instance Method Details
#latitude ⇒ Float
Get the latitude See http://en.wikipedia.org/wiki/Latitude.
30 31 32 |
# File 'lib/earth_tools/result/base.rb', line 30 def latitude @data['location']['latitude'].to_f end |
#location ⇒ Array
Get the geographical location
22 23 24 |
# File 'lib/earth_tools/result/base.rb', line 22 def location [latitude, longitude] end |
#longitude ⇒ Object
Get the longitude See http://en.wikipedia.org/wiki/Longitude.
38 39 40 |
# File 'lib/earth_tools/result/base.rb', line 38 def longitude @data['location']['longitude'].to_f end |
#version ⇒ Float
The version of the response format
45 46 47 |
# File 'lib/earth_tools/result/base.rb', line 45 def version @data['version'].to_f end |