Copyright © 2015-2016, Markus These
Client libraries for communicating with openopenweathermapmap.org.
This project is a simple API client for interacting with the openweathermap.org.
This projects currently only provides functionality to get the OpenWeatherMapdate by a given city.
Install openweathermap by sudo gem install openweathermap Include this gem in your code as a require statement.
require 'openweathermap'
The following example use the API from openweathermap.org to return a JSON with the current weatherdata for a given City.
#input: city, country
#return: openweathermapinformations as JSON
@openweathermap_hamburg = OpenWeatherMap.city('hamburg','de')
puts @openweathermap_hamburg
Example:
{"coord"=>{"lon"=>10, "lat"=>53.55}, "openweathermap"=>[{"id"=>701, "main"=>"Mist", "description"=>"mist", "icon"=>"50d"}], "base"=>"cmc stations", "main"=>{"temp"=>267.7, "pressure"=>1027, "humidity"=>100, "temp_min"=>267.15, "temp_max"=>268.15}, "wind"=>{"speed"=>1}, "clouds"=>{"all"=>90}, "dt"=>1453366159, "sys"=>{"type"=>1, "id"=>4883, "message"=>0.0032, "country"=>"DE", "sunrise"=>1453360917, "sunset"=>1453390865}, "id"=>2911298, "name"=>"Hamburg", "cod"=>200}