dnsimple 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/README.md +1 -8
  4. data/lib/dnsimple/client/certificates.rb +7 -7
  5. data/lib/dnsimple/client/collaborators.rb +3 -3
  6. data/lib/dnsimple/client/contacts.rb +6 -6
  7. data/lib/dnsimple/client/domains.rb +6 -6
  8. data/lib/dnsimple/client/domains_email_forwards.rb +5 -5
  9. data/lib/dnsimple/client/domains_pushes.rb +6 -6
  10. data/lib/dnsimple/client/registrar.rb +37 -11
  11. data/lib/dnsimple/client/registrar_auto_renewal.rb +2 -2
  12. data/lib/dnsimple/client/registrar_delegation.rb +4 -4
  13. data/lib/dnsimple/client/registrar_whois_privacy.rb +3 -3
  14. data/lib/dnsimple/client/services_domains.rb +3 -3
  15. data/lib/dnsimple/client/templates.rb +6 -6
  16. data/lib/dnsimple/client/templates_domains.rb +1 -1
  17. data/lib/dnsimple/client/templates_records.rb +7 -7
  18. data/lib/dnsimple/client/vanity_name_servers.rb +2 -2
  19. data/lib/dnsimple/client/webhooks.rb +4 -4
  20. data/lib/dnsimple/client/zones.rb +4 -4
  21. data/lib/dnsimple/client/zones_records.rb +9 -9
  22. data/lib/dnsimple/response.rb +7 -7
  23. data/lib/dnsimple/struct.rb +4 -0
  24. data/lib/dnsimple/struct/account.rb +1 -1
  25. data/lib/dnsimple/struct/certificate.rb +3 -3
  26. data/lib/dnsimple/struct/collaborator.rb +3 -3
  27. data/lib/dnsimple/struct/contact.rb +2 -2
  28. data/lib/dnsimple/struct/domain.rb +3 -3
  29. data/lib/dnsimple/struct/domain_premium_price.rb +13 -0
  30. data/lib/dnsimple/struct/domain_push.rb +4 -4
  31. data/lib/dnsimple/struct/domain_registration.rb +37 -0
  32. data/lib/dnsimple/struct/domain_renewal.rb +28 -0
  33. data/lib/dnsimple/struct/domain_transfer.rb +34 -0
  34. data/lib/dnsimple/struct/email_forward.rb +2 -2
  35. data/lib/dnsimple/struct/oauth_token.rb +1 -1
  36. data/lib/dnsimple/struct/service.rb +3 -3
  37. data/lib/dnsimple/struct/template.rb +4 -4
  38. data/lib/dnsimple/struct/template_record.rb +4 -4
  39. data/lib/dnsimple/struct/tld.rb +2 -2
  40. data/lib/dnsimple/struct/user.rb +1 -1
  41. data/lib/dnsimple/struct/webhook.rb +1 -1
  42. data/lib/dnsimple/struct/whois_privacy.rb +1 -1
  43. data/lib/dnsimple/struct/zone.rb +2 -2
  44. data/lib/dnsimple/struct/zone_record.rb +4 -4
  45. data/lib/dnsimple/version.rb +1 -1
  46. data/spec/dnsimple/client/certificates_spec.rb +2 -2
  47. data/spec/dnsimple/client/contacts_spec.rb +2 -2
  48. data/spec/dnsimple/client/domains_email_forwards_spec.rb +2 -2
  49. data/spec/dnsimple/client/domains_spec.rb +2 -2
  50. data/spec/dnsimple/client/identity_spec.rb +2 -2
  51. data/spec/dnsimple/client/registrar_auto_renewal_spec.rb +2 -2
  52. data/spec/dnsimple/client/registrar_spec.rb +57 -7
  53. data/spec/dnsimple/client/services_domains_spec.rb +2 -2
  54. data/spec/dnsimple/client/services_spec.rb +8 -4
  55. data/spec/dnsimple/client/templates_records_spec.rb +4 -4
  56. data/spec/dnsimple/client/templates_spec.rb +4 -4
  57. data/spec/dnsimple/client/zones_records_spec.rb +4 -4
  58. data/spec/dnsimple/client/zones_spec.rb +2 -2
  59. data/spec/fixtures.http/accounts/success-account.http +21 -0
  60. data/spec/fixtures.http/accounts/success-user.http +21 -0
  61. data/spec/fixtures.http/addCollaborator/invite-success.http +1 -1
  62. data/spec/fixtures.http/addCollaborator/success.http +1 -1
  63. data/spec/fixtures.http/appliedServices/success.http +1 -1
  64. data/spec/fixtures.http/applyService/{created.http → success.http} +0 -0
  65. data/spec/fixtures.http/changeDomainDelegationToVanity/success.http +1 -1
  66. data/spec/fixtures.http/checkDomain/success.http +17 -17
  67. data/spec/fixtures.http/createContact/created.http +17 -17
  68. data/spec/fixtures.http/createDomain/created.http +1 -1
  69. data/spec/fixtures.http/createEmailForward/created.http +1 -1
  70. data/spec/fixtures.http/createTemplate/created.http +1 -1
  71. data/spec/fixtures.http/createTemplateRecord/created.http +1 -1
  72. data/spec/fixtures.http/createWebhook/created.http +17 -17
  73. data/spec/fixtures.http/createZoneRecord/created-apex.http +17 -0
  74. data/spec/fixtures.http/createZoneRecord/created.http +9 -13
  75. data/spec/fixtures.http/deleteContact/success.http +13 -13
  76. data/spec/fixtures.http/deleteEmailForward/success.http +13 -12
  77. data/spec/fixtures.http/deleteWebhook/success.http +13 -13
  78. data/spec/fixtures.http/disableDomainAutoRenewal/success.http +13 -0
  79. data/spec/fixtures.http/disableWhoisPrivacy/success.http +1 -1
  80. data/spec/fixtures.http/enableDomainAutoRenewal/success.http +13 -0
  81. data/spec/fixtures.http/enableVanityNameServers/success.http +1 -1
  82. data/spec/fixtures.http/enableWhoisPrivacy/created.http +1 -1
  83. data/spec/fixtures.http/enableWhoisPrivacy/success.http +1 -1
  84. data/spec/fixtures.http/getCertificate/success.http +1 -1
  85. data/spec/fixtures.http/getContact/success.http +17 -17
  86. data/spec/fixtures.http/getDomain/success.http +16 -16
  87. data/spec/fixtures.http/getDomainPremiumPrice/failure.http +16 -0
  88. data/spec/fixtures.http/getDomainPremiumPrice/success.http +21 -0
  89. data/spec/fixtures.http/getEmailForward/success.http +17 -17
  90. data/spec/fixtures.http/getService/success.http +1 -1
  91. data/spec/fixtures.http/getTemplate/success.http +1 -1
  92. data/spec/fixtures.http/getTemplateRecord/success.http +1 -1
  93. data/spec/fixtures.http/getTldExtendedAttributes/success-attributes.http +17 -0
  94. data/spec/fixtures.http/getWebhook/success.http +17 -17
  95. data/spec/fixtures.http/getWhoisPrivacy/success.http +1 -1
  96. data/spec/fixtures.http/getZone/success.http +17 -17
  97. data/spec/fixtures.http/getZoneRecord/success.http +1 -1
  98. data/spec/fixtures.http/initiatePush/success.http +1 -1
  99. data/spec/fixtures.http/listAccounts/success-account.http +1 -1
  100. data/spec/fixtures.http/listAccounts/success-user.http +1 -1
  101. data/spec/fixtures.http/listCertificates/success.http +1 -1
  102. data/spec/fixtures.http/listCollaborators/success.http +1 -1
  103. data/spec/fixtures.http/listContacts/success.http +17 -17
  104. data/spec/fixtures.http/listDomains/success.http +1 -1
  105. data/spec/fixtures.http/listEmailForwards/success.http +1 -1
  106. data/spec/fixtures.http/listPushes/success.http +1 -1
  107. data/spec/fixtures.http/listServices/success.http +12 -8
  108. data/spec/fixtures.http/listTemplateRecords/success.http +1 -1
  109. data/spec/fixtures.http/listTemplates/success.http +1 -1
  110. data/spec/fixtures.http/listWebhooks/success.http +17 -17
  111. data/spec/fixtures.http/listZoneRecords/success.http +1 -1
  112. data/spec/fixtures.http/listZones/success.http +17 -17
  113. data/spec/fixtures.http/method-not-allowed.http +11 -11
  114. data/spec/fixtures.http/notfound-contact.http +12 -12
  115. data/spec/fixtures.http/notfound-record.http +11 -11
  116. data/spec/fixtures.http/notfound-whoisprivacy.http +12 -0
  117. data/spec/fixtures.http/notfound-zone.http +11 -11
  118. data/spec/fixtures.http/oauthAccessToken/error-invalid-request.http +16 -0
  119. data/spec/fixtures.http/oauthAccessToken/success.http +17 -17
  120. data/spec/fixtures.http/registerDomain/success.http +21 -17
  121. data/spec/fixtures.http/renewDomain/success.http +13 -9
  122. data/spec/fixtures.http/resetDomainToken/success.http +1 -1
  123. data/spec/fixtures.http/success-with-malformed-json.http +13 -0
  124. data/spec/fixtures.http/transferDomain/success.http +13 -9
  125. data/spec/fixtures.http/updateContact/success.http +17 -17
  126. data/spec/fixtures.http/updateTemplate/success.http +1 -1
  127. data/spec/fixtures.http/updateZoneRecord/success.http +1 -1
  128. data/spec/fixtures.http/validation-error.http +19 -0
  129. data/spec/fixtures.http/whoami/{success_account.http → success-account.http} +15 -15
  130. data/spec/fixtures.http/whoami/{success_user.http → success-user.http} +15 -15
  131. data/spec/fixtures.http/whoami/success.http +15 -15
  132. metadata +37 -14
  133. data/.ruby-version +0 -1
  134. data/spec/fixtures.http/disableAutoRenewal/success.http +0 -12
  135. data/spec/fixtures.http/enableAutoRenewal/success.http +0 -12
