dnsimple 5.0.0 → 6.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 (167) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/.rubocop.yml +4 -1
  4. data/.rubocop_dnsimple.yml +1 -23
  5. data/.rubocop_todo.yml +63 -5
  6. data/.travis.yml +7 -3
  7. data/CHANGELOG.md +17 -0
  8. data/CONTRIBUTING.md +8 -2
  9. data/Gemfile +3 -1
  10. data/LICENSE.txt +1 -1
  11. data/README.md +4 -4
  12. data/lib/dnsimple/client/domains.rb +1 -19
  13. data/lib/dnsimple/client/registrar.rb +20 -0
  14. data/lib/dnsimple/client/registrar_whois_privacy.rb +1 -1
  15. data/lib/dnsimple/client.rb +11 -3
  16. data/lib/dnsimple/default.rb +1 -1
  17. data/lib/dnsimple/extra.rb +1 -1
  18. data/lib/dnsimple/response.rb +1 -3
  19. data/lib/dnsimple/struct/certificate.rb +2 -2
  20. data/lib/dnsimple/struct/domain.rb +2 -3
  21. data/lib/dnsimple/struct/domain_price.rb +24 -0
  22. data/lib/dnsimple/struct.rb +1 -0
  23. data/lib/dnsimple/version.rb +1 -1
  24. data/spec/dnsimple/client/certificates_spec.rb +33 -33
  25. data/spec/dnsimple/client/client_service_spec.rb +1 -1
  26. data/spec/dnsimple/client/contacts_spec.rb +2 -2
  27. data/spec/dnsimple/client/domains_delegation_signer_records_spec.rb +1 -1
  28. data/spec/dnsimple/client/domains_email_forwards_spec.rb +8 -8
  29. data/spec/dnsimple/client/domains_pushes_spec.rb +2 -2
  30. data/spec/dnsimple/client/domains_spec.rb +14 -41
  31. data/spec/dnsimple/client/registrar_delegation_spec.rb +2 -2
  32. data/spec/dnsimple/client/registrar_spec.rb +62 -19
  33. data/spec/dnsimple/client/services_domains_spec.rb +2 -4
  34. data/spec/dnsimple/client/services_spec.rb +1 -3
  35. data/spec/dnsimple/client/templates_records_spec.rb +1 -1
  36. data/spec/dnsimple/client/templates_spec.rb +2 -2
  37. data/spec/dnsimple/client/webhooks_spec.rb +1 -1
  38. data/spec/dnsimple/client/zones_records_spec.rb +2 -2
  39. data/spec/dnsimple/client/zones_spec.rb +1 -1
  40. data/spec/fixtures.http/accounts/success-account.http +0 -1
  41. data/spec/fixtures.http/accounts/success-user.http +0 -1
  42. data/spec/fixtures.http/addCollaborator/invite-success.http +0 -1
  43. data/spec/fixtures.http/addCollaborator/success.http +0 -1
  44. data/spec/fixtures.http/appliedServices/success.http +0 -1
  45. data/spec/fixtures.http/cancelDomainTransfer/success.http +18 -30
  46. data/spec/fixtures.http/changeDomainDelegation/success.http +0 -1
  47. data/spec/fixtures.http/changeDomainDelegationToVanity/success.http +0 -1
  48. data/spec/fixtures.http/checkDomain/success.http +0 -1
  49. data/spec/fixtures.http/checkDomainPremiumPrice/error_400_not_a_premium_domain.http +18 -0
  50. data/spec/fixtures.http/checkDomainPremiumPrice/error_400_tld_not_supported.http +18 -0
  51. data/spec/fixtures.http/checkDomainPremiumPrice/success.http +20 -0
  52. data/spec/fixtures.http/checkZoneDistribution/error.http +0 -1
  53. data/spec/fixtures.http/checkZoneDistribution/failure.http +0 -1
  54. data/spec/fixtures.http/checkZoneDistribution/success.http +0 -1
  55. data/spec/fixtures.http/checkZoneRecordDistribution/error.http +0 -1
  56. data/spec/fixtures.http/checkZoneRecordDistribution/failure.http +0 -1
  57. data/spec/fixtures.http/checkZoneRecordDistribution/success.http +0 -1
  58. data/spec/fixtures.http/createContact/created.http +0 -1
  59. data/spec/fixtures.http/createDelegationSignerRecord/created.http +0 -1
  60. data/spec/fixtures.http/createDelegationSignerRecord/validation-error.http +0 -1
  61. data/spec/fixtures.http/createDomain/created.http +20 -16
  62. data/spec/fixtures.http/createEmailForward/created.http +21 -17
  63. data/spec/fixtures.http/createPrimaryServer/created.http +21 -0
  64. data/spec/fixtures.http/createSecondaryZone/created.http +21 -0
  65. data/spec/fixtures.http/createTemplate/created.http +0 -1
  66. data/spec/fixtures.http/createTemplateRecord/created.http +0 -1
  67. data/spec/fixtures.http/createWebhook/created.http +0 -1
  68. data/spec/fixtures.http/createZoneRecord/created-apex.http +0 -1
  69. data/spec/fixtures.http/createZoneRecord/created.http +0 -1
  70. data/spec/fixtures.http/deleteContact/error-contact-in-use.http +18 -0
  71. data/spec/fixtures.http/deleteEmailForward/success.http +12 -7
  72. data/spec/fixtures.http/disableDnssec/not-enabled.http +0 -1
  73. data/spec/fixtures.http/disableWhoisPrivacy/success.http +0 -1
  74. data/spec/fixtures.http/downloadCertificate/success.http +0 -1
  75. data/spec/fixtures.http/enableDnssec/success.http +0 -1
  76. data/spec/fixtures.http/enableVanityNameServers/success.http +0 -1
  77. data/spec/fixtures.http/enableWhoisPrivacy/created.http +0 -1
  78. data/spec/fixtures.http/enableWhoisPrivacy/success.http +0 -1
  79. data/spec/fixtures.http/getCertificate/success.http +10 -11
  80. data/spec/fixtures.http/getCertificatePrivateKey/success.http +0 -1
  81. data/spec/fixtures.http/getContact/success.http +0 -1
  82. data/spec/fixtures.http/getDelegationSignerRecord/success.http +0 -1
  83. data/spec/fixtures.http/getDnssec/success.http +0 -1
  84. data/spec/fixtures.http/getDomain/success.http +13 -9
  85. data/spec/fixtures.http/getDomainDelegation/success-empty.http +0 -1
  86. data/spec/fixtures.http/getDomainDelegation/success.http +0 -1
  87. data/spec/fixtures.http/getDomainPremiumPrice/failure.http +0 -1
  88. data/spec/fixtures.http/getDomainPremiumPrice/success.http +0 -1
  89. data/spec/fixtures.http/getDomainPrices/failure.http +19 -0
  90. data/spec/fixtures.http/getDomainPrices/success.http +21 -0
  91. data/spec/fixtures.http/getDomainTransfer/success.http +20 -30
  92. data/spec/fixtures.http/getEmailForward/success.http +14 -10
  93. data/spec/fixtures.http/getPrimaryServer/success.http +21 -0
  94. data/spec/fixtures.http/getService/success.http +0 -1
  95. data/spec/fixtures.http/getTemplate/success.http +0 -1
  96. data/spec/fixtures.http/getTemplateRecord/success.http +0 -1
  97. data/spec/fixtures.http/getTld/success.http +0 -1
  98. data/spec/fixtures.http/getTldExtendedAttributes/success-attributes.http +0 -1
  99. data/spec/fixtures.http/getTldExtendedAttributes/success-noattributes.http +0 -1
  100. data/spec/fixtures.http/getTldExtendedAttributes/success.http +0 -1
  101. data/spec/fixtures.http/getWebhook/success.http +0 -1
  102. data/spec/fixtures.http/getWhoisPrivacy/success.http +0 -1
  103. data/spec/fixtures.http/getZone/success.http +0 -1
  104. data/spec/fixtures.http/getZoneFile/success.http +0 -1
  105. data/spec/fixtures.http/getZoneRecord/success.http +0 -1
  106. data/spec/fixtures.http/initiatePush/success.http +0 -1
  107. data/spec/fixtures.http/issueLetsencryptCertificate/success.http +18 -21
  108. data/spec/fixtures.http/issueRenewalLetsencryptCertificate/success.http +18 -21
  109. data/spec/fixtures.http/linkPrimaryServer/success.http +21 -0
  110. data/spec/fixtures.http/listAccounts/success-account.http +0 -1
  111. data/spec/fixtures.http/listAccounts/success-user.http +0 -1
  112. data/spec/fixtures.http/listCertificates/success.http +10 -11
  113. data/spec/fixtures.http/listCollaborators/success.http +0 -1
  114. data/spec/fixtures.http/listContacts/success.http +0 -1
  115. data/spec/fixtures.http/listDelegationSignerRecords/success.http +0 -1
  116. data/spec/fixtures.http/listDomains/success.http +20 -16
  117. data/spec/fixtures.http/listEmailForwards/success.http +0 -1
  118. data/spec/fixtures.http/listPrimaryServers/success.http +21 -0
  119. data/spec/fixtures.http/listPushes/success.http +0 -1
  120. data/spec/fixtures.http/listServices/success.http +0 -1
  121. data/spec/fixtures.http/listTemplateRecords/success.http +0 -1
  122. data/spec/fixtures.http/listTemplates/success.http +0 -1
  123. data/spec/fixtures.http/listTlds/success.http +0 -1
  124. data/spec/fixtures.http/listWebhooks/success.http +0 -1
  125. data/spec/fixtures.http/listZoneRecords/success.http +0 -1
  126. data/spec/fixtures.http/listZones/success.http +0 -1
  127. data/spec/fixtures.http/method-not-allowed.http +0 -1
  128. data/spec/fixtures.http/notfound-certificate.http +0 -1
  129. data/spec/fixtures.http/notfound-collaborator.http +0 -1
  130. data/spec/fixtures.http/notfound-contact.http +0 -1
  131. data/spec/fixtures.http/notfound-delegationsignerrecord.http +0 -1
  132. data/spec/fixtures.http/notfound-domain.http +0 -1
  133. data/spec/fixtures.http/notfound-domainpush.http +0 -1
  134. data/spec/fixtures.http/notfound-emailforward.http +0 -1
  135. data/spec/fixtures.http/notfound-record.http +0 -1
  136. data/spec/fixtures.http/notfound-template.http +0 -1
  137. data/spec/fixtures.http/notfound-webhook.http +0 -1
  138. data/spec/fixtures.http/notfound-whoisprivacy.http +0 -1
  139. data/spec/fixtures.http/notfound-zone.http +0 -1
  140. data/spec/fixtures.http/oauthAccessToken/error-invalid-request.http +0 -1
  141. data/spec/fixtures.http/oauthAccessToken/success.http +0 -1
  142. data/spec/fixtures.http/pages-1of3.http +0 -1
  143. data/spec/fixtures.http/pages-2of3.http +0 -1
  144. data/spec/fixtures.http/pages-3of3.http +0 -1
  145. data/spec/fixtures.http/purchaseLetsencryptCertificate/success.http +20 -21
  146. data/spec/fixtures.http/purchaseRenewalLetsencryptCertificate/success.http +20 -21
  147. data/spec/fixtures.http/registerDomain/success.http +1 -2
  148. data/spec/fixtures.http/renewDomain/error-tooearly.http +0 -1
  149. data/spec/fixtures.http/renewDomain/success.http +1 -2
  150. data/spec/fixtures.http/renewWhoisPrivacy/success.http +0 -1
  151. data/spec/fixtures.http/renewWhoisPrivacy/whois-privacy-duplicated-order.http +0 -1
  152. data/spec/fixtures.http/renewWhoisPrivacy/whois-privacy-not-found.http +0 -1
  153. data/spec/fixtures.http/response.http +0 -1
  154. data/spec/fixtures.http/transferDomain/error-indnsimple.http +0 -1
  155. data/spec/fixtures.http/transferDomain/error-missing-authcode.http +0 -1
  156. data/spec/fixtures.http/transferDomain/success.http +1 -2
  157. data/spec/fixtures.http/unlinkPrimaryServer/success.http +21 -0
  158. data/spec/fixtures.http/updateContact/success.http +0 -1
  159. data/spec/fixtures.http/updateTemplate/success.http +0 -1
  160. data/spec/fixtures.http/updateZoneRecord/success.http +0 -1
  161. data/spec/fixtures.http/validation-error.http +0 -1
  162. data/spec/fixtures.http/whoami/success-account.http +0 -1
  163. data/spec/fixtures.http/whoami/success-user.http +0 -1
  164. data/spec/fixtures.http/whoami/success.http +0 -1
  165. data/spec/spec_helper.rb +1 -1
  166. metadata +31 -8
  167. data/spec/fixtures.http/resetDomainToken/success.http +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab6c994d5800e178144ce47b8be27dfb7b7e9414457b133fda7ad76eebac7236
