Regentanz (German: rain dance) is a Ruby library to connect to Google's innofficial (ie. undocumented and unsupported) weather API.
Discontinued Weather API
Notice: Google has discontinued their weather service. The Gem is currently not able to return weather data.
The gem is available from rubygems, so using bundler “installation” would be:
# Gemfile gem 'regentanz'
Supply a location and a language to retrieve weather:
weather = Regentanz::GoogleWeather.new(:location => "Berlin, Germany", :lang => :en) weather.current # current condition weather.forecast # array with forecast conditions
It uses file-based caching by default, other cache backends will follow. See Regentanz::Cache::Base for details (and if you want to create your own backend).
TODO wainting for callbacks
Regentanz can either be configured through a configure block or directly via its configuration object. It uses sane defaults so there should be no need for configuration to start right off. If you're using Regentanz with Rails, a file in config/initializers is your friend.
Regentanz.configure do |config| config.cache_backend Regentanz::Cache::File config.cache_dir "/path/to/cache_file" end
Regentanz.configuration.cache_dir = "/some/other/path"
See Regentanz::Configuration for a full list of configurable options.
Implement OpenWeatherMap as new backend
Finalise callback hooks
Make tests pass on Ruby 1.9