diff --git a/CHANGELOG.md b/CHANGELOG.md index 06798c5b..be00a5c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## main +- REMOVED: Removed deprecated `getDomainPremiumPrice`. Use `getDomainPrices` instead. (dnsimple/dnsimple-developer#916) - REMOVED: Removed deprecated `getWhoisPrivacy` (dnsimple/dnsimple-developer#919) - REMOVED: Removed deprecated `renewWhoisPrivacy` (dnsimple/dnsimple-developer#919) diff --git a/src/main/java/com/dnsimple/data/DomainPremiumPriceCheck.java b/src/main/java/com/dnsimple/data/DomainPremiumPriceCheck.java deleted file mode 100644 index 3088112f..00000000 --- a/src/main/java/com/dnsimple/data/DomainPremiumPriceCheck.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.dnsimple.data; - -public class DomainPremiumPriceCheck { - private final String premiumPrice; - private final String action; - - public DomainPremiumPriceCheck(String premiumPrice, String action) { - this.premiumPrice = premiumPrice; - this.action = action; - } - - public String getPremiumPrice() { - return premiumPrice; - } - - public String getAction() { - return action; - } -} diff --git a/src/main/java/com/dnsimple/endpoints/Registrar.java b/src/main/java/com/dnsimple/endpoints/Registrar.java index 27a49983..66782a27 100644 --- a/src/main/java/com/dnsimple/endpoints/Registrar.java +++ b/src/main/java/com/dnsimple/endpoints/Registrar.java @@ -37,22 +37,6 @@ public SimpleResponse checkDomain(Number account, String domainName return client.simple(GET, account + "/registrar/domains/" + domainName + "/check", ListOptions.empty(), null, DomainCheck.class); } - /** - * Checks the premium price of a domain for the provided action. - * - * @param account The account ID - * @param domainName The domain to check - * @param action The action to get the price of - * @return The premium price - * @see https://developer.dnsimple.com/v2/registrar/#getDomainPremiumPrice - * @deprecated use {@link #getDomainPrices(Number, String)} instead - */ - @Deprecated(since="0.9.1", forRemoval = true) - public SimpleResponse getDomainPremiumPrice(Number account, String domainName, DomainCheckPremiumPriceAction action) { - var options = ListOptions.empty().filter("action", action.name().toLowerCase()); - return client.simple(GET, account + "/registrar/domains/" + domainName + "/premium_price", options, action, DomainPremiumPriceCheck.class); - } - /** * Get prices for registration, transfer, and renewal for a domain. * diff --git a/src/main/java/com/dnsimple/request/DomainCheckPremiumPriceAction.java b/src/main/java/com/dnsimple/request/DomainCheckPremiumPriceAction.java deleted file mode 100644 index ccf1aff4..00000000 --- a/src/main/java/com/dnsimple/request/DomainCheckPremiumPriceAction.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.dnsimple.request; - -public enum DomainCheckPremiumPriceAction { - REGISTRATION, RENEWAL, TRANSFER -} diff --git a/src/test/java/com/dnsimple/endpoints/RegistrarTest.java b/src/test/java/com/dnsimple/endpoints/RegistrarTest.java index 0bef0f50..789efdde 100644 --- a/src/test/java/com/dnsimple/endpoints/RegistrarTest.java +++ b/src/test/java/com/dnsimple/endpoints/RegistrarTest.java @@ -14,7 +14,6 @@ import java.util.Map; import static com.dnsimple.http.HttpMethod.*; -import static com.dnsimple.request.DomainCheckPremiumPriceAction.REGISTRATION; import static com.dnsimple.tools.CustomMatchers.*; import static java.time.ZoneOffset.UTC; import static java.util.Collections.singletonMap; @@ -33,46 +32,6 @@ public void testCheckDomain() { assertThat(availability.isPremium(), is(true)); } - @Test - public void testCheckDomainPremiumPrice() { - server.stubFixtureAt("checkDomainPremiumPrice/success.http"); - DomainPremiumPriceCheck premiumPrice = client.registrar.getDomainPremiumPrice(1010, "cocoo.co", REGISTRATION).getData(); - assertThat(server.getRecordedRequest().getMethod(), is(GET)); - assertThat(server.getRecordedRequest().getPath(), is("/v2/1010/registrar/domains/cocoo.co/premium_price?action=registration")); - assertThat(premiumPrice.getPremiumPrice(), is("2640.00")); - assertThat(premiumPrice.getAction(), is("registration")); - } - - @Test - public void testCheckDomainPremiumPrice_400_notAPremiumDomain() { - server.stubFixtureAt("checkDomainPremiumPrice/error_400_not_a_premium_domain.http"); - assertThat( - () -> client.registrar.getDomainPremiumPrice(1010, "cocotero.love", REGISTRATION), - thrownException(allOf( - is(instanceOf(BadRequestException.class)), - property( - BadRequestException::getBody, - equalTo(singletonMap("message", "`cocotero.love` is not a premium domain for registration")) - ) - )) - ); - } - - @Test - public void testCheckDomainPremiumPrice_400_tld_not_supported() { - server.stubFixtureAt("checkDomainPremiumPrice/error_400_tld_not_supported.http"); - assertThat( - () -> client.registrar.getDomainPremiumPrice(1010, "cocotero.love", REGISTRATION), - thrownException(allOf( - is(instanceOf(BadRequestException.class)), - property( - BadRequestException::getBody, - equalTo(singletonMap("message", "TLD .LOVE is not supported")) - ) - )) - ); - } - @Test public void testGetDomainPrices() { server.stubFixtureAt("getDomainPrices/success.http"); diff --git a/src/test/resources/com/dnsimple/checkDomainPremiumPrice/error_400_not_a_premium_domain.http b/src/test/resources/com/dnsimple/checkDomainPremiumPrice/error_400_not_a_premium_domain.http deleted file mode 100644 index 62263a37..00000000 --- a/src/test/resources/com/dnsimple/checkDomainPremiumPrice/error_400_not_a_premium_domain.http +++ /dev/null @@ -1,18 +0,0 @@ -HTTP/1.1 400 Bad Request -Server: nginx -Date: Mon, 27 Jul 2020 13:43:02 GMT -Content-Type: application/json; charset=utf-8 -Connection: keep-alive -X-RateLimit-Limit: 4800 -X-RateLimit-Remaining: 4786 -X-RateLimit-Reset: 1595859922 -Cache-Control: no-cache -X-Request-Id: 382b409c-0f90-4758-af3b-0bccd31a9d0d -X-Runtime: 1.346405 -X-Frame-Options: DENY -X-Content-Type-Options: nosniff -X-XSS-Protection: 1; mode=block -X-Download-Options: noopen -X-Permitted-Cross-Domain-Policies: none - -{"message":"`cocotero.love` is not a premium domain for registration"} diff --git a/src/test/resources/com/dnsimple/checkDomainPremiumPrice/error_400_tld_not_supported.http b/src/test/resources/com/dnsimple/checkDomainPremiumPrice/error_400_tld_not_supported.http deleted file mode 100644 index 7cb72d8d..00000000 --- a/src/test/resources/com/dnsimple/checkDomainPremiumPrice/error_400_tld_not_supported.http +++ /dev/null @@ -1,18 +0,0 @@ -HTTP/1.1 400 Bad Request -Server: nginx -Date: Mon, 27 Jul 2020 13:41:23 GMT -Content-Type: application/json; charset=utf-8 -Connection: keep-alive -X-RateLimit-Limit: 2400 -X-RateLimit-Remaining: 2398 -X-RateLimit-Reset: 1595860823 -Cache-Control: no-cache -X-Request-Id: 6986cca3-4f57-4814-9e81-1c484d61c7ea -X-Runtime: 0.007339 -X-Frame-Options: DENY -X-Content-Type-Options: nosniff -X-XSS-Protection: 1; mode=block -X-Download-Options: noopen -X-Permitted-Cross-Domain-Policies: none - -{"message":"TLD .LOVE is not supported"} diff --git a/src/test/resources/com/dnsimple/checkDomainPremiumPrice/success.http b/src/test/resources/com/dnsimple/checkDomainPremiumPrice/success.http deleted file mode 100644 index a37ddadc..00000000 --- a/src/test/resources/com/dnsimple/checkDomainPremiumPrice/success.http +++ /dev/null @@ -1,20 +0,0 @@ -HTTP/1.1 200 OK -Server: nginx -Date: Mon, 27 Jul 2020 13:58:50 GMT -Content-Type: application/json; charset=utf-8 -Connection: keep-alive -X-RateLimit-Limit: 4800 -X-RateLimit-Remaining: 4769 -X-RateLimit-Reset: 1595859923 -ETag: W/"54b4776b898065f2f551fc33465d0936" -Cache-Control: max-age=0, private, must-revalidate -X-Request-Id: 75c5090e-8000-4e95-a516-ffd09383f641 -X-Runtime: 2.380524 -X-Frame-Options: DENY -X-Content-Type-Options: nosniff -X-XSS-Protection: 1; mode=block -X-Download-Options: noopen -X-Permitted-Cross-Domain-Policies: none -Strict-Transport-Security: max-age=31536000 - -{"data":{"premium_price":"2640.00","action":"registration"}} diff --git a/src/test/resources/com/dnsimple/getDomainPremiumPrice/failure.http b/src/test/resources/com/dnsimple/getDomainPremiumPrice/failure.http deleted file mode 100644 index 5a8530e4..00000000 --- a/src/test/resources/com/dnsimple/getDomainPremiumPrice/failure.http +++ /dev/null @@ -1,15 +0,0 @@ -HTTP/1.1 400 Bad Request -Server: nginx -Date: Tue, 22 Nov 2016 10:48:27 GMT -Content-Type: application/json; charset=utf-8 -Connection: keep-alive -Cache-Control: no-cache -X-Request-Id: 1304138f-0fc7-4845-b9ed-e3803409cb5a -X-Runtime: 1.421413 -X-Content-Type-Options: nosniff -X-Download-Options: noopen -X-Frame-Options: DENY -X-Permitted-Cross-Domain-Policies: none -X-XSS-Protection: 1; mode=block - -{"message":"`example.com` is not a premium domain for registration"} diff --git a/src/test/resources/com/dnsimple/getDomainPremiumPrice/success.http b/src/test/resources/com/dnsimple/getDomainPremiumPrice/success.http deleted file mode 100644 index 3307085e..00000000 --- a/src/test/resources/com/dnsimple/getDomainPremiumPrice/success.http +++ /dev/null @@ -1,20 +0,0 @@ -HTTP/1.1 200 OK -Server: nginx -Date: Tue, 22 Nov 2016 10:46:17 GMT -Content-Type: application/json; charset=utf-8 -Connection: keep-alive -X-RateLimit-Limit: 2400 -X-RateLimit-Remaining: 2399 -X-RateLimit-Reset: 1479815177 -ETag: W/"7ed6ab997deeafd985a5782df2d86b04" -Cache-Control: max-age=0, private, must-revalidate -X-Request-Id: 54731b91-cd76-4d08-9481-c0f55f47996d -X-Runtime: 1.013083 -X-Content-Type-Options: nosniff -X-Download-Options: noopen -X-Frame-Options: DENY -X-Permitted-Cross-Domain-Policies: none -X-XSS-Protection: 1; mode=block -Strict-Transport-Security: max-age=31536000 - -{"data":{"premium_price":"109.00","action":"registration"}}