class EarthTools::Result::Base

The base result object.

Contains shared domain fields. Extended by different results.

Attributes

data[RW]

Public Class Methods

new(data) click to toggle source

Takes a hash of result data from a parsed Google result document. @param [Object] the

# File lib/earth_tools/result/base.rb, line 15
def initialize(data)
  @data = data
end

Public Instance Methods

latitude() click to toggle source

Get the latitude See {en.wikipedia.org/wiki/Latitude}. @return [Float] the latitude

# File lib/earth_tools/result/base.rb, line 30
def latitude
  @data['location']['latitude'].to_f
end
location() click to toggle source

Get the geographical location @return [Array] a two-element array: [latitude, longitude]

# File lib/earth_tools/result/base.rb, line 22
def location
  [latitude, longitude]
end
longitude() click to toggle source

Get the longitude See {en.wikipedia.org/wiki/Longitude}. @return the longitude

# File lib/earth_tools/result/base.rb, line 38
def longitude
  @data['location']['longitude'].to_f
end
version() click to toggle source

The version of the response format @return [Float] the version

# File lib/earth_tools/result/base.rb, line 45
def version
  @data['version'].to_f
end