dnsimple 8.5.0 → 8.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 446911b281dcecf8ebea06ee9429851c721acb7757b1deee3aef8cd5aa5bf556
4
- data.tar.gz: 3bdc28942ca0dde6156122522849bfac6d03bee431a1b952db37b0b11445ffaa
3
+ metadata.gz: 644e524e7010bc680c34ba6abf09315fbe41e2a5ec63ee6c82e443df4f21326a
4
+ data.tar.gz: aa84484bdf2a0b8b48ca45ad448dcea01c8c879acdf4b1c018f2cb8fb73ad7cf
5
5
  SHA512:
6
- metadata.gz: e9c8fbf1c0f0a6af73adcf3a2ce7a77755525f60538b3e9ca4d8e6c63642370b480a7b8d3d2d03b2efab18422dc2a111ab677a26700bbffff944c516ec88554c
7
- data.tar.gz: 490ad2dca6043a664a7858fb3a6f91880be430d2221c27b9dcc3f00112aa1d0fdca99216f27975996ad1ed7f1f931516c2844b6da36cde84ea44c28464e82e5b
6
+ metadata.gz: fa53931624fc7c23d8f91332c9d86379560fc3609fe0f351d6346b6e38fb5b9337bb04e0aa6120c639431b9931cbc100405bc7bca544e04ee805b1ef07e2d4cb
7
+ data.tar.gz: 0032b9d9c4b3df0581e9037a5196bc8376c9f01dbb87ced552eb0372f6d30263a1121bdd86ba16e1a5a992974b64639cbdb81b9ba50e8442603bd0c6ab39f0b2
data/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ This project uses [Semantic Versioning 2.0.0](http://semver.org/).
4
4
 
5
5
  ## main
6
6
 
7
+ ## 8.6.0
8
+
9
+ FEATURES:
10
+
11
+ - NEW: Added `Dnsimple::Client::Registrar#get_domain_transfer_lock` to retrieves the transfer lock status of a registered domain. (dnsimple/dnsimple-ruby#356)
12
+ - NEW: Added `Dnsimple::Client::Registrar#enable_domain_transfer_lock` to enable the transfer lock for a registered domain. (dnsimple/dnsimple-ruby#356)
13
+ - NEW: Added `Dnsimple::Client::Registrar#disable_domain_transfer_lock` to disable the transfer lock for a registered domain. (dnsimple/dnsimple-ruby#356)
14
+
7
15
  ## 8.5.0
8
16
 
9
17
  FEATURES:
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ source 'https://rubygems.org'
5
5
  gemspec
6
6
 
7
7
  gem 'coveralls', require: false
8
- gem 'rubocop', '1.55.1', require: false
9
- gem 'rubocop-performance', '1.18.0', require: false
8
+ gem 'rubocop', '1.56.2', require: false
9
+ gem 'rubocop-performance', '1.19.0', require: false
10
10
  gem 'rubocop-rake', '0.6.0', require: false
11
- gem 'rubocop-rspec', '2.23.0', require: false
11
+ gem 'rubocop-rspec', '2.23.2', require: false
@@ -164,6 +164,7 @@ module Dnsimple
164
164
  require_relative 'registrar_auto_renewal'
165
165
  require_relative 'registrar_whois_privacy'
166
166
  require_relative 'registrar_registrant_changes'
167
+ require_relative 'registrar_transfer_lock'
167
168
  require_relative 'registrar_delegation'
168
169
 
169
170
  class RegistrarService < ClientService
@@ -171,6 +172,7 @@ module Dnsimple
171
172
  include Client::RegistrarAutoRenewal
172
173
  include Client::RegistrarDelegation
173
174
  include Client::RegistrarRegistrantChanges
175
+ include Client::RegistrarTransferLock
174
176
  include Client::RegistrarWhoisPrivacy
175
177
  end
176
178
 
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dnsimple
4
+ class Client
5
+ module RegistrarTransferLock
6
+
7
+ # Gets the transfer lock for the domain.
8
+ #
9
+ # @example Get the transfer lock for "example.com":
10
+ # client.registrar.get_domain_transfer_lock(1010, "example.com")
11
+ #
12
+ # @param [#to_s] account_id the account ID
13
+ # @param [#to_s] domain_name the domain name
14
+ # @param [Hash] options
15
+ # @return [Struct::TransferLock]
16
+ #
17
+ # @raise [Dnsimple::NotFoundError]
18
+ # @raise [RequestError] When the request fails.
19
+ def get_domain_transfer_lock(account_id, domain_name, options = {})
20
+ response = client.get(Client.versioned("/%s/registrar/domains/%s/transfer_lock" % [account_id, domain_name]), options)
21
+
22
+ Dnsimple::Response.new(response, Struct::TransferLock.new(response["data"]))
23
+ end
24
+
25
+ # Enable transfer lock for the domain in the account.
26
+ #
27
+ # @see https://developer.dnsimple.com/v2/registrar/#enableDomainTransferLock
28
+ #
29
+ # @param [Integer] account_id the account ID
30
+ # @param [#to_s] domain_name the domain name
31
+ # @param [Hash] options
32
+ # @return [Struct::TransferLock]
33
+ #
34
+ # @raise [Dnsimple::NotFoundError]
35
+ # @raise [Dnsimple::RequestError]
36
+ def enable_domain_transfer_lock(account_id, domain_name, options = {})
37
+ response = client.post(Client.versioned("/%s/registrar/domains/%s/transfer_lock" % [account_id, domain_name]), nil, options)
38
+
39
+ Dnsimple::Response.new(response, Struct::TransferLock.new(response["data"]))
40
+ end
41
+
42
+ # Disable trasnfer lock for the domain in the account.
43
+ #
44
+ # @see https://developer.dnsimple.com/v2/registrar/#disableDomainTransferLock
45
+ #
46
+ # @param [Integer] account_id the account ID
47
+ # @param [#to_s] domain_name the domain name
48
+ # @param [Hash] options
49
+ # @return [Struct::TransferLock]
50
+ #
51
+ # @raise [Dnsimple::NotFoundError]
52
+ # @raise [Dnsimple::RequestError]
53
+ def disable_domain_transfer_lock(account_id, domain_name, options = {})
54
+ response = client.delete(Client.versioned("/%s/registrar/domains/%s/transfer_lock" % [account_id, domain_name]), nil, options)
55
+
56
+ Dnsimple::Response.new(response, Struct::TransferLock.new(response["data"]))
57
+ end
58
+
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dnsimple
4
+ module Struct
5
+
6
+ class TransferLock < Base
7
+ # @return [Boolean] True if Transfer Lock is enabled on the domain, otherwise false
8
+ attr_accessor :enabled
9
+ end
10
+
11
+ end
12
+ end
@@ -37,6 +37,7 @@ require_relative 'struct/extended_attribute'
37
37
  require_relative 'struct/oauth_token'
38
38
  require_relative 'struct/registrant_change_check'
39
39
  require_relative 'struct/registrant_change'
40
+ require_relative 'struct/transfer_lock'
40
41
  require_relative 'struct/zone_record'
41
42
  require_relative 'struct/service'
42
43
  require_relative 'struct/template'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dnsimple
4
- VERSION = "8.5.0"
4
+ VERSION = "8.6.0"
5
5
  end
@@ -0,0 +1,118 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Dnsimple::Client, ".registrar" do
6
+ subject { described_class.new(base_url: "https://api.dnsimple.test", access_token: "a1b2c3").registrar }
7
+
8
+ describe "#get_domain_transfer_lock" do
9
+ let(:account_id) { 1010 }
10
+ let(:domain_id) { "example.com" }
11
+
12
+ before do
13
+ stub_request(:get, %r{/v2/#{account_id}/registrar/domains/#{domain_id}/transfer_lock})
14
+ .to_return(read_http_fixture("getDomainTransferLock/success.http"))
15
+ end
16
+
17
+ it "builds the correct request" do
18
+ subject.get_domain_transfer_lock(account_id, domain_id)
19
+
20
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_id}/transfer_lock")
21
+ .with(headers: { 'Accept' => 'application/json' })
22
+ end
23
+
24
+ it "returns the transfer lock state" do
25
+ response = subject.get_domain_transfer_lock(account_id, domain_id)
26
+ expect(response).to be_a(Dnsimple::Response)
27
+
28
+ result = response.data
29
+ expect(result).to be_a(Dnsimple::Struct::TransferLock)
30
+ expect(result.enabled).to be(true)
31
+ end
32
+
33
+ context "when the domain does not exist" do
34
+ it "raises NotFoundError" do
35
+ stub_request(:get, %r{/v2})
36
+ .to_return(read_http_fixture("notfound-domain.http"))
37
+
38
+ expect {
39
+ subject.get_domain_transfer_lock(account_id, domain_id)
40
+ }.to raise_error(Dnsimple::NotFoundError)
41
+ end
42
+ end
43
+ end
44
+
45
+ describe "#enable_domain_transfer_lock" do
46
+ let(:account_id) { 1010 }
47
+ let(:domain_id) { "example.com" }
48
+
49
+ before do
50
+ stub_request(:post, %r{/v2/#{account_id}/registrar/domains/#{domain_id}/transfer_lock})
51
+ .to_return(read_http_fixture("enableDomainTransferLock/success.http"))
52
+ end
53
+
54
+ it "builds the correct request" do
55
+ subject.enable_domain_transfer_lock(account_id, domain_id)
56
+
57
+ expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_id}/transfer_lock")
58
+ .with(headers: { 'Accept' => 'application/json' })
59
+ end
60
+
61
+ it "returns the transfer lock state" do
62
+ response = subject.enable_domain_transfer_lock(account_id, domain_id)
63
+ expect(response).to be_a(Dnsimple::Response)
64
+
65
+ result = response.data
66
+ expect(result).to be_a(Dnsimple::Struct::TransferLock)
67
+ expect(result.enabled).to be(true)
68
+ end
69
+
70
+ context "when the domain does not exist" do
71
+ it "raises NotFoundError" do
72
+ stub_request(:post, %r{/v2})
73
+ .to_return(read_http_fixture("notfound-domain.http"))
74
+
75
+ expect {
76
+ subject.enable_domain_transfer_lock(account_id, domain_id)
77
+ }.to raise_error(Dnsimple::NotFoundError)
78
+ end
79
+ end
80
+ end
81
+
82
+ describe "#disable_domain_transfer_lock" do
83
+ let(:account_id) { 1010 }
84
+ let(:domain_id) { "example.com" }
85
+
86
+ before do
87
+ stub_request(:delete, %r{/v2/#{account_id}/registrar/domains/#{domain_id}})
88
+ .to_return(read_http_fixture("disableDomainTransferLock/success.http"))
89
+ end
90
+
91
+ it "builds the correct request" do
92
+ subject.disable_domain_transfer_lock(account_id, domain_id)
93
+
94
+ expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_id}/transfer_lock")
95
+ .with(headers: { 'Accept' => 'application/json' })
96
+ end
97
+
98
+ it "returns the transfer lock state" do
99
+ response = subject.disable_domain_transfer_lock(account_id, domain_id)
100
+ expect(response).to be_a(Dnsimple::Response)
101
+
102
+ result = response.data
103
+ expect(result).to be_a(Dnsimple::Struct::TransferLock)
104
+ expect(result.enabled).to be(false)
105
+ end
106
+
107
+ context "when the domain does not exist" do
108
+ it "raises NotFoundError" do
109
+ stub_request(:delete, %r{/v2})
110
+ .to_return(read_http_fixture("notfound-domain.http"))
111
+
112
+ expect {
113
+ subject.disable_domain_transfer_lock(account_id, domain_id)
114
+ }.to raise_error(Dnsimple::NotFoundError)
115
+ end
116
+ end
117
+ end
118
+ end
@@ -0,0 +1,20 @@
1
+ HTTP/1.1 200 OK
2
+ Server: nginx
3
+ Date: Tue, 15 Aug 2023 09:58:37 GMT
4
+ Content-Type: application/json; charset=utf-8
5
+ Connection: keep-alive
6
+ X-RateLimit-Limit: 2400
7
+ X-RateLimit-Remaining: 2398
8
+ X-RateLimit-Reset: 1488538623
9
+ ETag: W/"fc2368a31a1b6a3afcca33bb37ff6b9d"
10
+ Cache-Control: max-age=0, private, must-revalidate
11
+ X-Request-Id: 8b0fe49a-c810-4552-84ab-a1cd9b4a7786
12
+ X-Runtime: 0.024780
13
+ X-Content-Type-Options: nosniff
14
+ X-Download-Options: noopen
15
+ X-Frame-Options: DENY
16
+ X-Permitted-Cross-Domain-Policies: none
17
+ X-XSS-Protection: 1; mode=block
18
+ Strict-Transport-Security: max-age=31536000
19
+
20
+ {"data":{"enabled":false}}
@@ -0,0 +1,20 @@
1
+ HTTP/1.1 201 Created
2
+ Server: nginx
3
+ Date: Tue, 15 Aug 2023 09:58:37 GMT
4
+ Content-Type: application/json; charset=utf-8
5
+ Connection: keep-alive
6
+ X-RateLimit-Limit: 2400
7
+ X-RateLimit-Remaining: 2398
8
+ X-RateLimit-Reset: 1488538623
9
+ ETag: W/"fc2368a31a1b6a3afcca33bb37ff6b9d"
10
+ Cache-Control: max-age=0, private, must-revalidate
11
+ X-Request-Id: 8b0fe49a-c810-4552-84ab-a1cd9b4a7786
12
+ X-Runtime: 0.024780
13
+ X-Content-Type-Options: nosniff
14
+ X-Download-Options: noopen
15
+ X-Frame-Options: DENY
16
+ X-Permitted-Cross-Domain-Policies: none
17
+ X-XSS-Protection: 1; mode=block
18
+ Strict-Transport-Security: max-age=31536000
19
+
20
+ {"data":{"enabled":true}}
@@ -0,0 +1,20 @@
1
+ HTTP/1.1 200 OK
2
+ Server: nginx
3
+ Date: Tue, 15 Aug 2023 09:58:37 GMT
4
+ Content-Type: application/json; charset=utf-8
5
+ Connection: keep-alive
6
+ X-RateLimit-Limit: 2400
7
+ X-RateLimit-Remaining: 2398
8
+ X-RateLimit-Reset: 1488538623
9
+ ETag: W/"fc2368a31a1b6a3afcca33bb37ff6b9d"
10
+ Cache-Control: max-age=0, private, must-revalidate
11
+ X-Request-Id: 8b0fe49a-c810-4552-84ab-a1cd9b4a7786
12
+ X-Runtime: 0.024780
13
+ X-Content-Type-Options: nosniff
14
+ X-Download-Options: noopen
15
+ X-Frame-Options: DENY
16
+ X-Permitted-Cross-Domain-Policies: none
17
+ X-XSS-Protection: 1; mode=block
18
+ Strict-Transport-Security: max-age=31536000
19
+
20
+ {"data":{"enabled":true}}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dnsimple
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.5.0
4
+ version: 8.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DNSimple
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-24 00:00:00.000000000 Z
11
+ date: 2023-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -125,6 +125,7 @@ files:
125
125
  - lib/dnsimple/client/registrar_auto_renewal.rb
126
126
  - lib/dnsimple/client/registrar_delegation.rb
127
127
  - lib/dnsimple/client/registrar_registrant_changes.rb
128
+ - lib/dnsimple/client/registrar_transfer_lock.rb
128
129
  - lib/dnsimple/client/registrar_whois_privacy.rb
129
130
  - lib/dnsimple/client/services.rb
130
131
  - lib/dnsimple/client/services_domains.rb
@@ -169,6 +170,7 @@ files:
169
170
  - lib/dnsimple/struct/template.rb
170
171
  - lib/dnsimple/struct/template_record.rb
171
172
  - lib/dnsimple/struct/tld.rb
173
+ - lib/dnsimple/struct/transfer_lock.rb
172
174
  - lib/dnsimple/struct/user.rb
173
175
  - lib/dnsimple/struct/vanity_name_server.rb
174
176
  - lib/dnsimple/struct/webhook.rb
@@ -195,6 +197,7 @@ files:
195
197
  - spec/dnsimple/client/registrar_auto_renewal_spec.rb
196
198
  - spec/dnsimple/client/registrar_delegation_spec.rb
197
199
  - spec/dnsimple/client/registrar_spec.rb
200
+ - spec/dnsimple/client/registrar_transfer_lock_spec.rb
198
201
  - spec/dnsimple/client/registrar_whois_privacy_spec.rb
199
202
  - spec/dnsimple/client/services_domains_spec.rb
200
203
  - spec/dnsimple/client/services_spec.rb
@@ -266,11 +269,13 @@ files:
266
269
  - spec/fixtures.http/disableDnssec/not-enabled.http
267
270
  - spec/fixtures.http/disableDnssec/success.http
268
271
  - spec/fixtures.http/disableDomainAutoRenewal/success.http
272
+ - spec/fixtures.http/disableDomainTransferLock/success.http
269
273
  - spec/fixtures.http/disableVanityNameServers/success.http
270
274
  - spec/fixtures.http/disableWhoisPrivacy/success.http
271
275
  - spec/fixtures.http/downloadCertificate/success.http
272
276
  - spec/fixtures.http/enableDnssec/success.http
273
277
  - spec/fixtures.http/enableDomainAutoRenewal/success.http
278
+ - spec/fixtures.http/enableDomainTransferLock/success.http
274
279
  - spec/fixtures.http/enableVanityNameServers/success.http
275
280
  - spec/fixtures.http/enableWhoisPrivacy/created.http
276
281
  - spec/fixtures.http/enableWhoisPrivacy/success.http
@@ -289,6 +294,7 @@ files:
289
294
  - spec/fixtures.http/getDomainRegistration/success.http
290
295
  - spec/fixtures.http/getDomainRenewal/success.http
291
296
  - spec/fixtures.http/getDomainTransfer/success.http
297
+ - spec/fixtures.http/getDomainTransferLock/success.http
292
298
  - spec/fixtures.http/getEmailForward/success.http
293
299
  - spec/fixtures.http/getPrimaryServer/success.http
294
300
  - spec/fixtures.http/getRegistrantChange/success.http