@@ -0,0 +1,13 @@
1
+ module Dnsimple
2
+ module Struct
3
+
4
+ class DomainPremiumPrice < Base
5
+ # @return [String] The domain premium price
6
+ attr_accessor :premium_price
7
+
8
+ # @return [String] The action: registration/transfer/renewal
9
+ attr_accessor :action
10
+ end
11
+
12
+ end
13
+ end
@@ -2,16 +2,16 @@ module Dnsimple
2
2
  module Struct
3
3
 
4
4
  class DomainPush < Base
5
- # @return [Fixnum] The domain push ID in DNSimple.
5
+ # @return [Integer] The domain push ID in DNSimple.
6
6
  attr_accessor :id
7
7
 
8
- # @return [Fixnum] The associated domain ID.
8
+ # @return [Integer] The associated domain ID.
9
9
  attr_accessor :domain_id
10
10
 
11
- # @return [Fixnum] The associated contact ID.
11
+ # @return [Integer] The associated contact ID.
12
12
  attr_accessor :contact_id
13
13
 
14
- # @return [Fixnum] The associated account ID.
14
+ # @return [Integer] The associated account ID.
15
15
  attr_accessor :account_id
16
16
 
17
17
  # @return [String] When the domain push was created in DNSimple.
@@ -0,0 +1,37 @@
1
+ module Dnsimple
2
+ module Struct
3
+
4
+ class DomainRegistration < Base
5
+ # @return [Integer] The domain registration ID in DNSimple.
6
+ attr_accessor :id
7
+
8
+ # @return [Integer] The associated domain ID.
9
+ attr_accessor :domain_id
10
+
11
+ # @return [Integer] The associated registrant (contact) ID.
12
+ attr_accessor :registrant_id
13
+
14
+ # @return [Integer] The number of years the domain was registered for.
15
+ attr_accessor :period
16
+
17
+ # @return [String] The state of the renewal.
18
+ attr_accessor :state
19
+
20
+ # @return [Bool] True if the domain auto-renew was requested.
21
+ attr_accessor :auto_renew
22
+
23
+ # @return [Bool] True if the domain WHOIS privacy was requested.
24
+ attr_accessor :whois_privacy
25
+
26
+ # @return [String] The premium price requested for the registration.
27
+ attr_accessor :premium_price
28
+
29
+ # @return [String] When the domain renewal was created in DNSimple.
30
+ attr_accessor :created_at
31
+
32
+ # @return [String] When the domain renewal was last updated in DNSimple.
33
+ attr_accessor :updated_at
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,28 @@
1
+ module Dnsimple
2
+ module Struct
3
+
4
+ class DomainRenewal < Base
5
+ # @return [Integer] The domain renewal ID in DNSimple.
6
+ attr_accessor :id
7
+
8
+ # @return [Integer] The associated domain ID.
9
+ attr_accessor :domain_id
10
+
11
+ # @return [Integer] The number of years the domain was renewed for.
12
+ attr_accessor :period
13
+
14
+ # @return [String] The state of the renewal.
15
+ attr_accessor :state
16
+
17
+ # @return [String] The premium price requested for the renewal.
18
+ attr_accessor :premium_price
19
+
20
+ # @return [String] When the domain renewal was created in DNSimple.
21
+ attr_accessor :created_at
22
+
23
+ # @return [String] When the domain renewal was last updated in DNSimple.
24
+ attr_accessor :updated_at
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,34 @@
1
+ module Dnsimple
2
+ module Struct
3
+
4
+ class DomainTransfer < Base
5
+ # @return [Integer] The domain registration ID in DNSimple.
6
+ attr_accessor :id
7
+
8
+ # @return [Integer] The associated domain ID.
9
+ attr_accessor :domain_id
10
+
11
+ # @return [Integer] The associated registrant (contact) ID.
12
+ attr_accessor :registrant_id
13
+
14
+ # @return [String] The state of the renewal.
15
+ attr_accessor :state
16
+
17
+ # @return [Bool] True if the domain auto-renew was requested.
18
+ attr_accessor :auto_renew
19
+
20
+ # @return [Bool] True if the domain WHOIS privacy was requested.
21
+ attr_accessor :whois_privacy
22
+
23
+ # @return [String] The premium price requested for the registration.
24
+ attr_accessor :premium_price
25
+
26
+ # @return [String] When the domain renewal was created in DNSimple.
27
+ attr_accessor :created_at
28
+
29
+ # @return [String] When the domain renewal was last updated in DNSimple.
30
+ attr_accessor :updated_at
31
+ end
32
+
33
+ end
34
+ end
@@ -2,10 +2,10 @@ module Dnsimple
2
2
  module Struct