4
- data.tar.gz: '08f39ba56093182666f5bf838c9cc5e2c3337971de7691c2e34670bbdba6f91d'
3
+ metadata.gz: a4f667eba7dc3bc3e7718657059de2cc752f966d748b0698326feefad1f93111
4
+ data.tar.gz: 82eabdcd7a27df808db076d4d65bfb196343c3aa607e42d61ba1ff8f7b328349
5
5
  SHA512:
6
- metadata.gz: a77416c5e9a16f301f0819bed9e15e7555ab85a1461fa35a7b761f803a68c362a44da42cffa50cd29ae720cbec6d7be045c45cda2438cbfb71131cf7ea3ba858
7
- data.tar.gz: 7180a39ea3751190263096a7ac0bf845b04f5518cc768a2debc4f4d054c6a0310f1aef82aebfd13f8d23761b93d56ff01b16bf9df24f1c0265a73741970cb820
6
+ metadata.gz: 8ee87e28d8fd2fef38a9282905146831321e9a443c08216e2399fc577ba957da835df45d8a31052a4c8a12c7db2373ad8b96ed0b7a86072de20b6c2772b3e56c
7
+ data.tar.gz: dae840d8c7d5f3c86af8f959ba07b5310f6e852e351b84c42166621e181de41604fb1d43be6ffe1c651002840f37dcc3b16eebadf6c9beed90d1c46e9f693aa5
data/.gitignore CHANGED
@@ -7,3 +7,6 @@ Gemfile.lock
7
7
  .yardoc
