A ruby wrapper for Open Weather Map API.
Installation
Latest version 0.12.0
Add the following to your Gemfile
gem 'open-weather'
or
$ gem install open-weather
Usage
Current weather information API
require 'open_weather'
OpenWeather::Current.city("Cochin, IN")
OpenWeather::Current.city_id("1273874")
OpenWeather::Current.geocode(9.94, 76.26)
OpenWeather::Current.cities([524901, 703448, 2643743])
OpenWeather::Current.rectangle_zone(12, 32, 15, 37, 10)
OpenWeather::Current.circle_zone(55.5, 37.5, 10)
OpenWeather::Current.city("Cochin, IN", units: 'metric')
Documentation about the current weather end-point:
http://openweathermap.org/current
Weather forecast API
require 'open_weather'
OpenWeather::Forecast.city("Cochin, IN")
OpenWeather::Forecast.city("Cochin, IN", units: 'imperial')
OpenWeather::Forecast.city_id("1273874")
OpenWeather::Forecast.geocode(9.94, 76.26)
OpenWeather::ForecastDaily.city("Cochin, IN")
OpenWeather::ForecastDaily.city("Cochin, IN", units: 'imperial')
OpenWeather::ForecastDaily.city_id("1273874")
OpenWeather::ForecastDaily.geocode(9.94, 76.26)
OpenWeather::ForecastDaily.city_id("1273874", cnt: 6)
Doucumentation about the weather forecast end-point:
http://openweathermap.org/forecast
Using the API key
options = { units: "metric", APPID: 1111111111 }
OpenWeather::Current.city("Berlin, DE", options)
How to get an API key and tips for an effective usage of the API:
http://openweathermap.org/appid
Multilingual support
OpenWeather::Current.city("Berlin, DE", lang: "de")
Available languages are listed at:
http://openweathermap.org/current#multi
Contributing
Fork it
Create your feature branch (git checkout -b my-new-feature)
Commit your changes (git commit -am 'Added some feature')
Push to the branch (git push origin my-new-feature)
Create new Pull Request
This gem was created during the Hacker Saturdays hosted by Kerala/Kochi Ruby Users Group