3
3
 
4
4
  class EmailForward < Base
5
- # @return [Fixnum] The email forward ID in DNSimple.
5
+ # @return [Integer] The email forward ID in DNSimple.
6
6
  attr_accessor :id
7
7
 
8
- # @return [Fixnum] The associated domain ID.
8
+ # @return [Integer] The associated domain ID.
9
9
  attr_accessor :domain_id
10
10
 
11
11
  # @return [String] The "local part" of the originating email address. Anything to the left of the @ symbol.
@@ -11,7 +11,7 @@ module Dnsimple
11
11
  # @return [String] The token scope (not used for now).
12
12
  attr_accessor :scope
13
13
 
14
- # @return [Fixnum] The account ID in DNSimple this token belongs to.
14
+ # @return [Integer] The account ID in DNSimple this token belongs to.
15
15
  attr_accessor :account_id
16
16
  end
17
17
 
@@ -23,14 +23,14 @@ module Dnsimple
23
23
  attr_accessor :password
24
24
  end
25
25
 
26
- # @return [Fixnum] The service ID in DNSimple.
26
+ # @return [Integer] The service ID in DNSimple.
27
27
  attr_accessor :id
28
28
 
29
29
  # @return [String] The service name.
30
30
  attr_accessor :name
31
31
 
32
- # @return [String] A short name for the service.
33
- attr_accessor :short_name
32
+ # @return [String] A string ID for the service.
33
+ attr_accessor :sid
34
34
 
