diff --git a/CHANGELOG.md b/CHANGELOG.md index c4635ce1..06798c5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## main +- REMOVED: Removed deprecated `getWhoisPrivacy` (dnsimple/dnsimple-developer#919) +- REMOVED: Removed deprecated `renewWhoisPrivacy` (dnsimple/dnsimple-developer#919) + ## 4.0.1 - HOUSEKEEPING: Update release process diff --git a/src/main/java/com/dnsimple/data/WhoisPrivacyRenewal.java b/src/main/java/com/dnsimple/data/WhoisPrivacyRenewal.java deleted file mode 100644 index 229d0d5e..00000000 --- a/src/main/java/com/dnsimple/data/WhoisPrivacyRenewal.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.dnsimple.data; - -import java.time.LocalDate; -import java.time.OffsetDateTime; - -public class WhoisPrivacyRenewal { - private final Long id; - private final Long domainId; - private final Long whoisPrivacyId; - private final String state; - private final Boolean enabled; - private final LocalDate expiresOn; - private final OffsetDateTime createdAt; - private final OffsetDateTime updatedAt; - - public WhoisPrivacyRenewal(Long id, Long domainId, Long whoisPrivacyId, String state, Boolean enabled, LocalDate expiresOn, OffsetDateTime createdAt, OffsetDateTime updatedAt) { - this.id = id; - this.domainId = domainId; - this.whoisPrivacyId = whoisPrivacyId; - this.state = state; - this.enabled = enabled; - this.expiresOn = expiresOn; - this.createdAt = createdAt; - this.updatedAt = updatedAt; - } - - public Long getId() { - return id; - } - - public Long getDomainId() { - return domainId; - } - - public Long getWhoisPrivacyId() { - return whoisPrivacyId; - } - - public String getState() { - return state; - } - - public Boolean isEnabled() { - return enabled; - } - - public LocalDate getExpiresOn() { - return expiresOn; - } - - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } -} diff --git a/src/main/java/com/dnsimple/endpoints/Registrar.java b/src/main/java/com/dnsimple/endpoints/Registrar.java index 275cbf1e..27a49983 100644 --- a/src/main/java/com/dnsimple/endpoints/Registrar.java +++ b/src/main/java/com/dnsimple/endpoints/Registrar.java @@ -195,18 +195,6 @@ public EmptyResponse disableAutoRenewal(Number account, String domain) { return client.empty(DELETE, account + "/registrar/domains/" + domain + "/auto_renewal", ListOptions.empty(), null); } - /** - * Gets the whois privacy for the domain. - * - * @param account The account ID - * @param domain The domain name or ID - * @return The get whois privacy response - * @see https://developer.dnsimple.com/v2/registrar/whois-privacy/#getWhoisPrivacy - */ - public SimpleResponse getWhoisPrivacy(Number account, String domain) { - return client.simple(GET, account + "/registrar/domains/" + domain + "/whois_privacy", ListOptions.empty(), null, WhoisPrivacy.class); - } - /** * Enable whois privacy for the domain. * @@ -231,18 +219,6 @@ public SimpleResponse disableWhoisPrivacy(Number account, String d return client.simple(DELETE, account + "/registrar/domains/" + domain + "/whois_privacy", ListOptions.empty(), null, WhoisPrivacy.class); } - /** - * Renew whois privacy for the domain. - * - * @param account The account ID - * @param domain The domain name or ID - * @return The disable whois privacy response - * @see https://developer.dnsimple.com/v2/registrar/whois-privacy/#renewWhoisPrivacy - */ - public SimpleResponse renewWhoisPrivacy(Number account, String domain) { - return client.simple(POST, account + "/registrar/domains/" + domain + "/whois_privacy/renewals", ListOptions.empty(), null, WhoisPrivacyRenewal.class); - } - /** * Lists name servers the domain is delegating to. * diff --git a/src/test/java/com/dnsimple/endpoints/RegistrarWhoisPrivacyTest.java b/src/test/java/com/dnsimple/endpoints/RegistrarWhoisPrivacyTest.java index bad5041f..2ce8516b 100644 --- a/src/test/java/com/dnsimple/endpoints/RegistrarWhoisPrivacyTest.java +++ b/src/test/java/com/dnsimple/endpoints/RegistrarWhoisPrivacyTest.java @@ -1,33 +1,14 @@ package com.dnsimple.endpoints; import com.dnsimple.data.WhoisPrivacy; -import com.dnsimple.data.WhoisPrivacyRenewal; import com.dnsimple.tools.DnsimpleTestBase; import org.junit.Test; -import java.time.LocalDate; -import java.time.OffsetDateTime; - import static com.dnsimple.http.HttpMethod.*; -import static java.time.ZoneOffset.UTC; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; public class RegistrarWhoisPrivacyTest extends DnsimpleTestBase { - @Test - public void testGetWhoisPrivacy() { - server.stubFixtureAt("getWhoisPrivacy/success.http"); - WhoisPrivacy whoisPrivacy = client.registrar.getWhoisPrivacy(1010, "example.com").getData(); - assertThat(server.getRecordedRequest().getMethod(), is(GET)); - assertThat(server.getRecordedRequest().getPath(), is("/v2/1010/registrar/domains/example.com/whois_privacy")); - assertThat(whoisPrivacy.getId(), is(1L)); - assertThat(whoisPrivacy.getDomainId(), is(2L)); - assertThat(whoisPrivacy.getExpiresOn(), is(LocalDate.of(2017, 2, 13))); - assertThat(whoisPrivacy.isEnabled(), is(true)); - assertThat(whoisPrivacy.getCreatedAt(), is(OffsetDateTime.of(2016, 2, 13, 14, 34, 50, 0, UTC))); - assertThat(whoisPrivacy.getUpdatedAt(), is(OffsetDateTime.of(2016, 2, 13, 14, 34, 52, 0, UTC))); - } - @Test public void testEnableWhoisPrivacyAlreadyPurchased() { server.stubFixtureAt("enableWhoisPrivacy/success.http"); @@ -53,20 +34,4 @@ public void testDisableWhoisPrivacyNewlyPurchased() { assertThat(server.getRecordedRequest().getPath(), is("/v2/1010/registrar/domains/example.com/whois_privacy")); assertThat(whoisPrivacy.getId(), is(1L)); } - - @Test - public void testRenewWhoisPrivacy() { - server.stubFixtureAt("renewWhoisPrivacy/success.http"); - WhoisPrivacyRenewal whoisPrivacyRenewal = client.registrar.renewWhoisPrivacy(1010, "example.com").getData(); - assertThat(server.getRecordedRequest().getMethod(), is(POST)); - assertThat(server.getRecordedRequest().getPath(), is("/v2/1010/registrar/domains/example.com/whois_privacy/renewals")); - assertThat(whoisPrivacyRenewal.getId(), is(1L)); - assertThat(whoisPrivacyRenewal.getDomainId(), is(100L)); - assertThat(whoisPrivacyRenewal.getWhoisPrivacyId(), is(999L)); - assertThat(whoisPrivacyRenewal.getState(), is("new")); - assertThat(whoisPrivacyRenewal.isEnabled(), is(true)); - assertThat(whoisPrivacyRenewal.getExpiresOn(), is(LocalDate.of(2020, 1, 10))); - assertThat(whoisPrivacyRenewal.getCreatedAt(), is(OffsetDateTime.of(2019, 1, 10, 12, 12, 48, 0, UTC))); - assertThat(whoisPrivacyRenewal.getUpdatedAt(), is(OffsetDateTime.of(2019, 1, 10, 12, 12, 48, 0, UTC))); - } } diff --git a/src/test/resources/com/dnsimple/getWhoisPrivacy/success.http b/src/test/resources/com/dnsimple/getWhoisPrivacy/success.http deleted file mode 100644 index b18dc401..00000000 --- a/src/test/resources/com/dnsimple/getWhoisPrivacy/success.http +++ /dev/null @@ -1,16 +0,0 @@ -HTTP/1.1 200 OK -Server: nginx -Date: Sat, 13 Feb 2016 14:35:37 GMT -Content-Type: application/json; charset=utf-8 -Connection: keep-alive -Status: 200 OK -X-RateLimit-Limit: 4000 -X-RateLimit-Remaining: 3996 -X-RateLimit-Reset: 1455377135 -ETag: W/"10be37d45cd224b2178b8a2f86c466ea" -Cache-Control: max-age=0, private, must-revalidate -X-Request-Id: 78afe010-0f54-4d39-9ed3-08c67d545a35 -X-Runtime: 0.031770 -Strict-Transport-Security: max-age=31536000 - -{"data":{"id":1,"domain_id":2,"expires_on":"2017-02-13","enabled":true,"created_at":"2016-02-13T14:34:50Z","updated_at":"2016-02-13T14:34:52Z"}} diff --git a/src/test/resources/com/dnsimple/renewWhoisPrivacy/success.http b/src/test/resources/com/dnsimple/renewWhoisPrivacy/success.http deleted file mode 100644 index 39a77f17..00000000 --- a/src/test/resources/com/dnsimple/renewWhoisPrivacy/success.http +++ /dev/null @@ -1,20 +0,0 @@ -HTTP/1.1 201 Created -Server: nginx -Date: Thu, 10 Jan 2019 12:12:50 GMT -Content-Type: application/json; charset=utf-8 -Connection: keep-alive -X-RateLimit-Limit: 2400 -X-RateLimit-Remaining: 2398 -X-RateLimit-Reset: 1547125899 -ETag: W/"e5bf5d90a6c95e5f1443dcbaf2cc27c6" -Cache-Control: max-age=0, private, must-revalidate -X-Request-Id: 6e80e830-21ae-46ea-9191-98811884808a -X-Runtime: 1.459325 -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":{"id":1,"domain_id":100,"whois_privacy_id":999,"state":"new","expires_on":"2020-01-10","enabled":true,"created_at":"2019-01-10T12:12:48Z","updated_at":"2019-01-10T12:12:48Z"}} \ No newline at end of file diff --git a/src/test/resources/com/dnsimple/renewWhoisPrivacy/whois-privacy-duplicated-order.http b/src/test/resources/com/dnsimple/renewWhoisPrivacy/whois-privacy-duplicated-order.http deleted file mode 100644 index cecf31c5..00000000 --- a/src/test/resources/com/dnsimple/renewWhoisPrivacy/whois-privacy-duplicated-order.http +++ /dev/null @@ -1,18 +0,0 @@ -HTTP/1.1 400 Bad Request -Server: nginx -Date: Thu, 10 Jan 2019 12:13:21 GMT -Content-Type: application/json; charset=utf-8 -Connection: keep-alive -X-RateLimit-Limit: 2400 -X-RateLimit-Remaining: 2397 -X-RateLimit-Reset: 1547125899 -Cache-Control: no-cache -X-Request-Id: 16cc92bb-fe38-434b-b483-602d77ac77d3 -X-Runtime: 0.122201 -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":"The whois privacy for example.com has just been renewed, a new renewal cannot be started at this time"} \ No newline at end of file diff --git a/src/test/resources/com/dnsimple/renewWhoisPrivacy/whois-privacy-not-found.http b/src/test/resources/com/dnsimple/renewWhoisPrivacy/whois-privacy-not-found.http deleted file mode 100644 index 0044413a..00000000 --- a/src/test/resources/com/dnsimple/renewWhoisPrivacy/whois-privacy-not-found.http +++ /dev/null @@ -1,18 +0,0 @@ -HTTP/1.1 400 Bad Request -Server: nginx -Date: Thu, 10 Jan 2019 12:11:39 GMT -Content-Type: application/json; charset=utf-8 -Connection: keep-alive -X-RateLimit-Limit: 2400 -X-RateLimit-Remaining: 2399 -X-RateLimit-Reset: 1547125899 -Cache-Control: no-cache -X-Request-Id: 2727b7c4-97af-4e22-9c7f-bd84e20f2dc1 -X-Runtime: 0.139925 -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":"WHOIS privacy not found for example.com"} \ No newline at end of file