Class: EarthTools::Lookup::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/earth_tools/lookup/base.rb

Direct Known Subclasses

Height, SunriseSunset, TimeZone

Instance Method Summary collapse

Instance Method Details

#search(*options) ⇒ EarthTools::Result?

Query the Earth Tools service and return a EarthTools::Result object.

Returns:



16
17
18
19
20
21
22
23
24
25
# File 'lib/earth_tools/lookup/base.rb', line 16

def search(*options)
  begin
    Timeout::timeout(EarthTools::Configuration.timeout) do
      raw_results = retrieve(query(options))
      parse_results(raw_results, :xml)
    end
  rescue Timeout::Error => err
    raise_error(err) or warn "Earth Tools API took too long to respond. See EarthTools::Configuration to set the timeout time (currently set to #{EarthTools::Configuration.timeout} seconds)."
  end
end