35
35
  # @return [String] The service description.
36
36
  attr_accessor :description
@@ -2,17 +2,17 @@ module Dnsimple
2
2
  module Struct
3
3
 
4
4
  class Template < Base
5
- # @return [Fixnum] The template ID in DNSimple.
5
+ # @return [Integer] The template ID in DNSimple.
6
6
  attr_accessor :id
7
7
 
8
- # @return [Fixnum] The associated account ID.
8
+ # @return [Integer] The associated account ID.
9
9
  attr_accessor :account_id
10
10
 
11
11
  # @return [String] The template name.
12
12
  attr_accessor :name
13
13
 
14
- # @return [String] The short name for the template.
15
- attr_accessor :short_name
14
+ # @return [String] The string ID for the template.
15
+ attr_accessor :sid
16
16
 
17
17
  # @return [String] The template description.
18
18
  attr_accessor :description
@@ -2,10 +2,10 @@ module Dnsimple
2
2
  module Struct
3
3
 
4
4
  class TemplateRecord < Base
5
- # @return [Fixnum] The template record ID in DNSimple.
5
+ # @return [Integer] The template record ID in DNSimple.
6
6
  attr_accessor :id
7
7
 
8
- # @return [Fixnum] The template ID in DNSimple.
8
+ # @return [Integer] The template ID in DNSimple.
9
9
  attr_accessor :template_id
