{"id":15293318,"url":"https://github.com/open-meteo-ruby/open-meteo-ruby","last_synced_at":"2025-04-13T13:31:06.112Z","repository":{"id":205251571,"uuid":"713785077","full_name":"open-meteo-ruby/open-meteo-ruby","owner":"open-meteo-ruby","description":"Ruby client for OpenMeteo","archived":false,"fork":false,"pushed_at":"2024-10-24T15:29:48.000Z","size":1234,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-25T02:26:05.832Z","etag":null,"topics":["open-meteo","ruby"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/open-meteo","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/open-meteo-ruby.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-03T08:26:39.000Z","updated_at":"2024-10-24T15:29:50.000Z","dependencies_parsed_at":"2024-10-24T12:44:20.194Z","dependency_job_id":"8f701636-4f4b-4334-93ce-2b1b40977653","html_url":"https://github.com/open-meteo-ruby/open-meteo-ruby","commit_stats":null,"previous_names":["open-meteo-ruby/open-meteo-ruby"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-meteo-ruby%2Fopen-meteo-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-meteo-ruby%2Fopen-meteo-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-meteo-ruby%2Fopen-meteo-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/open-meteo-ruby%2Fopen-meteo-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/open-meteo-ruby","download_url":"https://codeload.github.com/open-meteo-ruby/open-meteo-ruby/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248720995,"owners_count":21151024,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["open-meteo","ruby"],"created_at":"2024-09-30T16:46:11.362Z","updated_at":"2025-04-13T13:31:02.863Z","avatar_url":"https://github.com/open-meteo-ruby.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  Ruby client for \u003ca href=\"https://github.com/open-meteo/open-meteo\"\u003eOpenMeteo\u003c/a\u003e\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/open-meteo-ruby/open-meteo-ruby/actions?query=branch%3Amain+\"\u003e\n    \u003cimg alt=\"CI\" src=\"https://github.com/open-meteo-ruby/open-meteo-ruby/actions/workflows/ci.yml/badge.svg\" \\\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/open-meteo-ruby/open-meteo-ruby\"\u003e\n    \u003cimg alt=\"CodeCov\" src=\"https://codecov.io/gh/open-meteo-ruby/open-meteo-ruby/branch/main/graph/badge.svg?token=V5HKH4C2BA\" \\\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://rubygems.org/gems/open-meteo\"\u003e\n    \u003cimg src=\"https://badge.fury.io/rb/open-meteo.svg\" alt=\"Gem Version\" height=\"18\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  This client library lets you easily connect to the \u003ca href=\"https://open-meteo.com/\"\u003eOpenMeteo API\u003c/a\u003e.\n\u003c/p\u003e\n\n\u003e NOTE: [There is a plan to create official SDKs](https://github.com/open-meteo/open-meteo-website/issues/40) via [FlatBuffers](https://flatbuffers.dev/). However, I couldn't find a Ruby implementation of FlatBuffers in general. Hence, most likely, there won't be a Ruby SDK in the near future.\n\n## Usage\n\n```ruby\nrequire \"open_meteo\"\n\nlocation = OpenMeteo::Entities::Location.new(latitude: 52.52.to_d, longitude: 13.41.to_d)\nvariables = { current: %i[], hourly: %i[weather_code], daily: %i[] }\ndata = OpenMeteo::Forecast.new.get(location:, variables:)\n\ndata.hourly.items.each { |item| puts item.weather_code_symbol }\n```\n\n### Forecast models\n\n#### Forecast models in general request\n\nThe general forecast endpoint allows for models to be specified which adds suffixes to the response variables if multiple models are selected. You can make use of this by adding models to the forecast variables:\n\n```ruby\nvariables = {\n  current: %i[],\n  hourly: %i[weather_code],\n  daily: %i[],\n  models: %i[best_match ecmwf_ifs04],\n}\n```\n\nOther variables that can be set:\n\n| Variable   | Example value   |\n| ---------- | --------------- |\n| `timezone` | `Europe/Berlin` |\n\n#### Forecast models in separate requests\n\nThere are separate requests for certain weather models. You can make use of those by providing the model symbol to `Forecast#get`:\n\n```ruby\ndata = OpenMeteo::Forecast.new.get(location:, variables:, model: :dwd_icon)\n```\n\nDefault is `:general`.\n\nAvailable models:\n\n- `:general`: [OpenMeteo Weather Forecast](https://open-meteo.com/en/docs)\n- `:dwd_icon`: [DWD ICON](https://open-meteo.com/en/docs/dwd-api)\n\n## Configuration\n\n### Global configuration\n\nThere is the possibility to configure `OpenMeteo` globally e.g. in an initializer:\n\n```ruby\n# config/initializer/open_meteo.rb\nrequire \"open-meteo\"\n\nOpenMeteo.configure do |config|\n  config.host = \"api.my-own-open-meteo.com\"\n  config.logger = Rails.logger\n  config.api_key = \"your_open_meteo_api_key\"\nend\n```\n\n```ruby\n# some/other/file.rb\nforecast = OpenMeteo::Forecast.new\n\nlocation = OpenMeteo::Entities::Location.new(latitude: 52.52, longitude: 13.41)\nvariables = { current: %i[weather_code], hourly: %i[], daily: %i[] }\nforecast_response = forecast.get(location:, variables:)\n```\n\n| Config key | Default value                            | Remarks                                                                                                                     |\n| ---------- | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |\n| `host`     | `\"api.open-meteo.com\"`                   |                                                                                                                             |\n| `api_key`  | `ENV.fetch(\"OPEN_METEO_API_KEY\", nil)` } | Use the host `customer-api.open-meteo.com` for the commercial version of OpenMeteo.                                         |\n| `logger`   | `Logger.new($stdout)`                    |                                                                                                                             |\n| `timeouts` | `{ timeout: 5, open_timeout: 5}`         | Uses [Faraday configuration options](https://github.com/lostisland/faraday/blob/main/docs/customization/request-options.md) |\n\n### Configuration of a client instance\n\nYou can also create a client that takes a configuration that overwrites the global configuration.\n\nThe configuration sent to the client initializer will be shared with the dependent classes:\n\n```ruby\n# some/other/file.rb\nrequire \"open-meteo\"\n\nconfig =\n  OpenMeteo::Client::Config.new(logger: Logger.new($stdout), host: \"api.my-own-open-meteo.com\")\nclient = OpenMeteo::Client.new(config:)\nforecast = OpenMeteo::Forecast.new(client:)\n\nlocation = OpenMeteo::Entities::Location.new(latitude: 52.52, longitude: 13.41)\nvariables = { current: %i[weather_code], hourly: %i[], daily: %i[] }\nforecast_response = forecast.get(location:, variables:)\n```\n\n## Development\n\nUseful commands are defined in the [`Justfile`](Justfile) and can be listed with [`just`](https://github.com/casey/just).\n\nE.g. execute an [example](example.rb) request: `just example`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-meteo-ruby%2Fopen-meteo-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopen-meteo-ruby%2Fopen-meteo-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-meteo-ruby%2Fopen-meteo-ruby/lists"}