dnsimple 4.6.0 → 5.0.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.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/.dependabot/config.yml +9 -0
  3. data/.rubocop.yml +2 -0
  4. data/.rubocop_dnsimple.yml +64 -40
  5. data/.travis.yml +1 -3
  6. data/CHANGELOG.md +34 -26
  7. data/CONTRIBUTING.md +37 -0
  8. data/Gemfile +4 -1
  9. data/LICENSE.txt +1 -1
  10. data/README.md +8 -5
  11. data/dnsimple.gemspec +3 -3
  12. data/lib/dnsimple.rb +2 -0
  13. data/lib/dnsimple/client.rb +12 -10
  14. data/lib/dnsimple/client/accounts.rb +2 -0
  15. data/lib/dnsimple/client/certificates.rb +2 -0
  16. data/lib/dnsimple/client/clients.rb +2 -0
  17. data/lib/dnsimple/client/contacts.rb +2 -0
  18. data/lib/dnsimple/client/domains.rb +2 -0
  19. data/lib/dnsimple/client/domains_collaborators.rb +2 -0
  20. data/lib/dnsimple/client/domains_delegation_signer_records.rb +2 -0
  21. data/lib/dnsimple/client/domains_dnssec.rb +2 -0
  22. data/lib/dnsimple/client/domains_email_forwards.rb +2 -0
  23. data/lib/dnsimple/client/domains_pushes.rb +2 -0
  24. data/lib/dnsimple/client/identity.rb +2 -0
  25. data/lib/dnsimple/client/oauth.rb +2 -0
  26. data/lib/dnsimple/client/registrar.rb +46 -0
  27. data/lib/dnsimple/client/registrar_auto_renewal.rb +2 -0
  28. data/lib/dnsimple/client/registrar_delegation.rb +2 -0
  29. data/lib/dnsimple/client/registrar_whois_privacy.rb +2 -0
  30. data/lib/dnsimple/client/services.rb +2 -0
  31. data/lib/dnsimple/client/services_domains.rb +2 -0
  32. data/lib/dnsimple/client/templates.rb +2 -0
  33. data/lib/dnsimple/client/templates_domains.rb +2 -0
  34. data/lib/dnsimple/client/templates_records.rb +2 -0
  35. data/lib/dnsimple/client/tlds.rb +2 -0
  36. data/lib/dnsimple/client/vanity_name_servers.rb +12 -10
  37. data/lib/dnsimple/client/webhooks.rb +2 -0
  38. data/lib/dnsimple/client/zones.rb +2 -0
  39. data/lib/dnsimple/client/zones_distributions.rb +2 -0
  40. data/lib/dnsimple/client/zones_records.rb +2 -0
  41. data/lib/dnsimple/default.rb +11 -9
  42. data/lib/dnsimple/error.rb +2 -0
  43. data/lib/dnsimple/extra.rb +2 -0
  44. data/lib/dnsimple/options.rb +2 -0
  45. data/lib/dnsimple/response.rb +6 -4
  46. data/lib/dnsimple/struct.rb +2 -0
  47. data/lib/dnsimple/struct/account.rb +2 -0
  48. data/lib/dnsimple/struct/certificate.rb +2 -0
  49. data/lib/dnsimple/struct/certificate_bundle.rb +5 -0
  50. data/lib/dnsimple/struct/certificate_purchase.rb +2 -0
  51. data/lib/dnsimple/struct/certificate_renewal.rb +2 -0
  52. data/lib/dnsimple/struct/collaborator.rb +2 -0
  53. data/lib/dnsimple/struct/contact.rb +2 -0
  54. data/lib/dnsimple/struct/delegation_signer_record.rb +2 -0
  55. data/lib/dnsimple/struct/dnssec.rb +2 -0
  56. data/lib/dnsimple/struct/domain.rb +2 -0
  57. data/lib/dnsimple/struct/domain_check.rb +2 -0
  58. data/lib/dnsimple/struct/domain_premium_price.rb +2 -0
  59. data/lib/dnsimple/struct/domain_push.rb +2 -0
  60. data/lib/dnsimple/struct/domain_registration.rb +2 -0
  61. data/lib/dnsimple/struct/domain_renewal.rb +2 -0
  62. data/lib/dnsimple/struct/domain_transfer.rb +5 -0
  63. data/lib/dnsimple/struct/email_forward.rb +2 -0
  64. data/lib/dnsimple/struct/extended_attribute.rb +2 -0
  65. data/lib/dnsimple/struct/oauth_token.rb +2 -0
  66. data/lib/dnsimple/struct/service.rb +2 -0
  67. data/lib/dnsimple/struct/template.rb +2 -0
  68. data/lib/dnsimple/struct/template_record.rb +2 -0
  69. data/lib/dnsimple/struct/tld.rb +2 -0
  70. data/lib/dnsimple/struct/user.rb +2 -0
  71. data/lib/dnsimple/struct/vanity_name_server.rb +2 -0
  72. data/lib/dnsimple/struct/webhook.rb +2 -0
  73. data/lib/dnsimple/struct/whoami.rb +2 -0
  74. data/lib/dnsimple/struct/whois_privacy.rb +2 -0
  75. data/lib/dnsimple/struct/whois_privacy_renewal.rb +2 -0
  76. data/lib/dnsimple/struct/zone.rb +2 -0
  77. data/lib/dnsimple/struct/zone_distribution.rb +2 -0
  78. data/lib/dnsimple/struct/zone_file.rb +2 -0
  79. data/lib/dnsimple/struct/zone_record.rb +2 -0
  80. data/lib/dnsimple/version.rb +3 -1
  81. data/spec/dnsimple/client/accounts_spec.rb +2 -0
  82. data/spec/dnsimple/client/certificates_spec.rb +2 -0
  83. data/spec/dnsimple/client/client_service_spec.rb +2 -0
  84. data/spec/dnsimple/client/contacts_spec.rb +2 -0
  85. data/spec/dnsimple/client/domains_collaborators_spec.rb +2 -0
  86. data/spec/dnsimple/client/domains_delegation_signer_records_spec.rb +2 -0
  87. data/spec/dnsimple/client/domains_dnssec_spec.rb +2 -0
  88. data/spec/dnsimple/client/domains_email_forwards_spec.rb +2 -0
  89. data/spec/dnsimple/client/domains_pushes_spec.rb +2 -0
  90. data/spec/dnsimple/client/domains_spec.rb +2 -0
  91. data/spec/dnsimple/client/identity_spec.rb +2 -0
  92. data/spec/dnsimple/client/oauth_spec.rb +2 -0
  93. data/spec/dnsimple/client/registrar_auto_renewal_spec.rb +2 -0
  94. data/spec/dnsimple/client/registrar_delegation_spec.rb +2 -0
  95. data/spec/dnsimple/client/registrar_spec.rb +69 -0
  96. data/spec/dnsimple/client/registrar_whois_privacy_spec.rb +2 -0
  97. data/spec/dnsimple/client/services_domains_spec.rb +2 -0
  98. data/spec/dnsimple/client/services_spec.rb +2 -0
  99. data/spec/dnsimple/client/templates_domains_spec.rb +2 -0
  100. data/spec/dnsimple/client/templates_records_spec.rb +2 -0
  101. data/spec/dnsimple/client/templates_spec.rb +2 -0
  102. data/spec/dnsimple/client/tlds_spec.rb +2 -0
  103. data/spec/dnsimple/client/vanity_name_servers_spec.rb +2 -0
  104. data/spec/dnsimple/client/webhooks_spec.rb +2 -0
  105. data/spec/dnsimple/client/zones_distributions_spec.rb +2 -0
  106. data/spec/dnsimple/client/zones_records_spec.rb +2 -0
  107. data/spec/dnsimple/client/zones_spec.rb +2 -0
  108. data/spec/dnsimple/client_spec.rb +3 -1
  109. data/spec/dnsimple/extra_spec.rb +2 -0
  110. data/spec/dnsimple/options/base_spec.rb +2 -0
  111. data/spec/dnsimple/options/list_options_spec.rb +2 -0
  112. data/spec/fixtures.http/cancelDomainTransfer/success.http +30 -0
  113. data/spec/fixtures.http/getDomainTransfer/success.http +30 -0
  114. data/spec/fixtures.http/renewWhoisPrivacy/whois-privacy-duplicated-order.http +1 -1
  115. data/spec/fixtures.http/renewWhoisPrivacy/whois-privacy-not-found.http +1 -1
  116. data/spec/spec_helper.rb +3 -1
  117. data/spec/support/helpers.rb +2 -0
  118. data/spec/support/webmock.rb +2 -0
  119. metadata +11 -13
  120. data/.ruby-gemset +0 -1
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
 