10
10
 
11
11
  # @return [String] The type of template record, in uppercase.
@@ -17,10 +17,10 @@ module Dnsimple
17
17
  # @return [String] The plain-text template record content.
18
18
  attr_accessor :content
19
19
 
20
- # @return [Fixnum] The template record TTL value.
20
+ # @return [Integer] The template record TTL value.
21
21
  attr_accessor :ttl
22
22
 
23
- # @return [Fixnum] The priority value, if the type of template record accepts a priority.
23
+ # @return [Integer] The priority value, if the type of template record accepts a priority.
24
24
  attr_accessor :priority
25
25
 
26
26
  # @return [String] When the template record was created in DNSimple.
@@ -5,7 +5,7 @@ module Dnsimple
5
5
  # @return [String] The TLD in DNSimple.
6
6
  attr_accessor :tld
7
7
 
8
- # @return [Fixnum] The TLD type.
8
+ # @return [Integer] The TLD type.
9
9
  attr_accessor :tld_type
10
10
 
11
11
  # @return [Boolean] True if Whois Privacy Protection is available.
@@ -17,7 +17,7 @@ module Dnsimple
17
17
  # @return [Boolean] True if IDN is available.
18
18
  attr_accessor :idn
19
19
 
20
- # @return [Fixnum] The minimum registration period, in years.
20
+ # @return [Integer] The minimum registration period, in years.
21
21
  attr_accessor :minimum_registration
22
22
 
23
23
  # @return [Boolean] True if DNSimple supports registrations for this TLD.
@@ -2,7 +2,7 @@ module Dnsimple
2
2
  module Struct
3
3
 
4
4
  class User < Base
