dnsimple 4.3.0 → 5.1.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 (143) hide show
  1. checksums.yaml +5 -5
  2. data/.dependabot/config.yml +9 -0
  3. data/.rubocop.yml +7 -0
  4. data/.rubocop_dnsimple.yml +136 -45
  5. data/.travis.yml +13 -9
  6. data/CHANGELOG.md +57 -23
  7. data/CONTRIBUTING.md +55 -7
  8. data/Gemfile +4 -1
  9. data/LICENSE.txt +1 -1
  10. data/README.md +8 -6
  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 -1
  15. data/lib/dnsimple/client/certificates.rb +188 -28
  16. data/lib/dnsimple/client/clients.rb +6 -2
  17. data/lib/dnsimple/client/contacts.rb +2 -5
  18. data/lib/dnsimple/client/domains.rb +3 -5
  19. data/lib/dnsimple/client/{collaborators.rb → domains_collaborators.rb} +3 -1
  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 +51 -5
  27. data/lib/dnsimple/client/registrar_auto_renewal.rb +2 -0
  28. data/lib/dnsimple/client/registrar_delegation.rb +6 -4
  29. data/lib/dnsimple/client/registrar_whois_privacy.rb +23 -1
  30. data/lib/dnsimple/client/services.rb +2 -2
  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 +16 -17
  36. data/lib/dnsimple/client/vanity_name_servers.rb +12 -10
  37. data/lib/dnsimple/client/webhooks.rb +2 -3
  38. data/lib/dnsimple/client/zones.rb +2 -1
  39. data/lib/dnsimple/client/zones_distributions.rb +49 -0
  40. data/lib/dnsimple/client/zones_records.rb +25 -28
  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 +7 -0
  47. data/lib/dnsimple/struct/account.rb +2 -0
  48. data/lib/dnsimple/struct/certificate.rb +11 -0
  49. data/lib/dnsimple/struct/certificate_bundle.rb +5 -0
  50. data/lib/dnsimple/struct/certificate_purchase.rb +27 -0
  51. data/lib/dnsimple/struct/certificate_renewal.rb +30 -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 +24 -3
  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 -3
  61. data/lib/dnsimple/struct/domain_renewal.rb +2 -3
  62. data/lib/dnsimple/struct/domain_transfer.rb +4 -2
  63. data/lib/dnsimple/struct/email_forward.rb +2 -0
  64. data/lib/dnsimple/struct/extended_attribute.rb +3 -1
  65. data/lib/dnsimple/struct/oauth_token.rb +2 -0
  66. data/lib/dnsimple/struct/service.rb +3 -1
  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 +27 -0
  72. data/lib/dnsimple/struct/webhook.rb +2 -0
  73. data/lib/dnsimple/struct/whoami.rb +4 -2
  74. data/lib/dnsimple/struct/whois_privacy.rb +2 -0
  75. data/lib/dnsimple/struct/whois_privacy_renewal.rb +30 -0
  76. data/lib/dnsimple/struct/zone.rb +2 -0
  77. data/lib/dnsimple/struct/zone_distribution.rb +13 -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 +227 -1
  83. data/spec/dnsimple/client/client_service_spec.rb +2 -0
  84. data/spec/dnsimple/client/contacts_spec.rb +3 -1
  85. data/spec/dnsimple/client/{collaborators_spec.rb → domains_collaborators_spec.rb} +3 -1
  86. data/spec/dnsimple/client/domains_delegation_signer_records_spec.rb +3 -1
  87. data/spec/dnsimple/client/domains_dnssec_spec.rb +4 -2
  88. data/spec/dnsimple/client/domains_email_forwards_spec.rb +3 -1
  89. data/spec/dnsimple/client/domains_pushes_spec.rb +3 -1
  90. data/spec/dnsimple/client/domains_spec.rb +19 -16
  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 +5 -2
  95. data/spec/dnsimple/client/registrar_spec.rb +73 -4
  96. data/spec/dnsimple/client/registrar_whois_privacy_spec.rb +60 -3
  97. data/spec/dnsimple/client/services_domains_spec.rb +2 -0
  98. data/spec/dnsimple/client/services_spec.rb +3 -1
  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 +22 -19
  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 +137 -0
  106. data/spec/dnsimple/client/zones_records_spec.rb +37 -35
  107. data/spec/dnsimple/client/zones_spec.rb +4 -2
  108. data/spec/dnsimple/client_spec.rb +8 -6
  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/{transferDomainOut → authorizeDomainTransferOut}/success.http +0 -0
  113. data/spec/fixtures.http/cancelDomainTransfer/success.http +19 -0
  114. data/spec/fixtures.http/checkZoneDistribution/error.http +21 -0
  115. data/spec/fixtures.http/checkZoneDistribution/failure.http +21 -0
  116. data/spec/fixtures.http/checkZoneDistribution/success.http +21 -0
  117. data/spec/fixtures.http/checkZoneRecordDistribution/error.http +21 -0
  118. data/spec/fixtures.http/checkZoneRecordDistribution/failure.http +21 -0
  119. data/spec/fixtures.http/checkZoneRecordDistribution/success.http +21 -0
  120. data/spec/fixtures.http/createDomain/created.http +21 -16
  121. data/spec/fixtures.http/getCertificate/success.http +1 -1
  122. data/spec/fixtures.http/getDomain/success.http +14 -9
  123. data/spec/fixtures.http/getDomainTransfer/success.http +21 -0
  124. data/spec/fixtures.http/issueLetsencryptCertificate/success.http +21 -0
  125. data/spec/fixtures.http/issueRenewalLetsencryptCertificate/success.http +21 -0
  126. data/spec/fixtures.http/listCertificates/success.http +1 -1
  127. data/spec/fixtures.http/listDomains/success.http +21 -16
  128. data/spec/fixtures.http/purchaseLetsencryptCertificate/success.http +21 -0
  129. data/spec/fixtures.http/purchaseRenewalLetsencryptCertificate/success.http +21 -0
  130. data/spec/fixtures.http/registerDomain/success.http +2 -2
  131. data/spec/fixtures.http/renewDomain/success.http +2 -2
  132. data/spec/fixtures.http/renewWhoisPrivacy/success.http +21 -0
  133. data/spec/fixtures.http/renewWhoisPrivacy/whois-privacy-duplicated-order.http +19 -0
  134. data/spec/fixtures.http/renewWhoisPrivacy/whois-privacy-not-found.http +19 -0
  135. data/spec/fixtures.http/transferDomain/success.http +2 -2
  136. data/spec/fixtures.http/whoami/success-account.http +1 -1
  137. data/spec/fixtures.http/whoami/success-user.http +1 -1
  138. data/spec/fixtures.http/whoami/success.http +1 -1
  139. data/spec/spec_helper.rb +4 -2
  140. data/spec/support/helpers.rb +2 -0
  141. data/spec/support/webmock.rb +2 -0
  142. metadata +50 -19
  143. data/.ruby-gemset +0 -1
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  class Client
3
5
 
