A Ruby library to access the Google Weather API
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
test
.gitignore
.ruby-gemset
.ruby-version
CHANGELOG.rdoc
Gemfile
LICENSE
README.rdoc
Rakefile
regentanz.gemspec

README.rdoc

Regentanz

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.

Installation

The gem is available from rubygems, so using bundler “installation” would be:

# Gemfile
gem 'regentanz'

Usage

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).

Handling API-Errors

TODO wainting for callbacks

Configuration

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.

Configure block:

Regentanz.configure do |config|
  config.cache_backend Regentanz::Cache::File 
  config.cache_dir "/path/to/cache_file"
end

Direct configuration:

Regentanz.configuration.cache_dir = "/some/other/path"

See Regentanz::Configuration for a full list of configurable options.

TODO

  • Implement OpenWeatherMap as new backend

  • Finalise callback hooks

  • Make tests pass on Ruby 1.9

Credits

Regentanz is based upon and extracted from a standalone Ruby class made for berlin.kauperts.de by kaupert media gmbh.