5
- # @return [Fixnum] The user ID in DNSimple.
5
+ # @return [Integer] The user ID in DNSimple.
6
6
  attr_accessor :id
7
7
 
8
8
  # @return [String] The user email.
@@ -2,7 +2,7 @@ module Dnsimple
2
2
  module Struct
3
3
 
4
4
  class Webhook < Base
5
- # @return [Fixnum] The contact ID in DNSimple.
5
+ # @return [Integer] The contact ID in DNSimple.
6
6
  attr_accessor :id
7
7
 
8
8
  # @return [String] The callback URL.
@@ -2,7 +2,7 @@ module Dnsimple
2
2
  module Struct
3
3
 
4
4
  class WhoisPrivacy < Base
5
- # @return [Fixnum] The associated domain ID.
5
+ # @return [Integer] The associated domain ID.
6
6
  attr_accessor :domain_id
7
7
 
8
8
  # @return [Boolean] Whether the whois privacy is enabled for the domain.
@@ -2,10 +2,10 @@ module Dnsimple
2
2
  module Struct
3
3
 
4
4
  class Zone < Base
5
- # @return [Fixnum] The zone ID in DNSimple.
5
+ # @return [Integer] The zone ID in DNSimple.
6
6
  attr_accessor :id
7
7
 
8
- # @return [Fixnum] The associated account ID.
8
+ # @return [Integer] The associated account ID.
9
9
  attr_accessor :account_id
10
10
 
11
11
  # @return [String] The zone name.
@@ -2,13 +2,13 @@ module Dnsimple
2
2
  module Struct
3
3
 
4
4
  class ZoneRecord < Base
5
- # @return [Fixnum] The record ID in DNSimple.
5
+ # @return [Integer] The record ID in DNSimple.
6
6
  attr_accessor :id
7
7
 
8
8
  # @return [String] The associated zone ID.
9
9
  attr_accessor :zone_id
10
10
 
11
- # @return [Fixnum] The ID of the parent record, if this record is dependent on another record.
11
+ # @return [Integer] The ID of the parent record, if this record is dependent on another record.
12
12
  attr_accessor :parent_id
13
13
 
14
14
  # @return [String] The type of record, in uppercase.
@@ -20,10 +20,10 @@ module Dnsimple
20
20
  # @return [String] The plain-text record content.
21
21
  attr_accessor :content
22
22
 
23
- # @return [Fixnum] The TTL value.
23
+ # @return [Integer] The TTL value.
24
24
  attr_accessor :ttl
25
25
 
26
- # @return [Fixnum] The priority value, if the type of record accepts a priority.
26
+ # @return [Integer] The priority value, if the type of record accepts a priority.
27
27
  attr_accessor :priority
28
28
 
29
29
  # @return [Bool] True if this is a system record created by DNSimple. System records are read-only.
@@ -1,3 +1,3 @@
1
1
  module Dnsimple
2
- VERSION = "4.0.0".freeze
2
+ VERSION = "4.1.0".freeze
3
3
  end
@@ -92,8 +92,8 @@ describe Dnsimple::Client, ".certificates" do
92
92
  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")
93
93
  expect(result.state).to eq("issued")
94
94
  expect(result.authority_identifier).to eq("letsencrypt")
95
- expect(result.created_at).to eq("2016-06-11T18:47:08.949Z")
96
- expect(result.updated_at).to eq("2016-06-11T18:47:37.546Z")
95
+ expect(result.created_at).to eq("2016-06-11T18:47:08Z")
96
+ expect(result.updated_at).to eq("2016-06-11T18:47:37Z")
97
97
  expect(result.expires_on).to eq("2016-09-09")
98
98
  end
99
99
 
@@ -133,8 +133,8 @@ describe Dnsimple::Client, ".contacts" do
133
133
  expect(result).to be_a(Dnsimple::Struct::Contact)
134
134
  expect(result.id).to eq(1)
135
135
  expect(result.account_id).to eq(1010)