8
8
  yardoc/
9
9
  doc/
10
+
11
+ #ASDF
12
+ .tool-versions
data/.rubocop.yml CHANGED
@@ -2,7 +2,10 @@ inherit_from:
2
2
  - .rubocop_todo.yml
3
3
  - .rubocop_dnsimple.yml
4
4
 
5
- require: rubocop-performance
5
+ require:
6
+ - rubocop-performance
7
+ - rubocop-rake
8
+ - rubocop-rspec
6
9
 
7
10
  AllCops:
8
11
  Exclude:
@@ -8,6 +8,7 @@ AllCops:
8
8
  Exclude:
9
9
  # Exclude .gemspec files because they are generally auto-generated
10
10
  - '*.gemspec'
11
+ NewCops: enable
11
12
 
12
13
  # In most cases, Gems are sorted alphabetically.
13
14
  # However, in some few cases the order is relevant due to dependencies.
@@ -377,26 +378,3 @@ Layout/MultilineOperationIndentation:
377
378
  #
378
379
  Layout/SpaceInsidePercentLiteralDelimiters:
379
380
  Enabled: false
380
-
381
-
382
- # New cops
383
- # We'll remove them once they become defaults.
384
- # See https://docs.rubocop.org/en/latest/versioning/
385
-
386
- Layout/SpaceAroundMethodCallOperator:
387
- Enabled: true
388
-
389
- Lint/RaiseException:
390
- Enabled: true
391
-
392
- Lint/StructNewOverride:
393
- Enabled: true
394
-
395
- Style/ExponentialNotation:
396
- Enabled: true
397
-
398
- Layout/EmptyLinesAroundAttributeAccessor:
399
- Enabled: true
400
-
401
- Style/SlicingWithRange:
402
- Enabled: true
data/.rubocop_todo.yml CHANGED
@@ -1,14 +1,72 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-03-27 01:01:12 +0100 using RuboCop version 0.38.0.
3
+ # on 2021-04-05 15:23:33 UTC using RuboCop version 1.12.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- Style/Documentation:
10
- # Silence this check for now until we fix it.
9
+ # Offense count: 6
10
+ # Configuration parameters: Prefixes.
11
+ # Prefixes: when, with, without
12
+ RSpec/ContextWording:
13
+ Exclude:
14
+ - 'spec/dnsimple/client/domains_collaborators_spec.rb'
15
+ - 'spec/dnsimple/options/list_options_spec.rb'
16
+
17
+ # Offense count: 70
18
+ # Configuration parameters: Max.
19
+ RSpec/ExampleLength:
11
20
  Enabled: false
21
+
22
+ # Offense count: 1
23
+ RSpec/LeakyConstantDeclaration:
12
24
  Exclude:
