May 10, 2009

weather_report - a Ruby gem for retrieving weather forecasts

Tags: , , ,

Update: The weather_report project and the weather archive is no more. The effort required to maintain it was too great, for more information see here.

Today I have released my first Ruby gem: weather_report, version 0.0.1. It connects to the BBC Backstage weather API and gets weather observations or forecasts for thousands of cities worldwide. Don’t be fooled by the low version number, it is usable. However, it can only handle the BBC weather feed, requires pre-knowledge of BBC weather location ids and is metric only (all things I plan to fix).

With weather_report, you can do things like:

require 'weather_report'
# 8 is the BBC Backstage weather code for London, UK
londonWeather = WeatherReport.new(8)

# to get the current temperature
londonWeather.observation.temperature 

# to get the tomorrow's max temperature
londonWeather.forecast.for_tomorrow.max_temperature

# and much more!

It can be obtained through rubyforge:

sudo gem install weather_report

There is also a website with documentation here.

I would like to say thanks to the authors of newgem and this rubyforge tutorial, both of which greatly aided in weather_report’s creation.


comments powered by Disqus