136
- expect(result.created_at).to eq("2016-01-19T20:50:26.066Z")
137
- expect(result.updated_at).to eq("2016-01-19T20:50:26.066Z")
136
+ expect(result.created_at).to eq("2016-01-19T20:50:26Z")
137
+ expect(result.updated_at).to eq("2016-01-19T20:50:26Z")
138
138
  end
139
139
 
140
140
  context "when the contact does not exist" do
@@ -151,8 +151,8 @@ describe Dnsimple::Client, ".domains" do
151
151
  expect(result.domain_id).to eq(228963)
152
152
  expect(result.from).to eq("jim@a-domain.com")
153
153
  expect(result.to).to eq("jim@another.com")
154
- expect(result.created_at).to eq("2016-02-04T14:26:50.282Z")
155
- expect(result.updated_at).to eq("2016-02-04T14:26:50.282Z")
154
+ expect(result.created_at).to eq("2016-02-04T14:26:50Z")
155
+ expect(result.updated_at).to eq("2016-02-04T14:26:50Z")
156
156
  end
157
157
 
158
158
  context "when the email forward does not exist" do
@@ -151,8 +151,8 @@ describe Dnsimple::Client, ".domains" do
151
151
  expect(result.auto_renew).to eq(false)
152
152
  expect(result.private_whois).to eq(false)
153
153
  expect(result.expires_on).to eq(nil)
154
- expect(result.created_at).to eq("2014-12-06T15:56:55.573Z")
155
- expect(result.updated_at).to eq("2015-12-09T00:20:56.056Z")
154
+ expect(result.created_at).to eq("2014-12-06T15:56:55Z")
155
+ expect(result.updated_at).to eq("2015-12-09T00:20:56Z")
156
156
  end
157
157
 
158
158
  context "when the domain does not exist" do
@@ -29,7 +29,7 @@ describe Dnsimple::Client, ".identity" do
29
29
  context "when authenticated as account" do
30
30
  before do
31
31
  stub_request(:get, %r{/v2/whoami$}).
32
- to_return(read_http_fixture("whoami/success_account.http"))
32
+ to_return(read_http_fixture("whoami/success-account.http"))
33
33
  end
34
34
 
35
35
  it "sets the account" do
@@ -42,7 +42,7 @@ describe Dnsimple::Client, ".identity" do
42
42
  context "when authenticated as user" do
43
43
  before do
44
44
  stub_request(:get, %r{/v2/whoami$}).
45
- to_return(read_http_fixture("whoami/success_user.http"))
45
+ to_return(read_http_fixture("whoami/success-user.http"))
46
46
  end
47
47
 
48
48
  it "sets the user" do
@@ -10,7 +10,7 @@ describe Dnsimple::Client, ".registrar" do
10
10
 
11
11
  before do
