No release in over a year
Get Weather and Forecast for the city you want easily
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 2.7.6
~> 3.10
 Project Readme

OpenWeatherMapAPI - Ruby API Client

Get Weather and Forecast for the city you want easily.

Installation

Add this line to your application's Gemfile:

gem 'open_weather_map_api'

And then execute:

$ bundle install

Usage Examples

Get weather by city

OpenWeatherMapApi.get_weather(q: 'florianopolis', appid: <APPID>)

Get weather by latitude an longitude

OpenWeatherMapApi.get_weather(lat: '51.5085', lon: '-0.1257', appid: <APPID>)

Get forecast by city

OpenWeatherMapApi.get_forecast(q: 'florianopolis', appid: <APPID>)

Get forecast by latitude an longitude

OpenWeatherMapApi.get_forecast(lat: '51.5085', lon: '-0.1257', appid: <APPID>)

Get weather in Celsius

OpenWeatherMapApi.get_weather(q: 'florianopolis', units: 'metric', appid: <APPID>)

Get weather in Fahrenheit

OpenWeatherMapApi.get_weather(q: 'florianopolis', units: 'imperial', appid: <APPID>)

Get weather response in Portuguese

OpenWeatherMapApi.get_weather(q: 'florianopolis', lang: 'pt_br', appid: <APPID>)

Get weather response format in xml

OpenWeatherMapApi.get_weather(q: 'florianopolis', mode: 'xml', appid: <APPID>)

Get weather response format in html

OpenWeatherMapApi.get_weather(q: 'florianopolis', mode: 'html', appid: <APPID>)

Props

Weather

Prop Type Default Note
lat, lon string required Geographical coordinates (latitude, longitude)
appid string required Your unique API key. Learn more
mode json, xml, html json Response format
units standard, metric, imperial standard Units of measurement: standard: Kelvin, metric: Celsius, imperial: Fahrenheit
lang string en You can use this parameter to get the output in your language. Learn more

Forecast

Prop Type Default Note
lat, lon string required Geographical coordinates (latitude, longitude)
appid string required Your unique API key. Learn more
mode json, xml, html json Response format
units standard, metric, imperial standard Units of measurement: standard: Kelvin, metric: Celsius, imperial: Fahrenheit
lang string en You can use this parameter to get the output in your language. Learn more
cnt string optional A number of timestamps, which will be returned in the API response