dnsimple 8.8.0 → 8.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 874a1e978f9845bb7a50c9f596fb30b22186730498972ed4c538664939c9e3d6
4
- data.tar.gz: 1a1ec6d73ca64499a9e9462529d18f9e8643a619a349310c5e3b4e6f0c3d8050
3
+ metadata.gz: 6757a107a26286469b7b0e991849e0557cdc1c2ff21e74f92377fd5c62047d08
4
+ data.tar.gz: 26633769cf4c7453bad5fcaa8ad6cf0d4d98d368e6a705d4834fe57cace492ad
5
5
  SHA512:
6
- metadata.gz: d28ef3ce63861291b5b95bb7d373685367c25bb33e3ddf42ee403e8d8c3963d8e0bf377280ca97560ac142855ee4b1d6de74cdad6241a534a3978c5aa6c17085
7
- data.tar.gz: a0bef36ed74defb05757c8ed9e21d90198c5fee95530da0c77212f4fa303c5bb6ce4773989d5ed8ac2e8f78068e2d3d92044593fb53d2c14ea7a9f1c1a5fbe49
6
+ metadata.gz: a483b5e60d097291d45f4062f270392f34505b965e906792d3458dcad334dd5bf69f92e6b5f2d345612dabbead4129c90401ba5c619bc3a9f06f550d7b661291
7
+ data.tar.gz: 00e503a63429b4e9160fe3a6c92fd177085636de937366299bf03ba036a1b8ed426e371132dd14cee43b53f6c70826e6f6e851c45410450ec16402be483a84c5
data/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ This project uses [Semantic Versioning 2.0.0](http://semver.org/).
4
4
 
5
5
  ## main
6
6
 
7
+ ## 8.9.0
8
+
9
+ - NEW: Added `Dnsimple::Client::Registrar#restore_domain` to restore a domain. (dnsimple/dnsimple-ruby#379)
10
+ - NEW: Added `Dnsimple::Client::Registrar#get_domain_restore` to retrieve the details of an existing dommain restore. (dnsimple/dnsimple-ruby#379)
11
+
7
12
  ## 8.8.0
8
13
 
9
14
  - NEW: Added `Dnsimple::Client::DnsAnalytics#query` to query and pull data from the DNS Analytics API endpoint(dnsimple/dnsimple-ruby#375)
@@ -218,6 +218,49 @@ module Dnsimple
218
218
  Dnsimple::Response.new(response, nil)
219
219
  end
220
220
 
221
+ # Restores a domain.
222
+ #
223
+ # @see https://developer.dnsimple.com/v2/registrar/#restore
224
+ #
225
+ # @example Restore example.com:
226
+ # client.registrar.restore_domain(1010, "example.com", {})
227
+ #
228
+ # @param [Integer] account_id the account ID
229
+ # @param [#to_s] domain_name the domain name to restore
230
+ # @param [Hash] attributes
231
+ # @param [Hash] options
232
+ # @return [Struct::DomainRestore]
233
+ #
234
+ # @raise [RequestError] When the request fails.
235
+ def restore_domain(account_id, domain_name, attributes = nil, options = {})
236
+ endpoint = Client.versioned("/%s/registrar/domains/%s/restores" % [account_id, domain_name])
237
+ response = client.post(endpoint, attributes, options)
238
+
239
+ Dnsimple::Response.new(response, Struct::DomainRestore.new(response["data"]))
240
+ end
241
+
242
+ # Retrieve the details of an existing domain restore.
243
+ #
244
+ # @see https://developer.dnsimple.com/v2/registrar/#getDomainRestore
245
+ #
246
+ # @example Retrieve the restore 42 for example.com:
247
+ # client.registrar.get_domain_restore(1010, "example.com", 42)
248
+ #
249
+ # @param [Integer] account_id the account ID
250
+ # @param [#to_s] domain_name the domain name
251
+ # @param [Integer] domain_restore_id the domain restore ID
252
+ # @param [Hash] options
253
+ # @return [Struct::DomainRestore]
254
+ #
255
+ # @raise [NotFoundError] When record is not found.
256
+ # @raise [RequestError] When the request fails.
257
+ def get_domain_restore(account_id, domain_name, domain_restore_id, options = {})
258
+ endpoint = Client.versioned("/%s/registrar/domains/%s/restores/%s" % [account_id, domain_name, domain_restore_id])
259
+ response = client.get(endpoint, options)
260
+
261
+ Dnsimple::Response.new(response, Struct::DomainRestore.new(response["data"]))
262
+ end
263
+
221
264
  end
222
265
  end
223
266
  end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dnsimple
4
+ module Struct
5
+ class DomainRestore < Base
6
+
7
+ # @return [Integer] The domain restore ID in DNSimple.
8
+ attr_accessor :id
9
+
10
+ # @return [Integer] The associated domain ID.
11
+ attr_accessor :domain_id
12
+
13
+ # @return [String] The state of the restore.
14
+ attr_accessor :state
15
+
16
+ # @return [String] When the domain restore was created in DNSimple.
17
+ attr_accessor :created_at
18
+
19
+ # @return [String] When the domain restore was last updated in DNSimple.
20
+ attr_accessor :updated_at
21
+
22
+ end
23
+ end
24
+ end
@@ -31,6 +31,7 @@ require_relative 'struct/domain_premium_price'
31
31
  require_relative 'struct/domain_price'
32
32
  require_relative 'struct/domain_push'
33
33
  require_relative 'struct/domain_registration'
34
+ require_relative 'struct/domain_restore'
34
35
  require_relative 'struct/domain_transfer'
35
36
  require_relative 'struct/domain_renewal'
36
37
  require_relative 'struct/dns_analytics'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dnsimple
4
4
 
5
- VERSION = "8.8.0"
5
+ VERSION = "8.9.0"
6
6
 
7
7
  end
@@ -571,4 +571,57 @@ describe Dnsimple::Client, ".registrar" do
571
571
  expect(result).to be_nil
572
572
  end
573
573
  end
574
+
575
+ describe "#restore_domain" do
576
+ let(:account_id) { 1010 }
577
+
578
+ before do
579
+ stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/restores$})
580
+ .to_return(read_http_fixture("restoreDomain/success.http"))
581
+ end
582
+
583
+
584
+ it "builds the correct request" do
585
+ subject.restore_domain(account_id, domain_name = "example.com", {})
586
+
587
+ expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/restores")
588
+ .with(headers: { "Accept" => "application/json" })
589
+ end
590
+
591
+ it "returns the domain" do
592
+ response = subject.restore_domain(account_id, "example.com", {})
593
+ expect(response).to be_a(Dnsimple::Response)
594
+
595
+ result = response.data
596
+ expect(result).to be_a(Dnsimple::Struct::DomainRestore)
597
+ expect(result.id).to be_a(Integer)
598
+ expect(result.domain_id).to be_a(Integer)
599
+ end
600
+ end
601
+
602
+ describe "#get_domain_restore" do
603
+ let(:account_id) { 1010 }
604
+
605
+ before do
606
+ stub_request(:get, %r{/v2/#{account_id}/registrar/domains/.+/restores/.+$})
607
+ .to_return(read_http_fixture("getDomainRestore/success.http"))
608
+ end
609
+
610
+ it "builds the correct request" do
611
+ subject.get_domain_restore(account_id, domain_name = "example.com", restore_id = 361)
612
+
613
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/restores/#{restore_id}")
614
+ .with(headers: { "Accept" => "application/json" })
615
+ end
616
+
617
+ it "returns the domain restore" do
618
+ response = subject.get_domain_restore(account_id, "example.com", 361)
619
+ expect(response).to be_a(Dnsimple::Response)
620
+
621
+ result = response.data
622
+ expect(result).to be_a(Dnsimple::Struct::DomainRestore)
623
+ expect(result.id).to be_a(Integer)
624
+ expect(result.domain_id).to be_a(Integer)
625
+ end
626
+ end
574
627
  end
@@ -0,0 +1,20 @@
1
+ HTTP/1.1 201 Created
2
+ Server: nginx
3
+ Date: Fri, 09 Dec 2016 19:46:57 GMT
4
+ Content-Type: application/json; charset=utf-8
5
+ Connection: keep-alive
6
+ X-RateLimit-Limit: 2400
7
+ X-RateLimit-Remaining: 2394
8
+ X-RateLimit-Reset: 1481315245
9
+ ETag: W/"179d85ea8a26a3d5dc76e42de2d7918e"
10
+ Cache-Control: max-age=0, private, must-revalidate
11
+ X-Request-Id: ba6f2707-5df0-4ffa-b91b-51d4460bab8e
12
+ X-Runtime: 13.571302
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":{"id":1,"domain_id":999,"state":"restored","created_at":"2016-12-09T19:46:45Z","updated_at":"2016-12-12T19:46:45Z"}}
@@ -0,0 +1,20 @@
1
+ HTTP/1.1 201 Created
2
+ Server: nginx
3
+ Date: Fri, 09 Dec 2016 19:46:57 GMT
4
+ Content-Type: application/json; charset=utf-8
5
+ Connection: keep-alive
6
+ X-RateLimit-Limit: 2400
7
+ X-RateLimit-Remaining: 2394
8
+ X-RateLimit-Reset: 1481315245
9
+ ETag: W/"179d85ea8a26a3d5dc76e42de2d7918e"
10
+ Cache-Control: max-age=0, private, must-revalidate
11
+ X-Request-Id: ba6f2707-5df0-4ffa-b91b-51d4460bab8e
12
+ X-Runtime: 13.571302
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":{"id":1,"domain_id":999,"state":"new","created_at":"2016-12-09T19:46:45Z","updated_at":"2016-12-09T19:46:45Z"}}
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.8.0
4
+ version: 8.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DNSimple
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-06 00:00:00.000000000 Z
11
+ date: 2024-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -164,6 +164,7 @@ files:
164
164
  - lib/dnsimple/struct/domain_push.rb
165
165
  - lib/dnsimple/struct/domain_registration.rb
166
166
  - lib/dnsimple/struct/domain_renewal.rb
167
+ - lib/dnsimple/struct/domain_restore.rb
167
168
  - lib/dnsimple/struct/domain_transfer.rb
168
169
  - lib/dnsimple/struct/email_forward.rb
169
170
  - lib/dnsimple/struct/extended_attribute.rb
@@ -300,6 +301,7 @@ files:
300
301
  - spec/fixtures.http/getDomainPrices/success.http
301
302
  - spec/fixtures.http/getDomainRegistration/success.http
302
303
  - spec/fixtures.http/getDomainRenewal/success.http
304
+ - spec/fixtures.http/getDomainRestore/success.http
303
305
  - spec/fixtures.http/getDomainTransfer/success.http
304
306
  - spec/fixtures.http/getDomainTransferLock/success.http
305
307
  - spec/fixtures.http/getEmailForward/success.http
@@ -371,6 +373,7 @@ files:
371
373
  - spec/fixtures.http/renewWhoisPrivacy/whois-privacy-duplicated-order.http
372
374
  - spec/fixtures.http/renewWhoisPrivacy/whois-privacy-not-found.http
373
375
  - spec/fixtures.http/response.http
376
+ - spec/fixtures.http/restoreDomain/success.http
374
377
  - spec/fixtures.http/success-with-malformed-json.http
375
378
  - spec/fixtures.http/transferDomain/error-indnsimple.http
376
379
  - spec/fixtures.http/transferDomain/error-missing-authcode.http