From a27dcc43e9c88d546debe64f2717f0829addd130 Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Mon, 13 Jan 2025 12:04:42 -0800 Subject: [PATCH] Deprecate metro code --- CHANGELOG.md | 6 ++++++ src/main/java/com/maxmind/geoip2/record/Location.java | 8 ++++---- .../java/com/maxmind/geoip2/WebServiceClientTest.java | 1 + .../com/maxmind/geoip2/model/InsightsResponseTest.java | 2 ++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0674a0e9..dbd8e7ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ CHANGELOG ========= +4.3.0 +------------------ + +* `getMetroCode` in the `Location` model has been deprecated. The code + values are no longer being maintained. + 4.2.1 (2024-09-20) ------------------ diff --git a/src/main/java/com/maxmind/geoip2/record/Location.java b/src/main/java/com/maxmind/geoip2/record/Location.java index 6f944874..b457ad13 100644 --- a/src/main/java/com/maxmind/geoip2/record/Location.java +++ b/src/main/java/com/maxmind/geoip2/record/Location.java @@ -119,12 +119,12 @@ public Integer getAccuracyRadius() { } /** - * @return The metro code of the location if the location is in the US. - * MaxMind returns the same metro codes as the Google AdWords API. + * @return The metro code is a no-longer-maintained code for targeting + * advertisements in Google. + * @deprecated Code values are no longer maintained. */ @JsonProperty("metro_code") + @Deprecated public Integer getMetroCode() { return this.metroCode; } diff --git a/src/test/java/com/maxmind/geoip2/WebServiceClientTest.java b/src/test/java/com/maxmind/geoip2/WebServiceClientTest.java index d70dd7f4..d2ee3075 100644 --- a/src/test/java/com/maxmind/geoip2/WebServiceClientTest.java +++ b/src/test/java/com/maxmind/geoip2/WebServiceClientTest.java @@ -67,6 +67,7 @@ public void test200WithInvalidJson() throws Exception { assertEquals("Received a 200 response but could not decode it as JSON", ex.getMessage()); } + @SuppressWarnings("deprecation") @Test public void test200WithDefaultValues() throws Exception { WebServiceClient client = createSuccessClient("insights", "1.2.3.13", diff --git a/src/test/java/com/maxmind/geoip2/model/InsightsResponseTest.java b/src/test/java/com/maxmind/geoip2/model/InsightsResponseTest.java index 3f3b3efb..95f71bdc 100644 --- a/src/test/java/com/maxmind/geoip2/model/InsightsResponseTest.java +++ b/src/test/java/com/maxmind/geoip2/model/InsightsResponseTest.java @@ -105,6 +105,7 @@ public void leastSpecificSubdivision() { ); } + @SuppressWarnings("deprecation") @Test public void testTraits() { Traits traits = this.insights.getTraits(); @@ -172,6 +173,7 @@ public void testTraits() { ); } + @SuppressWarnings("deprecation") @Test public void testLocation() {