Skip to content

Commit 53b431e

Browse files
Migrate to Geocodio API v2 (#11)
Breaking changes (targets release 1.0.0): - Base URL version prefix changed from v1.11 to v2 (https://api.geocod.io/v2/). - Removed the top-level `input` object from /geocode and /reverse responses; parsed address now lives in results[].address_components. - Renamed keys inside address_components and address_components_secondary: zip -> postal_code, state -> state_province, secondaryunit -> unit_type, secondarynumber -> unit_number. Updated VCR cassettes to v2 URIs and the v2 response shape, updated spec assertions for the new keys/structure, bumped VERSION to 1.0.0, and added a CHANGELOG entry.
1 parent 6c686b5 commit 53b431e

33 files changed

Lines changed: 788 additions & 871 deletions

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## [1.0.0] - 2026-06-05
2+
- **BREAKING**: Migrated to Geocodio API v2 (base URL changed from `v1.11` to `v2`)
3+
- **BREAKING**: Removed the top-level `input` object from `/geocode` and `/reverse` responses. The parsed address now lives in `results[].address_components`.
4+
- **BREAKING**: Renamed keys inside `address_components` and `address_components_secondary`:
5+
- `zip``postal_code`
6+
- `state``state_province`
7+
- `secondaryunit``unit_type`
8+
- `secondarynumber``unit_number`
9+
110
## [0.7.0] - 2026-03-12
211
- Updated default API version to v1.11
312

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
geocodio-gem (0.7.0)
4+
geocodio-gem (1.0.0)
55

66
GEM
77
remote: https://rubygems.org/

lib/geocodio/gem.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def initialize(api_key)
1515
@api_key = api_key
1616

1717
@conn = Faraday.new(
18-
url: 'https://api.geocod.io/v1.11/',
18+
url: 'https://api.geocod.io/v2/',
1919
headers: {'Content-Type' => 'application/json' }
2020
) do |f|
2121
f.response :follow_redirects

lib/geocodio/gem/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module Geocodio
4-
VERSION = "0.7.0"
4+
VERSION = "1.0.0"
55
end

spec/geocodio/gem_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
it "geocodes a single address", vcr: { record: :new_episodes } do
2323
address_sample = ["1109 N Highland St, Arlington, VA 22201"]
2424

25-
expect(geocodio.geocode(address_sample)["input"]["formatted_address"]).to eq(address_sample.join(""))
25+
expect(geocodio.geocode(address_sample)["results"][0]["address_components"]["postal_code"]).to eq("22201")
2626
expect(geocodio.geocode(address_sample)["results"][0]["formatted_address"]).to eq(address_sample.join(""))
2727
expect(geocodio.geocode(address_sample)["results"][0]["address_components"]["number"]).to eq("1109")
2828
expect(geocodio.geocode(address_sample)["results"][0]["address_components"]["city"]).to eq("Arlington")
@@ -101,9 +101,9 @@
101101
]
102102

103103
expect(geocodio.geocode(batch_addresses)["results"].size).to equal(batch_addresses.size)
104-
expect(geocodio.geocode(batch_addresses)["results"][0]["response"]["input"]["formatted_address"]).to eq("1109 N Highland St, Arlington, VA 22201")
105-
expect(geocodio.geocode(batch_addresses)["results"][1]["response"]["input"]["formatted_address"]).to eq("12187 Darnestown Rd, Gaithersburg, MD 20878")
106-
expect(geocodio.geocode(batch_addresses)["results"][2]["response"]["input"]["formatted_address"]).to eq("4961 Elm St, Bethesda, MD")
104+
expect(geocodio.geocode(batch_addresses)["results"][0]["response"]["results"][0]["formatted_address"]).to eq("1109 N Highland St, Arlington, VA 22201")
105+
expect(geocodio.geocode(batch_addresses)["results"][1]["response"]["results"][0]["formatted_address"]).to eq("12187 Darnestown Rd, Gaithersburg, MD 20878")
106+
expect(geocodio.geocode(batch_addresses)["results"][2]["response"]["results"][0]["formatted_address"]).to eq("4961 Elm St, Bethesda, MD 20814")
107107
end
108108

109109
it "reverse geocodes batch coordinates", vcr: { record: :new_episodes } do

spec/vcr_cassettes/Geocodio/_geocode_can_limit_amount_of_responses.yml

Lines changed: 48 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/vcr_cassettes/Geocodio/_geocode_can_return_simple_format.yml

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)