3
5
  class Error < StandardError
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Extra
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Options
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
 
3
5
  # The Response represents a response returned by a client request.
@@ -69,10 +71,10 @@ module Dnsimple
69
71
  super
70
72
 
71
73
  pagination = http_response["pagination"]
72
- @page = pagination["current_page"]
73
- @per_page = pagination["per_page"]
74
- @total_entries = pagination["total_entries"]
75
- @total_pages = pagination["total_pages"]
74
+ @page = pagination["current_page"]
75
+ @per_page = pagination["per_page"]
76
+ @total_entries = pagination["total_entries"]
77
+ @total_pages = pagination["total_pages"]
76
78
  end
77
79
 
78
80
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -8,14 +10,17 @@ module Dnsimple
8
10
 
9
11
  # @return [String] The server certificate
10
12
  attr_accessor :server
13
+
11
14
  alias server_certificate server
12
15
 
13
16
  # @return [String] The root certificate
14
17
  attr_accessor :root
18
+
15
19
  alias root_certificate root
16
20
 
17
21
  # @return [Array<String>] Intermediate certificates
18
22
  attr_accessor :chain
23
+
19
24
  alias intermediate_certificates chain
20
25
 
21
26
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -20,6 +22,9 @@ module Dnsimple
20
22
  # @return [Bool] True if the domain WHOIS privacy was requested.