@@ -137,7 +139,7 @@ module Dnsimple
137
139
  require_relative 'domains_dnssec'
138
140
  require_relative 'domains_email_forwards'
139
141
  require_relative 'domains_pushes'
140
- require_relative 'collaborators'
142
+ require_relative 'domains_collaborators'
141
143
 
142
144
  class DomainsService < ClientService
143
145
  include Client::Domains
@@ -145,7 +147,7 @@ module Dnsimple
145
147
  include Client::DomainsDnssec
146
148
  include Client::DomainsEmailForwards
147
149
  include Client::DomainsPushes
148
- include Client::Collaborators
150
+ include Client::DomainsCollaborators
149
151
  end
150
152
 
151
153
 
@@ -212,10 +214,12 @@ module Dnsimple
212
214
 
213
215
  require_relative 'zones'
214
216
  require_relative 'zones_records'
217
+ require_relative 'zones_distributions'
215
218
 
216
219
  class ZonesService < ClientService
217
220
  include Client::Zones
218
221
  include Client::ZonesRecords
222
+ include Client::ZonesDistributions
219
223
  end
220
224
 
221
225
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  class Client
3
5
  module Contacts
@@ -29,7 +31,6 @@ module Dnsimple
29
31
 
30
32
  Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Contact.new(r) })
31
33
  end
32
- alias list contacts
33
34
  alias list_contacts contacts
34
35
 
