class OWM::Client

Overview

A client for interfacing with the Open Weather Map API.

Defined in:

owm/client.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(key : String, units = "standard") #

[View source]

Instance Method Detail

def current_weather_for_cities(params : Hash(String, _)) : Array(CurrentWeather) #

Requests current weather information for multiple cities by passing in required parameters as a hash. The Hash must have one of the following sets of keys: lat, lon, cnt : Query for cnt number of cities nearest to the lat and lon coordinates provided. bbox : Query for all cities within a rectangle of coordinates provided. id : Query by a list of city IDs.


[View source]
def current_weather_for_city(params : Hash(String, _)) : CurrentWeather #

Requests current weather information for a single city by passing in required parameters as a hash. The Hash must have one of the following sets of keys: q : Querying by the city name. id : Querying by the city ID. lat & lon : Querying by latitudinal and longitudinal values. zip : For American addresses, querying by the zip code.


[View source]
def five_day_forecast_for_city(params : Hash(String, _)) : FiveDayForecast #

Requests 5 day/3 hour weather forecast for a single city by passing in required parameters as a hash. The Hash must have one of the following sets of keys: q : Querying by the city name. id : Querying by the city ID. lat & lon : Querying by latitudinal and longitudinal values. zip : For American addresses, querying by the zip code.


[View source]
def one_call(params : Hash(String, _)) : OneCall #

Requests data from OpenWeatherMap's (OneCall API)[https://openweathermap.org/api/one-call-api] with latitude and longitude for location.


[View source]
def sunrise_sunset_for_city(params : Hash(String, _)) : Array(Time) #

Requests sunrise and sunset times for a single city by passing in required parameters as a hash. The Hash must have one of the following sets of keys: q : Querying by the city name. id : Querying by the city ID. lat & lon : Querying by latitudinal and longitudinal values. zip : For American addresses, querying by the zip code.


[View source]