Add support for the Geocoding API - #54
Merged
Merged
Conversation
Danger ReportNo issues found. |
dblock
force-pushed
the
add-geocoding-api
branch
from
August 27, 2026 23:23
39661d7 to
5b0d040
Compare
Closes #47. * Adds `geo_direct`, `geo_reverse` and `geo_zip` client methods wrapping OpenWeather's Geocoding API (https://openweathermap.org/api/geocoding-api), the currently supported way to convert city names/zip codes to coordinates and back, replacing the deprecated built-in geocoding in the Current Weather API. * Adds `OpenWeather::Models::GeoLocation` and `OpenWeather::Models::GeoLocationZip`. * Adds a `geo_endpoint` config attribute, defaulting to `https://api.openweathermap.org/geo`. * Adds README documentation and a CHANGELOG entry. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dblock
force-pushed
the
add-geocoding-api
branch
from
August 27, 2026 23:25
5b0d040 to
f432341
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds support for OpenWeather's Geocoding API, the currently supported method for converting city names/zip codes to geo-coordinates and back (replacing the deprecated built-in geocoding baked into the Current Weather API).
client.geo_direct(name, state, country, options)— direct geocoding, city/state/country name to coordinates (GET geo/1.0/direct).client.geo_reverse(lat, lon, options)— reverse geocoding, coordinates to location name (GET geo/1.0/reverse).client.geo_zip(zip, country, options)— zip/post code to coordinates (GET geo/1.0/zip).OpenWeather::Models::GeoLocation(used bygeo_direct/geo_reverse, an array result) andOpenWeather::Models::GeoLocationZip(used bygeo_zip, a single result), matching the differing response shapes documented by OpenWeather.geo_endpointconfig attribute (defaults tohttps://api.openweathermap.org/geo), since the Geocoding API is hosted at a different base path than/data.Why
Closes #47. Current Weather's built-in city name/zip code lookup no longer receives bug fixes and OpenWeather recommends the Geocoding API instead.
Testing
Added specs with VCR cassettes recorded against the live Geocoding API. Full suite: 122 examples, 0 failures, 100% line coverage.