35
36
  # Lists ALL the contacts in the account.
@@ -54,7 +55,6 @@ module Dnsimple
54
55
  def all_contacts(account_id, options = {})
55
56
  paginate(:contacts, account_id, options)
56
57
  end
57
- alias all all_contacts
58
58
 
59
59
  # Creates a contact in the account.
60
60
  #
@@ -72,7 +72,6 @@ module Dnsimple
72
72
 
73
73
  Dnsimple::Response.new(response, Struct::Contact.new(response["data"]))
74
74
  end
75
- alias create create_contact
76
75
 
77
76
  # Gets a contact from the account.
78
77
  #
@@ -107,7 +106,6 @@ module Dnsimple
107
106
 
108
107
  Dnsimple::Response.new(response, Struct::Contact.new(response["data"]))
109
108
  end
110
- alias update update_contact
111
109
 
112
110
  # Deletes a contact from the account.
113
111
  #
@@ -127,7 +125,6 @@ module Dnsimple
127
125
 
128
126
  Dnsimple::Response.new(response, nil)
129
127
  end
130
- alias delete delete_contact
131
128
 
132
129
  end
133
130
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  class Client
3
5
  module Domains
@@ -14,7 +16,7 @@ module Dnsimple
14
16
  # client.domains.list(1010, page: 2)
15
17
  #
16
18
  # @example List domains, provide a sorting policy
17
- # client.domains.list(1010, sort: "expires_on:asc")
19
+ # client.domains.list(1010, sort: "expiration:asc")
18
20
  #
19
21
  # @example List domains, provide a filtering policy
20
22
  # client.domains.list(1010, filter: { name_like: "example" })
@@ -33,7 +35,6 @@ module Dnsimple
33
35
 
34
36
  Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Domain.new(r) })
35
37
  end
36
- alias list domains
37
38
  alias list_domains domains
38
39
 
39
40
  # Lists ALL the domains in the account.
@@ -59,7 +60,6 @@ module Dnsimple
59
60
  def all_domains(account_id, options = {})
60
61
  paginate(:domains, account_id, options)
61
62
  end
62
- alias all all_domains
63
63
 
64
64
  # Creates a domain in the account.
65
65
  #
@@ -78,7 +78,6 @@ module Dnsimple
78
78
 
79
79
  Dnsimple::Response.new(response, Struct::Domain.new(response["data"]))
80
80
  end
81
- alias create create_domain
82
81
 
83
82
  # Gets a domain from the account.
84
83
  #
@@ -115,7 +114,6 @@ module Dnsimple
115
114
 
116
115
  Dnsimple::Response.new(response, nil)
117
116
  end
118
- alias delete delete_domain
119
117
 
120
118
  # Resets the domain token.
121
119
  #
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  class Client
3
- module Collaborators
5
+ module DomainsCollaborators
4
6
 
5
7
  # Lists the collaborators for a domain.
6
8
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  class Client
3
5
  module DomainsDelegationSignerRecords
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  class Client
3
5
  module DomainsDnssec
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  class Client
3
5
  module DomainsEmailForwards
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  class Client
3
5
  module DomainsPushes
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  class Client
3
5
  module Identity
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  class Client
3
5
  module Oauth
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  class Client
3
5
  module Registrar
@@ -7,7 +9,7 @@ module Dnsimple
7
9
  # @see https://developer.dnsimple.com/v2/registrar/#check
8
10
  #
9
11
  # @example Check whether example.com is available:
10
- # client.registrar.check(1010, "example.com")
12
+ # client.registrar.check_domain(1010, "example.com")
11
13
  #
12
14
  # @param [Integer] account_id the account ID
13
15
  # @param [#to_s] domain_name the domain name to check
@@ -54,7 +56,7 @@ module Dnsimple
54
56
  #
55
57
  # @example Initiate the registration of example.com using the contact 1234 as registrant
56
58
  # including WHOIS privacy for the domain and enabling auto renewal:
57
- # client.registrar.register(1010, "example.com", registrant_id: 1234, private_whois: true, auto_renew: true)
59
+ # client.registrar.register_domain(1010, "example.com", registrant_id: 1234, private_whois: true, auto_renew: true)
58
60
  #
59
61
  # @param [Integer] account_id the account ID
