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

  1. Add the dependency to your shard.yml:

    dependencies:
      open_meteo:
        gitlab: HCLarsen/open_meteo
    
  2. 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.

  1. Fork it (https://gitlab.com/HCLarsen/open_meteo/-/forks/new)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Repository

open_meteo

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 2
  • 4 months ago
  • April 23, 2024
License

MIT License

Links
Synced at

Sun, 17 Nov 2024 20:51:19 GMT

Languages