open_meteo
Open-Meteo
An API wrapper for Open-Meteo.
NOTE: Currently this wrapper is designed only for non-commercial users of the API. It isn't yet setup to use API Keys and the endpoints for commercial subscribers.
Installation
-
Add the dependency to your
shard.yml
:dependencies: open_meteo: gitlab: HCLarsen/open_meteo
-
Run
shards install
Usage
The nost basic use of this shard is to request the current weather conditions based on a latitude and longitude, and desired variable. The full list of variables offered by Open Meteo can be found here.
require "open_meteo"
lat = 52.52
long = 13.41
variables = OpenMeteo::Forecast::Variables.new(current: ["temperature_2m", "weather_code"])
forecast = OpenMeteo.forecast(lat, long, variables)
Variables
The Variables
object encases all the requested variables for the request. You can include variables for a current forecast, hourly forecast, daily forecast, or even a combination. Basically, any combination of variables allowed on the Open-Meteo demo page, you can put into a Variables
object.
variables = OpenMeteo::Forecast::Variables.new(daily: ["weather_code"], current: ["temperature_2m", "weather_code"])
Development
To Do
- Error handling
- Air Quality
- Geocoding
- Commercial Users
Contributing
All features must be properly tested, using minitest.cr. Methods and their params should always have an indicated type.
- Fork it (https://gitlab.com/HCLarsen/open_meteo/-/forks/new)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Chris Larsen - creator and maintainer
open_meteo
- 0
- 0
- 0
- 0
- 2
- 4 months ago
- April 23, 2024
MIT License
Sun, 17 Nov 2024 20:51:19 GMT