60
62
  # @param [#to_s] domain_name the domain name to register
@@ -76,7 +78,7 @@ module Dnsimple
76
78
  # @see https://developer.dnsimple.com/v2/registrar/#renew
77
79
  #
78
80
  # @example Renew example.com for 3 years:
79
- # client.registrar.renew(1010, "example.com", period: 3)
81
+ # client.registrar.renew_domain(1010, "example.com", period: 3)
80
82
  #
81
83
  # @param [Integer] account_id the account ID
82
84
  # @param [#to_s] domain_name the domain name to renew
@@ -97,7 +99,7 @@ module Dnsimple
97
99
  # @see https://developer.dnsimple.com/v2/registrar/#transfer
98
100
  #
99
101
  # @example Initiate the transfer for example.com using the contact 1234 as registrant:
100
- # client.registrar.transfer(1010, "example.com", registrant_id: 1234, auth_code: "x1y2z3")
102
+ # client.registrar.transfer_domain(1010, "example.com", registrant_id: 1234, auth_code: "x1y2z3")
101
103
  #
102
104
  # @param [Integer] account_id the account ID
103
105
  # @param [#to_s] domain_name the domain name to transfer
@@ -114,12 +116,56 @@ module Dnsimple
114
116
  Dnsimple::Response.new(response, Struct::DomainTransfer.new(response["data"]))
115
117
  end
116
118
 
119
+ # Retrieves the details of an existing domain transfer.
120
+ #
121
+ # @see https://developer.dnsimple.com/v2/registrar/#getDomainTransfer
122
+ #
123
+ # @example Retrieve the transfer 42 for example.com:
124
+ # client.registrar.get_domain_transfer(1010, "example.com", 42)
125
+ #
126
+ # @param [Integer] account_id the account ID
127
+ # @param [#to_s] domain_name the domain name
128
+ # @param [Integer] domain_transfer_id the domain transfer ID
129
+ # @param [Hash] options
130
+ # @return [Struct::DomainTransfer]
131
+ #
132
+ # @raise [NotFoundError] When record is not found.
133
+ # @raise [RequestError] When the request fails.
134
+ def get_domain_transfer(account_id, domain_name, domain_transfer_id, options = {})
135
+ endpoint = Client.versioned("/%s/registrar/domains/%s/transfers/%s" % [account_id, domain_name, domain_transfer_id])
136
+ response = client.get(endpoint, options)
137
+
138
+ Dnsimple::Response.new(response, Struct::DomainTransfer.new(response["data"]))
139
+ end
140
+
141
+ # Cancels an in progress domain transfer.
142
+ #
143
+ # @see https://developer.dnsimple.com/v2/registrar/#cancelDomainTransfer
144
+ #
145
+ # @example Cancel the transfer 42 for example.com:
146
+ # client.registrar.cancel_domain_transfer(1010, "example.com", 42)
147
+ #
148
+ # @param [Integer] account_id the account ID
149
+ # @param [#to_s] domain_name the domain name
150
+ # @param [Integer] domain_transfer_id the domain transfer ID
151
+ # @param [Hash] options
152
+ # @return [Struct::DomainTransfer]
153
+ #
154
+ # @raise [NotFoundError] When record is not found.
155
+ # @raise [RequestError] When the request fails.
156
+ def cancel_domain_transfer(account_id, domain_name, domain_transfer_id, options = {})
157
+ endpoint = Client.versioned("/%s/registrar/domains/%s/transfers/%s" % [account_id, domain_name, domain_transfer_id])
158
+ response = client.delete(endpoint, options)
159
+
160
+ Dnsimple::Response.new(response, Struct::DomainTransfer.new(response["data"]))
161
+ end
162
+
117
163
  # Requests the transfer of a domain out of DNSimple.
118
164
  #
119
165
  # @see https://developer.dnsimple.com/v2/registrar/#transfer-out
120
166
  #
121
167
  # @example Request to transfer of example.com out of DNSimple:
122
- # client.registrar.transfer_out(1010, "example.com")
168
+ # client.registrar.transfer_domain_out(1010, "example.com")
123
169
  #
124
170
  # @param [Integer] account_id the account ID