21
23
  attr_accessor :whois_privacy
22
24
 
25
+ # @return [String,nil] The reason if transfer failed.
26
+ attr_accessor :status_description
27
+
23
28
  # @return [String] When the domain renewal was created in DNSimple.
24
29
  attr_accessor :created_at
25
30
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  module Struct
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
- VERSION = "4.6.0".freeze
4
+ VERSION = "5.0.0"
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Dnsimple::Client, ".accounts" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Dnsimple::Client, ".certificates" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Dnsimple::Client::ClientService do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Dnsimple::Client, ".contacts" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Dnsimple::Client, ".domains" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Dnsimple::Client, ".domains" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Dnsimple::Client, ".domains" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Dnsimple::Client, ".domains" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Dnsimple::Client, ".domains" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Dnsimple::Client, ".domains" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Dnsimple::Client, ".identity" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Dnsimple::Client, ".oauth" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Dnsimple::Client, ".registrar" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Dnsimple::Client, ".registrar" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Dnsimple::Client, ".registrar" do
@@ -212,6 +214,73 @@ describe Dnsimple::Client, ".registrar" do
212
214
  end
213
215
  end
214
216
 
217
+ describe "#get_transfer_domain" do
218
+ let(:account_id) { 1010 }
219
+
220
+ before do
221
+ stub_request(:get, %r{/v2/#{account_id}/registrar/domains/.+/transfers/.+$})
222
+ .to_return(read_http_fixture("getDomainTransfer/success.http"))
223
+ end
224
+
225
+ it "builds the correct request" do
226
+ subject.get_domain_transfer(account_id, domain_name = "example.com", transfer_id = 42)
227
+
228
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/transfers/#{transfer_id}")
229
+ .with(headers: { "Accept" => "application/json" })
230
+ end
231
+
232
+ it "returns the domain transfer" do
233
+ response = subject.get_domain_transfer(account_id, "example.com", 42)
234
+ expect(response).to be_a(Dnsimple::Response)
235
+
236
+ result = response.data
237
+ expect(result).to be_a(Dnsimple::Struct::DomainTransfer)
238
+ expect(result.id).to eq(42)
239
+ expect(result.domain_id).to eq(2)
240
+ expect(result.registrant_id).to eq(3)
241
+ expect(result.state).to eq("cancelled")
242
+ expect(result.auto_renew).to be(false)
243
+ expect(result.whois_privacy).to be(false)
244
+ expect(result.status_description).to eq("Canceled by customer")
245
+ expect(result.created_at).to eq("2020-04-27T18:08:44Z")
246
+ expect(result.updated_at).to eq("2020-04-27T18:20:01Z")
247
+ end
248
+ end
249
+
250
+ describe "#cancel_domain_transfer" do
251
+ let(:account_id) { 1010 }
252
+
253
+ before do
254
+ stub_request(:delete, %r{/v2/#{account_id}/registrar/domains/.+/transfers/.+$})
255
+ .to_return(read_http_fixture("cancelDomainTransfer/success.http"))
256
+ end
257
+
258
+ it "builds the correct request" do
259
+ subject.cancel_domain_transfer(account_id, domain_name = "example.com", transfer_id = 42)
260
+
261
+ expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/transfers/#{transfer_id}")
262
+ .with(headers: { "Accept" => "application/json" })
263
+ end
264
+
265
+ it "returns the domain transfer" do
266
+ response = subject.cancel_domain_transfer(account_id, "example.com", 42)
267
+ expect(response).to be_a(Dnsimple::Response)
268
+
269
+ result = response.data
270
+ expect(result).to be_a(Dnsimple::Struct::DomainTransfer)
271
+ expect(result.id).to eq(42)
272
+ expect(result.domain_id).to eq(6)
273
+ expect(result.registrant_id).to eq(1)
274
+ expect(result.state).to eq("transferring")
275
+ expect(result.auto_renew).to be(true)
276
+ expect(result.whois_privacy).to be(false)
277
+ expect(result.status_description).to eq(nil)
278
+ expect(result.created_at).to eq("2020-04-24T19:19:03Z")
279
+ expect(result.updated_at).to eq("2020-04-24T19:19:15Z")
280
+ end
281
+ end
282
+
283
+
215
284
  describe "#transfer_domain_out" do
216
285
  let(:account_id) { 1010 }
217
286