Kindly create an issue and tag me if you wish to become a maintainer.
Latest version 0.12.0
Add the following to your Gemfile
gem 'open-weather'
or
$ gem install open-weather
How to get an API key and tips for an effective usage of the API: http://openweathermap.org/appid
# get current weather by city nameoptions={units: "metric",APPID: "1111111111"}OpenWeather::Current.city("Berlin, DE",options)require'open_weather'# get current weather by city nameOpenWeather::Current.city("Cochin, IN",options)# get current weather by city idOpenWeather::Current.city_id("1273874",options)# get current weather by geocode. (lat, lon)OpenWeather::Current.geocode(9.94,76.26,options)# get current weather for a list of city idsOpenWeather::Current.cities([524901,703448,2643743],options)# get current weather for a bounding boxOpenWeather::Current.rectangle_zone(12,32,15,37,10,options)# get current weather for cities around a pointOpenWeather::Current.circle_zone(55.5,37.5,10,options)# By default temperature is returned in fahrenheit to get the current weather in degrees celsius use unit as follows.options={units: "metric",APPID: "1111111111"}OpenWeather::Current.city("Cochin, IN",options)Documentation about the current weather end-point: http://openweathermap.org/current
require'open_weather'# get weather forecast by city nameOpenWeather::Forecast.city("Cochin, IN",options)# get weather forecast by city name in fahrenheitOpenWeather::Forecast.city("Cochin, IN",options)# get weather forecast by city idOpenWeather::Forecast.city_id("1273874",options)# get weather forecast by geocode. (lat, lon)OpenWeather::Forecast.geocode(9.94,76.26,options)# get daily weather forecast by city nameOpenWeather::ForecastDaily.city("Cochin, IN",options)# get daily weather forecast by city name in fahrenheitOpenWeather::ForecastDaily.city("Cochin, IN",options)# get daily weather forecast by city idOpenWeather::ForecastDaily.city_id("1273874",options)# get daily weather forecast by geocode. (lat, lon)OpenWeather::ForecastDaily.geocode(9.94,76.26,options)# get daily weather forecast for 6 daysoptions[:cnt]=6OpenWeather::ForecastDaily.city_id("1273874",options)require'open_weather'# get weather history by city nameOpenWeather::History.city("Cochin, IN",options)# get weather history by city idOpenWeather::History.city_id("1273874",options)# get weather history by geocode. (lat, lon)OpenWeather::History.geocode(9.94,76.26,options)Doucumentation about the weather forecast end-point: http://openweathermap.org/forecast
# get current weather in germanoptions[:lang]="de"OpenWeather::Current.city("Berlin, DE",options)Available languages are listed at: http://openweathermap.org/current#multi
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