12
12
  stub_request(:put, %r{/v2/#{account_id}/registrar/domains/#{domain_id}}).
13
- to_return(read_http_fixture("enableAutoRenewal/success.http"))
13
+ to_return(read_http_fixture("enableDomainAutoRenewal/success.http"))
14
14
  end
15
15
 
16
16
 
@@ -47,7 +47,7 @@ describe Dnsimple::Client, ".registrar" do
47
47
 
48
48
  before do
49
49
  stub_request(:delete, %r{/v2/#{account_id}/registrar/domains/#{domain_id}}).
50
- to_return(read_http_fixture("disableAutoRenewal/success.http"))
50
+ to_return(read_http_fixture("disableDomainAutoRenewal/success.http"))
51
51
  end
52
52
 
53
53
 
@@ -26,9 +26,57 @@ describe Dnsimple::Client, ".registrar" do
26
26
 
27
27
  result = response.data
28
28
  expect(result).to be_a(Dnsimple::Struct::DomainCheck)
29
- expect(result.domain).to eq("example.com")
29
+ expect(result.domain).to eq("ruby.codes")
30
30
  expect(result.available).to be_truthy
31
- expect(result.premium).to be_falsey
31
+ expect(result.premium).to be_truthy
32
+ end
33
+ end
34
+
35
+ describe "#domain_premium_price" do
36
+ let(:account_id) { 1010 }
37
+
38
+ context "when premium price" do
39
+ before do
40
+ stub_request(:get, %r{/v2/#{account_id}/registrar/domains/.+/premium_price[\?action]*}).
41
+ to_return(read_http_fixture("getDomainPremiumPrice/success.http"))
42
+ end
43
+
44
+ it "builds the correct request" do
45
+ subject.domain_premium_price(account_id, domain_name = "ruby.codes")
46
+
47
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/premium_price").
48
+ with(headers: { "Accept" => "application/json" })
49
+ end
50
+
51
+ it "returns the premium price" do
52
+ response = subject.domain_premium_price(account_id, "ruby.codes")
53
+ expect(response).to be_a(Dnsimple::Response)
54
+
55
+ result = response.data
56
+ expect(result).to be_a(Dnsimple::Struct::DomainPremiumPrice)
57
+ expect(result.premium_price).to eq("109.00")
58
+ expect(result.action).to eq("registration")
59
+ end
60
+
61
+ it "builds the correct request when action is passed" do
62
+ subject.domain_premium_price(account_id, domain_name = "ruby.codes", action: "registration")
63
+
64
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/premium_price?action=registration").
65
+ with(headers: { "Accept" => "application/json" })
66
+ end
67
+ end
68
+
69
+ context "when not premium price" do
70
+ before do
71
+ stub_request(:get, %r{/v2/#{account_id}/registrar/domains/.+/premium_price$}).
72
+ to_return(read_http_fixture("getDomainPremiumPrice/failure.http"))
73
+ end
74
+
75
+ it "raises error" do
76
+ expect {
77
+ subject.domain_premium_price(account_id, "example.com")
78
+ }.to raise_error(Dnsimple::RequestError, "`example.com` is not a premium domain for registration")
79
+ end
32
80
  end
33
81
  end
34
82
 
@@ -55,8 +103,9 @@ describe Dnsimple::Client, ".registrar" do
55
103
  expect(response).to be_a(Dnsimple::Response)
56
104
 
57
105
  result = response.data
58
- expect(result).to be_a(Dnsimple::Struct::Domain)
106
+ expect(result).to be_a(Dnsimple::Struct::DomainRegistration)
59
107
  expect(result.id).to be_a(Integer)
108
+ expect(result.domain_id).to be_a(Integer)
60
109
  end
61
110
 
62
111
  context "when the attributes are incomplete" do
@@ -89,8 +138,9 @@ describe Dnsimple::Client, ".registrar" do
89
138
  expect(response).to be_a(Dnsimple::Response)
90
139
 
91
140
  result = response.data
92
- expect(result).to be_a(Dnsimple::Struct::Domain)
141
+ expect(result).to be_a(Dnsimple::Struct::DomainRenewal)
93
142
  expect(result.id).to be_a(Integer)
143
+ expect(result.domain_id).to be_a(Integer)
94
144
  end
95
145
 
96
146
  context "when it is too soon for the domain to be renewed" do
@@ -128,9 +178,9 @@ describe Dnsimple::Client, ".registrar" do
128
178
  expect(response).to be_a(Dnsimple::Response)
129
179
 
130
180
  result = response.data
131
- expect(result).to be_a(Dnsimple::Struct::Domain)
132
- expect(result.name).to eq("example.com")
133
- expect(result.registrant_id).to eq(10)
181
+ expect(result).to be_a(Dnsimple::Struct::DomainTransfer)
182
+ expect(result.id).to be_a(Integer)
183
+ expect(result.domain_id).to be_a(Integer)
134
184
  end
135
185
 
136
186
  context "when the attributes are incomplete" do