RbWunderground
A simple wrapper for the Weather Underground API that returns a Hashie::Mash for convenience.
TODO: Write more tests
Installation
Add this line to your application's Gemfile:
gem 'rb_wunderground'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rb_wunderground
Usage
To get started, create a new instance of RbWunderground::Base with your Weather Underground API key.
w = RbWundergound::Base.new('API_KEY')
The following is available through the Weather Underground's JSON API:
alerts
almanac
astronomy
conditions
currenthurricaine
forecast
forecast10day
geolookup
history_YYYMMDD
hourly
hourly10day
planner_MMDDMMDD
rawtide
tide
webcams
yesterday
These queries are available as methods with a location passed to each in a format accepted by Weather Underground and return a Hashie::Mash of the JSON results.
w = RbWundergound::Base.new('API_KEY')
forecast = w.forecast('12207')
forecast = w.forecast('NY/Albany')
forecast = w.forecast('England/London')
forecast = w.forecast('KALB')
history = w.history('12207')
rb_wunderground also supports multiple queries in a single method call - just string together multiple features with 'and'. For example:
w = RbWundergound::Base.new('API_KEY')
forecast = w.forecast_and_hourly('12186')
forecast = w.hourly_and_yesterday_and_conditions("NY/Albany")
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request