125
171
  # @param [#to_s] domain_name the domain name to transfer out
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  class Client
3
5
  module RegistrarAutoRenewal
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  class Client
3
5
  module RegistrarDelegation
@@ -56,19 +58,19 @@ module Dnsimple
56
58
  # @param [#to_s] domain_name the domain name to check
57
59
  # @param [Array] attributes
58
60
  # @param [Hash] options
59
- # @return [Dnsimple::Response<Array>]
61
+ # @return [Dnsimple::Response<Array<Dnsimple::Struct::VanityNameServer>>]
60
62
  #
61
63
  # @raise [RequestError] When the request fails.
62
64
  def change_domain_delegation_to_vanity(account_id, domain_name, attributes, options = {})
63
65
  endpoint = Client.versioned("/%s/registrar/domains/%s/delegation/vanity" % [account_id, domain_name])
64
66
  response = client.put(endpoint, attributes, options)
65
67
 
66
- Dnsimple::Response.new(response, response["data"])
68
+ Dnsimple::Response.new(response, response["data"].map { |r| Struct::VanityNameServer.new(r) })
67
69
  end
68
70
 
69
71
  # Disable vanity name servers for the domain.
70
72
  #
71
- # @see https://developer.dnsimple.com/v2/registrar/delegation/#delegateFromVanity
73
+ # @see https://developer.dnsimple.com/v2/registrar/delegation/#dedelegateFromVanity
72
74
  #
73
75
  # @example Disable vanity name servers for example.com:
74
76
  # client.registrar.change_domain_delegation_from_vanity(1010, "example.com")
@@ -83,7 +85,7 @@ module Dnsimple
83
85
  endpoint = Client.versioned("/%s/registrar/domains/%s/delegation/vanity" % [account_id, domain_name])
84
86
  response = client.delete(endpoint, options)
85
87
 
86
- Dnsimple::Response.new(response, response["data"])
88
+ Dnsimple::Response.new(response, nil)
87
89
  end
88
90
 
89
91
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  class Client
3
5
  module RegistrarWhoisPrivacy
@@ -50,7 +52,7 @@ module Dnsimple
50
52
  # client.registrar.disable_whois_privacy(1010, "example.com")
51
53
  #
52
54
  # @param [Integer] account_id the account ID
53
- # @param [#to_s] domain_name The domain name to check.
55
+ # @param [#to_s] domain_name The domain name
54
56
  # @param [Hash] options
55
57
  # @return [Struct::WhoisPrivacy]
56
58
  #
@@ -62,6 +64,26 @@ module Dnsimple
62
64
  Dnsimple::Response.new(response, Struct::WhoisPrivacy.new(response["data"]))
63
65
  end
64
66
 
67
+ # Renews whois privacy for the domain.
68
+ #
69
+ # @see https://developer.dnsimple.com/v2/registrar/whois-privacy/#renew
70
+ #
71
+ # @example Renew whois privacy for "example.com":
72
+ # client.registrar.renew_whois_privacy(1010, "example.com")
73
+ #
74
+ # @param account_id [Integer] the account ID
75
+ # @param domain_name [#to_s] The domain name
76
+ # @param options [Hash]
77
+ # @return [Struct::WhoisPrivacy]
78
+ #
79
+ # @raise [RequestError] When the request fails.
80
+ def renew_whois_privacy(account_id, domain_name, options = {})
81
+ endpoint = whois_privacy_endpoint(account_id, domain_name) + "/renewals"
82
+ response = client.post(endpoint, nil, options)
83
+
84
+ Dnsimple::Response.new(response, Struct::WhoisPrivacyRenewal.new(response["data"]))
85
+ end
86
+
65
87
 
66
88
  private
67
89
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  class Client
3
5
  module Services
@@ -28,7 +30,6 @@ module Dnsimple
28
30
 
29
31
  Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Service.new(r) })
30
32
  end
31
- alias list services
32
33
  alias list_services services
33
34
 
34
35
  # Lists ALL the available one-click services.
@@ -55,7 +56,6 @@ module Dnsimple
55
56
  def all_services(options = {})
56
57
  paginate(:services, options)
57
58
  end
58
- alias all all_services
59
59
 
60
60
  # Gets the service with specified ID.