13
- - 'spec/**/*'
14
- - 'test/**/*'
25
+ - 'spec/dnsimple/client/client_service_spec.rb'
26
+
27
+ # Offense count: 21
28
+ # Configuration parameters: .
29
+ # SupportedStyles: have_received, receive
30
+ RSpec/MessageSpies:
31
+ EnforcedStyle: receive
32
+
33
+ # Offense count: 117
34
+ RSpec/MultipleExpectations:
35
+ Max: 16
36
+
37
+ # Offense count: 374
38
+ # Configuration parameters: IgnoreSharedExamples.
39
+ RSpec/NamedSubject:
40
+ Enabled: false
41
+
42
+ # Offense count: 10
43
+ RSpec/StubbedMock:
44
+ Exclude:
45
+ - 'spec/dnsimple/client_spec.rb'
46
+
47
+ # Offense count: 16
48
+ RSpec/SubjectStub:
49
+ Exclude:
50
+ - 'spec/dnsimple/client/certificates_spec.rb'
51
+ - 'spec/dnsimple/client/contacts_spec.rb'
52
+ - 'spec/dnsimple/client/domains_delegation_signer_records_spec.rb'
53
+ - 'spec/dnsimple/client/domains_email_forwards_spec.rb'
54
+ - 'spec/dnsimple/client/domains_spec.rb'
55
+ - 'spec/dnsimple/client/services_spec.rb'
56
+ - 'spec/dnsimple/client/templates_records_spec.rb'
57
+ - 'spec/dnsimple/client/templates_spec.rb'
58
+ - 'spec/dnsimple/client/tlds_spec.rb'
59
+ - 'spec/dnsimple/client/zones_records_spec.rb'
60
+ - 'spec/dnsimple/client/zones_spec.rb'
61
+ - 'spec/dnsimple/client_spec.rb'
62
+
63
+ # Offense count: 5
64
+ # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
65
+ RSpec/VerifiedDoubles:
66
+ Exclude:
67
+ - 'spec/dnsimple/client_spec.rb'
68
+
69
+ # Offense count: 39
70
+ # Configuration parameters: AllowedConstants.
71
+ Style/Documentation:
72
+ Enabled: false
data/.travis.yml CHANGED
@@ -5,13 +5,17 @@ rvm:
5
5
  - 2.5
6
6
  - 2.6
7
7
  - 2.7
8
+ - 3.0
9
+ - ruby-head
10
+
11
+ matrix:
12
+ allow_failures:
13
+ - rvm: ruby-head
8
14
 
9
15
  env:
10
16
  - COVERALL=1
11
17
 
12
- before_install:
13
- - gem install bundler -v 1.17.3
14
-
15
18
  notifications:
19
+ email: false
16
20
  slack:
17
21
  secure: "N9zPR5jnF1TBiqvb3mCV6Wem3TIvqu4tXiob2P66vBMwmj1ewWvyUzNLwAEOCDc3mRfsI50IYXHewckAUpCWW7XEJlT/pv8llMsoiHqArb7SGJyDdy3ZRr35L7glixs/ikod+xhRKXMM3jML/2MgSa+Culzhl42tMUFDk+bBBQU="
