diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f868d56..0c4bbf4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ This project uses [Semantic Versioning 2.0.0](http://semver.org/). ## main +### Removed + +- Removed `Dnsimple::Client::Registrar#whois_privacy` (dnsimple/dnsimple-developer#919) +- Removed `Dnsimple::Client::Registrar#renew_whois_privacy` (dnsimple/dnsimple-developer#919) + ## 11.1.0 - 2025-09-25 ### Added diff --git a/lib/dnsimple/client/registrar_whois_privacy.rb b/lib/dnsimple/client/registrar_whois_privacy.rb index 442430d8..5848fca5 100644 --- a/lib/dnsimple/client/registrar_whois_privacy.rb +++ b/lib/dnsimple/client/registrar_whois_privacy.rb @@ -3,26 +3,6 @@ module Dnsimple class Client module RegistrarWhoisPrivacy - # Gets the whois privacy for the domain. - # - # @see https://developer.dnsimple.com/v2/registrar/whois-privacy/#get - # - # @example Get the whois privacy for "example.com": - # client.registrar.whois_privacy(1010, "example.com") - # - # @param [Integer] account_id the account ID - # @param [#to_s] domain_name the domain name - # @param [Hash] options - # @return [Struct::WhoisPrivacy] - # - # @raise [RequestError] When the request fails. - def whois_privacy(account_id, domain_name, options = {}) - endpoint = whois_privacy_endpoint(account_id, domain_name) - response = client.get(endpoint, options) - - Dnsimple::Response.new(response, Struct::WhoisPrivacy.new(response["data"])) - end - # Enables whois privacy for the domain. # # @see https://developer.dnsimple.com/v2/registrar/whois-privacy/#enable @@ -63,26 +43,6 @@ def disable_whois_privacy(account_id, domain_name, options = {}) Dnsimple::Response.new(response, Struct::WhoisPrivacy.new(response["data"])) end - # Renews whois privacy for the domain. - # - # @see https://developer.dnsimple.com/v2/registrar/whois-privacy/#renew - # - # @example Renew whois privacy for "example.com": - # client.registrar.renew_whois_privacy(1010, "example.com") - # - # @param account_id [Integer] the account ID - # @param domain_name [#to_s] The domain name - # @param options [Hash] - # @return [Struct::WhoisPrivacy] - # - # @raise [RequestError] When the request fails. - def renew_whois_privacy(account_id, domain_name, options = {}) - endpoint = "#{whois_privacy_endpoint(account_id, domain_name)}/renewals" - response = client.post(endpoint, nil, options) - - Dnsimple::Response.new(response, Struct::WhoisPrivacyRenewal.new(response["data"])) - end - private diff --git a/lib/dnsimple/struct.rb b/lib/dnsimple/struct.rb index 3a52b2b3..ac0ce518 100644 --- a/lib/dnsimple/struct.rb +++ b/lib/dnsimple/struct.rb @@ -47,7 +47,6 @@ def initialize(attributes = {}) require_relative "struct/user" require_relative "struct/vanity_name_server" require_relative "struct/whois_privacy" -require_relative "struct/whois_privacy_renewal" require_relative "struct/zone" require_relative "struct/zone_records_batch_change" require_relative "struct/zone_record_id" diff --git a/lib/dnsimple/struct/whois_privacy_renewal.rb b/lib/dnsimple/struct/whois_privacy_renewal.rb deleted file mode 100644 index 212f46d2..00000000 --- a/lib/dnsimple/struct/whois_privacy_renewal.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -module Dnsimple - module Struct - class WhoisPrivacyRenewal < Base - # @return [Integer] The associated domain ID. - attr_accessor :domain_id - - # @return [Integer] The associated WHOIS Privacy ID. - attr_accessor :whois_privacy_id - - # @return [String] The WHOIS Privacy order state. - attr_accessor :state - - # @return [Boolean] Whether the WHOIS Privacy is enabled for the domain. - attr_accessor :enabled - - # @return [String] The date the WHOIS Privacy will expire on. - attr_accessor :expires_on - - # @return [String] When the WHOIS Privacy was created in DNSimple. - attr_accessor :created_at - - # @return [String] When the WHOIS Privacy was last updated in DNSimple. - attr_accessor :updated_at - end - end -end diff --git a/spec/dnsimple/client/registrar_whois_privacy_spec.rb b/spec/dnsimple/client/registrar_whois_privacy_spec.rb index 342725a0..48f61c2f 100644 --- a/spec/dnsimple/client/registrar_whois_privacy_spec.rb +++ b/spec/dnsimple/client/registrar_whois_privacy_spec.rb @@ -7,33 +7,6 @@ subject { described_class.new(base_url: "https://api.dnsimple.test", access_token: "a1b2c3").registrar } - describe "#whois_privacy" do - let(:account_id) { 1010 } - - before do - stub_request(:get, %r{/v2/#{account_id}/registrar/domains/.+/whois_privacy$}) - .to_return(read_http_fixture("getWhoisPrivacy/success.http")) - end - - it "builds the correct request" do - subject.whois_privacy(account_id, domain_name = "example.com") - - expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/whois_privacy") - .with(headers: { "Accept" => "application/json" }) - end - - it "returns the whois privacy" do - response = subject.whois_privacy(account_id, "example.com") - expect(response).to be_a(Dnsimple::Response) - - result = response.data - expect(result).to be_a(Dnsimple::Struct::WhoisPrivacy) - expect(result.domain_id).to be_a(Integer) - expect(result.enabled).to be(true) - expect(result.expires_on).to be_a(String) - end - end - describe "#enable_whois_privacy" do let(:account_id) { 1010 } @@ -118,59 +91,4 @@ end end - - describe "#renew_whois_privacy" do - let(:account_id) { 1010 } - - before do - stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/whois_privacy/renewals$}) - .to_return(read_http_fixture("renewWhoisPrivacy/success.http")) - end - - it "builds the correct request" do - subject.renew_whois_privacy(account_id, domain_name = "example.com") - - expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/whois_privacy/renewals") - .with(headers: { "Accept" => "application/json" }) - end - - it "returns the whois privacy order" do - response = subject.renew_whois_privacy(account_id, "example.com") - expect(response).to be_a(Dnsimple::Response) - - result = response.data - expect(result).to be_a(Dnsimple::Struct::WhoisPrivacyRenewal) - expect(result.domain_id).to be_a(Integer) - expect(result.whois_privacy_id).to be_a(Integer) - expect(result.enabled).to be(true) - expect(result.expires_on).to be_a(String) - end - - context "when whois privacy was't previously purchased" do - before do - stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/whois_privacy/renewals$}) - .to_return(read_http_fixture("renewWhoisPrivacy/whois-privacy-not-found.http")) - end - - it "raises error" do - expect do - subject.renew_whois_privacy(account_id, "example.com") - end.to raise_error(Dnsimple::RequestError, "WHOIS privacy not found for example.com") - end - end - - context "when there is already a whois privacy renewal order in progress" do - before do - stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/whois_privacy/renewals$}) - .to_return(read_http_fixture("renewWhoisPrivacy/whois-privacy-duplicated-order.http")) - end - - it "raises error" do - expect do - subject.renew_whois_privacy(account_id, "example.com") - end.to raise_error(Dnsimple::RequestError, "The whois privacy for example.com has just been renewed, a new renewal cannot be started at this time") - end - end - end - end diff --git a/spec/fixtures.http/getWhoisPrivacy/success.http b/spec/fixtures.http/getWhoisPrivacy/success.http deleted file mode 100644 index b18dc401..00000000 --- a/spec/fixtures.http/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/spec/fixtures.http/renewWhoisPrivacy/success.http b/spec/fixtures.http/renewWhoisPrivacy/success.http deleted file mode 100644 index 39a77f17..00000000 --- a/spec/fixtures.http/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/spec/fixtures.http/renewWhoisPrivacy/whois-privacy-duplicated-order.http b/spec/fixtures.http/renewWhoisPrivacy/whois-privacy-duplicated-order.http deleted file mode 100644 index cecf31c5..00000000 --- a/spec/fixtures.http/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/spec/fixtures.http/renewWhoisPrivacy/whois-privacy-not-found.http b/spec/fixtures.http/renewWhoisPrivacy/whois-privacy-not-found.http deleted file mode 100644 index 0044413a..00000000 --- a/spec/fixtures.http/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