61
61
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  class Client
3
5
  module ServicesDomains
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  class Client
3
5
  module Templates
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  class Client
3
5
  module TemplatesDomains
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  class Client
3
5
  module TemplatesRecords
@@ -1,18 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dnsimple
2
4
  class Client
3
5
  module Tlds
4
- # Lists the tlds available for registration
6
+ # Lists the TLDs available for registration
5
7
  #
6
- # @see https://developer.dnsimple.com/v2/tlds/#list
8
+ # @see https://developer.dnsimple.com/v2/tlds/#listTlds
7
9
  #
8
10
  # @example List TLDs in the first page
9
- # client.tlds.list
11
+ # client.tlds.list_tlds
10
12
  #
11
13
  # @example List TLDs, providing a specific page
12
- # client.tlds.list(page: 2)
14
+ # client.tlds.list_tlds(page: 2)
13
15
  #
14
16
  # @example List TLDs, providing sorting policy
15
- # client.tlds.list(sort: "tld:asc")
17
+ # client.tlds.list_tlds(sort: "tld:asc")
16
18
  #
17
19
  # @param [Hash] options the filtering and sorting options
18
20
  # @option options [Integer] :page current page (pagination)
@@ -21,13 +23,11 @@ module Dnsimple
21
23
  # @return [Dnsimple::PaginatedResponse<Dnsimple::Struct::Tld>]
22
24
  #
23
25
  # @raise [Dnsimple::RequestError]
24
- def tlds(options = {})
26
+ def list_tlds(options = {})
25
27
  response = client.get(Client.versioned("/tlds"), Options::ListOptions.new(options))
26
28
 
27
29
  Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Tld.new(r) })
28
30
  end
29
- alias list tlds
30
- alias list_tlds tlds
31
31
 
32
32
  # Lists ALL the TLDs in DNSimple.
33
33
  #
@@ -37,8 +37,8 @@ module Dnsimple
37
37
  # Please use this method carefully, as fetching the entire collection will increase the number of requests
38
38
  # you send to the API server and you may eventually risk to hit the throttle limit.
39
39
  #
40
- # @see https://developer.dnsimple.com/v2/tlds/#list
41
- # @see #tlds
40
+ # @see https://developer.dnsimple.com/v2/tlds/#listTlds
41
+ # @see #list_tlds
42
42
  #
43
43
  # @example List all TLDs in DNSimple
44
44
  # client.tlds.all
@@ -51,13 +51,12 @@ module Dnsimple
51
51
  #
52
52
  # @raise [Dnsimple::RequestError]
53
53
  def all_tlds(options = {})
54
- paginate(:tlds, options)
54
+ paginate(:list_tlds, options)
55
55
  end
56
- alias all all_tlds
57
56
 
58
- # Gets a TLD's details
57
+ # Gets a TLD details
59
58
  #
60
- # @see https://developer.dnsimple.com/v2/tlds/#get
59
+ # @see https://developer.dnsimple.com/v2/tlds/#getTld
61
60
  #
62
61
  # @example Get information on a specific TLD
63
62
  # client.tlds.tld('com')
@@ -76,10 +75,10 @@ module Dnsimple
76
75
 
77
76
  # Gets the extended attributes for a TLD.
78
77
  #
79
- # @see https://developer.dnsimple.com/v2/tlds/#extended-attributes
78
+ # @see https://developer.dnsimple.com/v2/tlds/#getTldExtendedAttributes
80
79
  #
81
80
  # @example Get extended attributes for a specific TLD
82
- # client.tlds.extended_attributes('uk')
81
+ # client.tlds.tld_extended_attributes('uk')
83
82
  #
84
83
  # @param [#to_s] tld The TLD name.
85
84
  # @param [Hash] options
@@ -87,7 +86,7 @@ module Dnsimple
87
86
  #
88
87
  # @raise [Dnsimple::NotFoundError]
89
88
  # @raise [Dnsimple::RequestError]
90
- def extended_attributes(tld, options = {})
89
+ def tld_extended_attributes(tld, options = {})
91
90
  response = client.get(Client.versioned("/tlds/%s/extended_attributes" % tld), options)
92
91
 
93
92
  Dnsimple::CollectionResponse.new(response, response["data"].map { |r| Struct::ExtendedAttribute.new(r) })