data/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  This project uses [Semantic Versioning 2.0.0](http://semver.org/).
4
4
 
5
+ ## main
6
+
7
+ ## 6.0.0
8
+
9
+ - NEW: Added `registrar.get_domain_prices` to retrieve whether a domain is premium and the prices to register, transfer, and renew. (dnsimple/dnsimple-ruby#230)
10
+ - REMOVED: `domain.reset_domain_token` endpoint no longer exists and the client method is removed.
11
+ (dnsimple/dnsimple-ruby#231)
12
+ - REMOVED: The deprecated `Domain.expires_on` is removed. (dnsimple/dnsimple-ruby#232)
13
+ - REMOVED: The deprecated `Certificate.expires_on` is removed. (dnsimple/dnsimple-ruby#232)
14
+
15
+ ## 5.2.0
16
+
17
+ - CHANGED: `Certificate#expires_on` (date only) is deprecated in favor of `Certificate#expires_at` (timestamp). (dnsimple/dnsimple-ruby#190)
18
+
19
+ ## 5.1.0
20
+
21
+ - CHANGED: `Domain#expires_on` (date only) is deprecated in favor of `Domain#expires_at` (timestamp). (dnsimple/dnsimple-ruby#186)
5
22
 
6
23
  ## 5.0.0
7
24
 
data/CONTRIBUTING.md CHANGED
@@ -36,13 +36,13 @@ The following instructions uses `$VERSION` as a placeholder, where `$VERSION` is
36
36
 
37
37
  1. Run the test suite and ensure all the tests pass.
38
38
 
39
- 1. Finalize the `## master` section in `CHANGELOG.md` assigning the version.
39
+ 1. Finalize the `## main` section in `CHANGELOG.md` assigning the version.
40
40
 
41
41
  1. Commit and push the changes
42
42
 
43
43
  ```shell
44
44
  git commit -a -m "Release $VERSION"
45
- git push origin master
45
+ git push origin main
46
46
  ```
47
47
 
48
48
  1. Wait for CI to complete.
@@ -54,6 +54,12 @@ The following instructions uses `$VERSION` as a placeholder, where `$VERSION` is
54
54
  git push origin --tags
55
55
  ```
56
56
 
57
+ 1. Build the package.
58
+
59
+ ```shell
60
+ rake build
61
+ ```
62
+
57
63
  1. Release to RubyGems.
58
64
 
59
65
  ```shell
data/Gemfile CHANGED
@@ -5,5 +5,7 @@ source 'https://rubygems.org'
5
5
  gemspec
6
6
 
7
7
  gem 'coveralls', require: false
8
- gem 'rubocop', '0.83.0', require: false
8
+ gem 'rubocop', '1.12.1', require: false
9
9
  gem 'rubocop-performance', require: false
10
+ gem 'rubocop-rake', require: false
11
+ gem 'rubocop-rspec', require: false
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2010-2020 DNSimple Corporation
3
+ Copyright (c) 2010-2021 DNSimple Corporation
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  A Ruby client for the [DNSimple API v2](https://developer.dnsimple.com/v2/).
4
4
 
5
- [![Build Status](https://travis-ci.com/dnsimple/dnsimple-ruby.svg?branch=master)](https://travis-ci.com/dnsimple/dnsimple-ruby)
6
- [![Coverage Status](https://img.shields.io/coveralls/dnsimple/dnsimple-ruby.svg)](https://coveralls.io/r/dnsimple/dnsimple-ruby?branch=master)
5
+ [![Build Status](https://travis-ci.com/dnsimple/dnsimple-ruby.svg?branch=main)](https://travis-ci.com/dnsimple/dnsimple-ruby)
6
+ [![Coverage Status](https://img.shields.io/coveralls/dnsimple/dnsimple-ruby.svg)](https://coveralls.io/r/dnsimple/dnsimple-ruby?branch=main)
7
7
 
8
8
  [DNSimple](https://dnsimple.com/) provides DNS hosting and domain registration that is simple and friendly.
9
9
  We provide a full API and an easy-to-use web interface so you can get your domain registered and set up with a minimal amount of effort.
@@ -20,7 +20,7 @@ gem install dnsimple
20
20
  Or use Bundler and define it as a dependency in your Gemfile:
21
21
 
22
22
  ```
23
- gem 'dnsimple', '~> 4.0'
23
+ gem 'dnsimple', '~> 6.0'
24
24
  ```
25
25
 
26
26
  ## Usage
@@ -90,4 +90,4 @@ We recommend to customize the user agent. If you are building a library or integ
90
90
 
91
91
  ## License
92
92
 
93
- Copyright (c) 2010-2020 DNSimple Corporation. This is Free Software distributed under the MIT license.
93
+ Copyright (c) 2010-2021 DNSimple Corporation. This is Free Software distributed under the MIT license.
@@ -16,7 +16,7 @@ module Dnsimple
16
16
  # client.domains.list(1010, page: 2)
17
17
  #
18
18
  # @example List domains, provide a sorting policy
19
- # client.domains.list(1010, sort: "expires_on:asc")
19
+ # client.domains.list(1010, sort: "expiration:asc")
20
20
  #
21
21
  # @example List domains, provide a filtering policy
22
22
  # client.domains.list(1010, filter: { name_like: "example" })
@@ -114,24 +114,6 @@ module Dnsimple
114
114
 
115
115
  Dnsimple::Response.new(response, nil)
116
116
  end
117
-
118
- # Resets the domain token.
119
- #
120
- # @see https://developer.dnsimple.com/v2/domains/#reset-token
121
- #
122
- # @param [Integer] account_id the account ID
123
- # @param [#to_s] domain_id The domain ID or domain name
124
- # @param [Hash] options
125
- # @return [Dnsimple::Response<nil>]
126
- #
127
- # @raise [Dnsimple::NotFoundError]
128
- # @raise [Dnsimple::RequestError]
129
- def reset_domain_token(account_id, domain_id, options = {})
130
- response = client.post(Client.versioned("/%s/domains/%s/token" % [account_id, domain_id]), nil, options)
131
-
132
- Dnsimple::Response.new(response, Struct::Domain.new(response["data"]))
133
- end
134
-
135
117
  end
136
118
  end
137
119
  end
@@ -50,6 +50,26 @@ module Dnsimple
50
50
  Dnsimple::Response.new(response, Struct::DomainPremiumPrice.new(response["data"]))
51
51
  end
52
52
 
53
+ # Get prices for a domain.
54
+ # @see https://developer.dnsimple.com/v2/registrar/#getDomainPrices
55
+ #
56
+ # @example Check prices for example.com:
57
+ # client.registrar.get_domain_prices(1010, "example.com")
58
+ #
59
+ # @param [Integer] account_id the Account id
60
+ # @param [String] domain_name the domain name to find the prices
61
+ # @param [Hash] options
62
+ #
63
+ # @return [Struct::DomainPrice]
64
+ #
65
+ # @raise [RequestError] When the request fails.
66
+ def get_domain_prices(account_id, domain_name, options = {})
67
+ endpoint = Client.versioned("/%s/registrar/domains/%s/prices" % [account_id, domain_name])
68
+ response = client.get(endpoint, options)
69
+
70
+ Dnsimple::Response.new(response, Struct::DomainPrice.new(response["data"]))
71
+ end
72
+
53
73
  # Registers a domain.
54
74
  #
55
75
  # @see https://developer.dnsimple.com/v2/registrar/#register
@@ -78,7 +78,7 @@ module Dnsimple
78
78
  #
79
79
  # @raise [RequestError] When the request fails.
80
80
  def renew_whois_privacy(account_id, domain_name, options = {})
81
- endpoint = whois_privacy_endpoint(account_id, domain_name) + "/renewals"
81
+ endpoint = "#{whois_privacy_endpoint(account_id, domain_name)}/renewals"
82
82
  response = client.post(endpoint, nil, options)
83
83
 
84
84
  Dnsimple::Response.new(response, Struct::WhoisPrivacyRenewal.new(response["data"]))
@@ -42,22 +42,30 @@ module Dnsimple
42
42
  # @!attribute username
43
43
  # @see https://developer.dnsimple.com/v2/#authentication
44
44
  # @return [String] DNSimple username for Basic Authentication
45
+ attr_accessor :username
46
+
45
47
  # @!attribute password
46
48
  # @see https://developer.dnsimple.com/v2/#authentication
47
49
  # @return [String] DNSimple password for Basic Authentication
50
+ attr_accessor :password
51
+
48
52
  # @!attribute domain_api_token
49
53
  # @see https://developer.dnsimple.com/v2/#authentication
50
54
  # @return [String] Domain API access token for authentication
55
+ attr_accessor :domain_api_token
56
+
51
57
  # @!attribute access_token
52
58
  # @see https://developer.dnsimple.com/v2/#authentication
53
59
  # @return [String] Domain API access token for authentication
60
+ attr_accessor :access_token
61
+
54
62
  # @!attribute user_agent
55
63
  # @return [String] Configure User-Agent header for requests.
64
+ attr_accessor :user_agent
65
+
56
66
  # @!attribute proxy
57
67
  # @return [String,nil] Configure address:port values for proxy server
58
-
59
- attr_accessor :username, :password, :domain_api_token, :access_token,
60
- :user_agent, :proxy
68
+ attr_accessor :proxy
61
69
 
62
70
 
63
71
  def initialize(options = {})
@@ -30,7 +30,7 @@ module Dnsimple
30
30
  # Configuration options
31
31
  # @return [Hash]
32
32
  def options
33
- Hash[keys.map { |key| [key, send(key)] }]
33
+ keys.map { |key| [key, send(key)] }.to_h
34
34
  end
35
35
 
36
36
  # Default API endpoint from ENV or {BASE_URL}
@@ -36,7 +36,7 @@ module Dnsimple
36
36
  this[current_key] = if this_value.is_a?(Hash) && other_value.is_a?(Hash)
37
37
  deep_merge(this_value, other_value, &block)
38
38
  else
39
- if block_given? && key?(current_key)
39
+ if block && key?(current_key)
40
40
  block.call(current_key, this_value, other_value)
41
41
  else
42
42
  other_value
@@ -41,9 +41,7 @@ module Dnsimple
41
41
 
42
42
  # The CollectionResponse is a specific type of Response where the data is a collection of enumerable objects.
43
43
  class CollectionResponse < Response
44
- def initialize(http_response, collection)
45
- super
46
- end
44
+
47
45
  end
48
46
 
49
47
  # The PaginatedResponse is a specific type of Response that also exposes pagination metadata.
@@ -40,8 +40,8 @@ module Dnsimple
40
40
  # @return [String] When the certificate was last updated in DNSimple.
41
41
  attr_accessor :updated_at
42
42
 
43
- # @return [String] When the certificate will expire.
44
- attr_accessor :expires_on
43
+ # @return [String] The timestamp when the certificate will expire.
44
+ attr_accessor :expires_at
45
45
  end
46
46
 
47
47
  end
@@ -28,8 +28,8 @@ module Dnsimple
28
28
  # @return [Bool] True if the domain WHOIS privacy is enabled, false otherwise.
29
29
  attr_accessor :private_whois
30
30
 
31
- # @return [String] The date the domain will expire.
32
- attr_accessor :expires_on
31
+ # @return [String] The timestamp when domain will expire.
32
+ attr_accessor :expires_at
33
33
 
34
34
  # @return [String] When the domain was created in DNSimple.
35
35
  attr_accessor :created_at
@@ -37,6 +37,5 @@ module Dnsimple
37
37
  # @return [String] When the domain was last updated in DNSimple.
38
38
  attr_accessor :updated_at
39
39
  end
40
-
41
40
  end
42
41
  end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dnsimple
4
+ module Struct
5
+
6
+ class DomainPrice < Base
7
+ # @return [String] The domain name
8
+ attr_accessor :domain
9
+
10
+ # @return [Boolean] Whether the domain is premium.
11
+ attr_accessor :premium
12
+
13
+ # @return [Float] The price for registration
14
+ attr_accessor :registration_price
15
+
16
+ # @return [Float] The price for renewal
17
+ attr_accessor :renewal_price
18
+
19
+ # @return [Float] The price for transfer
20
+ attr_accessor :transfer_price
21
+ end
22
+
23
+ end
24
+ end
@@ -27,6 +27,7 @@ require_relative 'struct/dnssec'
27
27
  require_relative 'struct/domain'
28
28
  require_relative 'struct/domain_check'
29
29
  require_relative 'struct/domain_premium_price'
30
+ require_relative 'struct/domain_price'
30
31
  require_relative 'struct/domain_push'
31
32
  require_relative 'struct/domain_registration'
32
33
  require_relative 'struct/domain_transfer'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dnsimple
4
- VERSION = "5.0.0"
4
+ VERSION = "6.0.0"
5
5
  end
@@ -65,7 +65,7 @@ describe Dnsimple::Client, ".certificates" do
65
65
  end
66
66
 
67
67
  let(:account_id) { 1010 }
68
- let(:domain_id) { "example.com" }
68
+ let(:domain_id) { "dnsimple.us" }
69
69
 
70
70
  it "delegates to client.paginate" do
71
71
  expect(subject).to receive(:paginate).with(:certificates, account_id, domain_id, foo: "bar")
@@ -73,16 +73,16 @@ describe Dnsimple::Client, ".certificates" do
73
73
  end
74
74
 
75
75
  it "supports sorting" do
76
- subject.all_certificates(account_id, domain_id, sort: "id:asc,expires_on:desc")
76
+ subject.all_certificates(account_id, domain_id, sort: "id:asc,expiration:desc")
77
77
 
78
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/certificates?page=1&per_page=100&sort=id:asc,expires_on:desc")
78
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/certificates?page=1&per_page=100&sort=id:asc,expiration:desc")
79
79
  end
80
80
  end
81
81
 
82
82
  describe "#certificate" do
83
83
  let(:account_id) { 1010 }
84
- let(:domain_id) { "weppos.net" }
85
- let(:certificate_id) { 1 }
84
+ let(:domain_id) { "bingo.pizza" }
85
+ let(:certificate_id) { 101967 }
86
86
 
87
87
  before do
88
88
  stub_request(:get, %r{/v2/#{account_id}/domains/#{domain_id}/certificates/#{certificate_id}})
@@ -108,19 +108,19 @@ describe Dnsimple::Client, ".certificates" do
108
108
 
109
109
  result = response.data
110
110
  expect(result).to be_a(Dnsimple::Struct::Certificate)
111
- expect(result.id).to eq(1)
112
- expect(result.domain_id).to eq(2)
113
- expect(result.contact_id).to eq(3)
114
- expect(result.common_name).to eq("www.weppos.net")
115
- expect(result.alternate_names).to eq(%w( weppos.net www.weppos.net ))
111
+ expect(result.id).to eq(101967)
112
+ expect(result.domain_id).to eq(289333)
113
+ expect(result.contact_id).to eq(2511)
114
+ expect(result.common_name).to eq("www.bingo.pizza")
115
+ expect(result.alternate_names).to eq([])
116
116
  expect(result.years).to eq(1)
117
- expect(result.csr).to eq("-----BEGIN CERTIFICATE REQUEST-----\nMIICljCCAX4CAQAwGTEXMBUGA1UEAwwOd3d3LndlcHBvcy5uZXQwggEiMA0GCSqG\nSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3MJwx9ahBG3kAwRjQdRvYZqtovUaxY6jp\nhd09975gO+2eYPDbc1yhNftVJ4KBT0zdEqzX0CwIlxE1MsnZ2YOsC7IJO531hMBp\ndBxM4tSG07xPz70AVUi9rY6YCUoJHmxoFbclpHFbtXZocR393WyzUK8047uM2mlz\n03AZKcMdyfeuo2/9TcxpTSCkklGqwqS9wtTogckaDHJDoBunAkMioGfOSMe7Yi6E\nYRtG4yPJYsDaq2yPJWV8+i0PFR1Wi5RCnPt0YdQWstHuZrxABi45+XVkzKtz3TUc\nYxrvPBucVa6uzd953u8CixNFkiOefvb/dajsv1GIwH6/Cvc1ftz1AgMBAAGgODA2\nBgkqhkiG9w0BCQ4xKTAnMCUGA1UdEQQeMByCDnd3dy53ZXBwb3MubmV0ggp3ZXBw\nb3MubmV0MA0GCSqGSIb3DQEBCwUAA4IBAQCDnVBO9RdJX0eFeZzlv5c8yG8duhKP\nl0Vl+V88fJylb/cbNj9qFPkKTK0vTXmS2XUFBChKPtLucp8+Z754UswX+QCsdc7U\nTTSG0CkyilcSubdZUERGej1XfrVQhrokk7Fu0Jh3BdT6REP0SIDTpA8ku/aRQiAp\np+h19M37S7+w/DMGDAq2LSX8jOpJ1yIokRDyLZpmwyLxutC21DXMGoJ3xZeUFrUT\nqRNwzkn2dJzgTrPkzhaXalUBqv+nfXHqHaWljZa/O0NVCFrHCdTdd53/6EE2Yabv\nq5SFTkRCpaxrvM/7a8Tr4ixD1/VKD6rw3+WC00000000000000000000\n-----END CERTIFICATE REQUEST-----\n")
117
+ expect(result.csr).to eq("-----BEGIN CERTIFICATE REQUEST-----\nMIICmTCCAYECAQAwGjEYMBYGA1UEAwwPd3d3LmJpbmdvLnBpenphMIIBIjANBgkq\nhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAw4+KoZ9IDCK2o5qAQpi+Icu5kksmjQzx\n5o5g4B6XhRxhsfHlK/i3iU5hc8CONjyVv8j82835RNsiKrflnxGa9SH68vbQfcn4\nIpbMz9c+Eqv5h0Euqlc3A4DBzp0unEu5QAUhR6Xu1TZIWDPjhrBOGiszRlLQcp4F\nzy6fD6j5/d/ylpzTp5v54j+Ey31Bz86IaBPtSpHI+Qk87Hs8DVoWxZk/6RlAkyur\nXDGWnPu9n3RMfs9ag5anFhggLIhCNtVN4+0vpgPQ59pqwYo8TfdYzK7WSKeL7geu\nCqVE3bHAqU6dLtgHOZfTkLwGycUh4p9aawuc6fsXHHYDpIL8s3vAvwIDAQABoDow\nOAYJKoZIhvcNAQkOMSswKTAnBgNVHREEIDAeggtiaW5nby5waXp6YYIPd3d3LmJp\nbmdvLnBpenphMA0GCSqGSIb3DQEBCwUAA4IBAQBwOLKv+PO5hSJkgqS6wL/wRqLh\nQ1zbcHRHAjRjnpRz06cDvN3X3aPI+lpKSNFCI0A1oKJG7JNtgxX3Est66cuO8ESQ\nPIb6WWN7/xlVlBCe7ZkjAFgN6JurFdclwCp/NI5wBCwj1yb3Ar5QQMFIZOezIgTI\nAWkQSfCmgkB96d6QlDWgidYDDjcsXugQveOQRPlHr0TsElu47GakxZdJCFZU+WPM\nodQQf5SaqiIK2YaH1dWO//4KpTS9QoTy1+mmAa27apHcmz6X6+G5dvpHZ1qH14V0\nJoMWIK+39HRPq6mDo1UMVet/xFUUrG/H7/tFlYIDVbSpVlpVAFITd/eQkaW/\n-----END CERTIFICATE REQUEST-----\n")
118
118
  expect(result.state).to eq("issued")
119
119
  expect(result.authority_identifier).to eq("letsencrypt")
120
120
  expect(result.auto_renew).to be(false)
121
- expect(result.created_at).to eq("2016-06-11T18:47:08Z")
122
- expect(result.updated_at).to eq("2016-06-11T18:47:37Z")
123
- expect(result.expires_on).to eq("2016-09-09")
121
+ expect(result.created_at).to eq("2020-06-18T18:54:17Z")
122
+ expect(result.updated_at).to eq("2020-06-18T19:10:14Z")
123
+ expect(result.expires_at).to eq("2020-09-16T18:10:13Z")
124
124
  end
125
125
 
126
126
  context "when the certificate does not exist" do
@@ -231,7 +231,7 @@ describe Dnsimple::Client, ".certificates" do
231
231
 
232
232
  describe "#purchase_letsencrypt_certificate" do
233
233
  let(:account_id) { 1010 }
234
- let(:domain_id) { "example.com" }
234
+ let(:domain_id) { "bingo.pizza" }
235
235
  let(:contact_id) { 100 }
236
236
 
237
237
  before do
@@ -264,9 +264,9 @@ describe Dnsimple::Client, ".certificates" do
264
264
  result = response.data
265
265
  expect(result).to be_a(Dnsimple::Struct::CertificatePurchase)
266
266
 
267
- expect(result.id).to eq(300)
268
- expect(result.certificate_id).to eq(300)
269
- expect(result.state).to eq("requesting")
267
+ expect(result.id).to eq(101967)
268
+ expect(result.certificate_id).to eq(101967)
269
+ expect(result.state).to eq("new")
270
270
  expect(result.auto_renew).to be(false)
271
271
  end
272
272
 
@@ -284,8 +284,8 @@ describe Dnsimple::Client, ".certificates" do
284
284
 
285
285
  describe "#issue_letsencrypt_certificate" do
286
286
  let(:account_id) { 1010 }
287
- let(:domain_id) { "example.com" }
288
- let(:certificate_id) { 200 }
287
+ let(:domain_id) { "bingo.pizza" }
288
+ let(:certificate_id) { 101967 }
289
289
 
290
290
  before do
291
291
  stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/certificates/letsencrypt/#{certificate_id}/issue})
@@ -306,9 +306,9 @@ describe Dnsimple::Client, ".certificates" do
306
306
  result = response.data
307
307
  expect(result).to be_a(Dnsimple::Struct::Certificate)
308
308
 
309
- expect(result.id).to eq(200)
310
- expect(result.domain_id).to eq(300)
311
- expect(result.common_name).to eq("www.example.com")
309
+ expect(result.id).to eq(101967)
310
+ expect(result.domain_id).to eq(289333)
311
+ expect(result.common_name).to eq("www.bingo.pizza")
312
312
  expect(result.alternate_names).to eq([])
313
313
  expect(result.years).to eq(1)
314
314
  expect(result.csr).to be(nil)
@@ -342,8 +342,8 @@ describe Dnsimple::Client, ".certificates" do
342
342
 
343
343
  describe "#purchase_letsencrypt_certificate_renewal" do
344
344
  let(:account_id) { 1010 }
345
- let(:domain_id) { "example.com" }
346
- let(:certificate_id) { 200 }
345
+ let(:domain_id) { "bingo.pizza" }
346
+ let(:certificate_id) { 101967 }
347
347
 
348
348
  before do
349
349
  stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/certificates/letsencrypt/#{certificate_id}/renewals})
@@ -373,9 +373,9 @@ describe Dnsimple::Client, ".certificates" do
373
373
  result = response.data
374
374
  expect(result).to be_a(Dnsimple::Struct::CertificateRenewal)
375
375
 
376
- expect(result.id).to eq(999)
376
+ expect(result.id).to eq(65082)
377
377
  expect(result.old_certificate_id).to eq(certificate_id)
378
- expect(result.new_certificate_id).to eq(300)
378
+ expect(result.new_certificate_id).to eq(101972)
379
379
  expect(result.state).to eq("new")
380
380
  end
381
381
 
@@ -393,9 +393,9 @@ describe Dnsimple::Client, ".certificates" do
393
393
 
394
394
  describe "#issue_letsencrypt_certificate_renewal" do
395
395
  let(:account_id) { 1010 }
396
- let(:domain_id) { "example.com" }
397
- let(:certificate_id) { 300 }
398
- let(:certificate_renewal_id) { 999 }
396
+ let(:domain_id) { "bingo.pizza" }
397
+ let(:certificate_id) { 101972 }
398
+ let(:certificate_renewal_id) { 65082 }
399
399
 
400
400
  before do
401
401
  stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/certificates/letsencrypt/#{certificate_id}/renewals/#{certificate_renewal_id}/issue})
@@ -416,9 +416,9 @@ describe Dnsimple::Client, ".certificates" do
416
416
  result = response.data
417
417
  expect(result).to be_a(Dnsimple::Struct::Certificate)
418
418
 
419
- expect(result.id).to eq(300)
420
- expect(result.domain_id).to eq(300)
421
- expect(result.common_name).to eq("www.example.com")
419
+ expect(result.id).to eq(101972)
420
+ expect(result.domain_id).to eq(289333)
421
+ expect(result.common_name).to eq("www.bingo.pizza")
422
422
  expect(result.alternate_names).to eq([])
423
423
  expect(result.years).to eq(1)
424
424
  expect(result.csr).to be(nil)
@@ -6,7 +6,7 @@ describe Dnsimple::Client::ClientService do
6
6
 
7
7
  describe "#paginate" do
8
8
  service_class = Class.new(Dnsimple::Client::ClientService) do
9
- Item = Class.new(Dnsimple::Struct::Base) do
9
+ Item = Class.new(Dnsimple::Struct::Base) do # rubocop:disable Lint/ConstantDefinitionInBlock
10
10
  attr_accessor :id
11
11
  end
12
12