Module: EarthTools

Extended by:
EarthTools
Included in:
EarthTools
Defined in:
lib/earth_tools.rb,
lib/earth_tools/version.rb,
lib/earth_tools/exceptions.rb,
lib/earth_tools/lookup/base.rb,
lib/earth_tools/result/base.rb,
lib/earth_tools/configuration.rb

Defined Under Namespace

Modules: Lookup, Result Classes: Configuration, ConfigurationError, Error, InvalidInputError, OverQueryLimitError, UnsupportedOperationError

Constant Summary collapse

VERSION =

The gem version

"0.0.1"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configure(&block) ⇒ Object

This method can be used to change some functional aspects, like, the geocoding service provider, or the units of calculations. Please see



7
8
9
10
11
12
13
# File 'lib/earth_tools/configuration.rb', line 7

def self.configure(&block)
  if block_given?
    block.call(Configuration.instance)
  else
    Configuration.instance
  end
end

Instance Method Details

#height(latitude, longitude) ⇒ Object

Retrieve the land height for a given latitude and longitude



31
32
33
# File 'lib/earth_tools.rb', line 31

def height(latitude, longitude)
  get_lookup(:height).search(latitude, longitude)
end

#sunrise_sunset(latitude, longitude, month, day, timezone = 99, dst = false) ⇒ Object

Retrieve the sunrise & sunset values



22
23
24
# File 'lib/earth_tools.rb', line 22

def sunrise_sunset(latitude, longitude, month, day, timezone = 99, dst = false)
  get_lookup(:sunrise_sunset).search(latitude, longitude, day, month, timezone, dst ? 1 : 0)
end

#time_zone(latitude, longitude) ⇒ Object

Retrieve for time zone based on latitude and longitude.



13
14
15
# File 'lib/earth_tools.rb', line 13

def time_zone(latitude, longitude)
  get_lookup(:time_zone).search(latitude, longitude) if valid_input?(latitude, longitude)
end