dnsimple 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.markdown +5 -2
  3. data/dnsimple.gemspec +1 -1
  4. data/lib/dnsimple/client/certificates.rb +11 -11
  5. data/lib/dnsimple/client/clients.rb +4 -2
  6. data/lib/dnsimple/client/contacts.rb +19 -15
  7. data/lib/dnsimple/client/domains.rb +23 -19
  8. data/lib/dnsimple/client/{domains_autorenewals.rb → domains_autorenewal.rb} +7 -7
  9. data/lib/dnsimple/client/domains_forwards.rb +13 -12
  10. data/lib/dnsimple/client/domains_privacy.rb +6 -6
  11. data/lib/dnsimple/client/domains_records.rb +14 -13
  12. data/lib/dnsimple/client/domains_sharing.rb +10 -9
  13. data/lib/dnsimple/client/domains_zones.rb +3 -3
  14. data/lib/dnsimple/client/name_servers.rb +14 -14
  15. data/lib/dnsimple/client/registrar.rb +17 -15
  16. data/lib/dnsimple/client/services.rb +7 -6
  17. data/lib/dnsimple/client/services_domains.rb +12 -12
  18. data/lib/dnsimple/client/templates.rb +18 -30
  19. data/lib/dnsimple/client/templates_domains.rb +23 -0
  20. data/lib/dnsimple/client/templates_records.rb +15 -15
  21. data/lib/dnsimple/client/users.rb +7 -5
  22. data/lib/dnsimple/version.rb +1 -1
  23. data/spec/dnsimple/client/certificates_spec.rb +2 -2
  24. data/spec/dnsimple/client/contacts_spec.rb +22 -22
  25. data/spec/dnsimple/client/domains_autorenewals_spec.rb +4 -4
  26. data/spec/dnsimple/client/domains_forwards_spec.rb +8 -8
  27. data/spec/dnsimple/client/domains_privacy_spec.rb +4 -4
  28. data/spec/dnsimple/client/domains_records_spec.rb +11 -11
  29. data/spec/dnsimple/client/domains_sharing_spec.rb +6 -6
  30. data/spec/dnsimple/client/domains_spec.rb +15 -15
  31. data/spec/dnsimple/client/domains_zones_spec.rb +2 -2
  32. data/spec/dnsimple/client/name_servers_spec.rb +1 -1
  33. data/spec/dnsimple/client/registrar_spec.rb +9 -9
  34. data/spec/dnsimple/client/services_spec.rb +3 -3
  35. data/spec/dnsimple/client/templates_domains_spec.rb +38 -0
  36. data/spec/dnsimple/client/templates_records_spec.rb +10 -10
  37. data/spec/dnsimple/client/templates_spec.rb +21 -53
  38. data/spec/files/contacts/{get → contact}/success.http +0 -0
  39. data/spec/files/contacts/{list → contacts}/success.http +0 -0
  40. data/spec/files/contacts/{create → create_contact}/badrequest-missingcontact.http +0 -0
  41. data/spec/files/contacts/{create → create_contact}/badrequest-validationerror.http +0 -0
  42. data/spec/files/contacts/{create → create_contact}/created.http +0 -0
  43. data/spec/files/contacts/{delete → delete_contact}/success-204.http +0 -0
  44. data/spec/files/contacts/{delete → delete_contact}/success.http +0 -0
  45. data/spec/files/contacts/{notfound.http → notfound-contact.http} +0 -0
  46. data/spec/files/contacts/{update → update_contact}/success.http +0 -0
  47. data/spec/files/domains/{create → create_domain}/created.http +0 -0
  48. data/spec/files/{domains_forwards/create → domains/create_forward}/created.http +0 -0
  49. data/spec/files/{domains_sharing/create → domains/create_membership}/success.http +0 -0
  50. data/spec/files/{domains_records/create → domains/create_record}/created.http +0 -0
  51. data/spec/files/domains/{delete → delete_domain}/success-204.http +0 -0
  52. data/spec/files/domains/{delete → delete_domain}/success.http +0 -0
  53. data/spec/files/{domains_forwards/delete → domains/delete_forward}/success.http +0 -0
  54. data/spec/files/{domains_sharing/delete → domains/delete_membership}/success.http +0 -0
  55. data/spec/files/{domains_records/delete → domains/delete_record}/success-204.http +0 -0
  56. data/spec/files/{domains_records/delete → domains/delete_record}/success.http +0 -0
  57. data/spec/files/{domains_autorenewal/disable → domains/disable_auto_renewal}/success.http +0 -0
  58. data/spec/files/{domains_privacy/disable → domains/disable_whois_privacy}/success.http +0 -0
  59. data/spec/files/domains/{get → domain}/success.http +0 -0
  60. data/spec/files/domains/{list → domains}/success.http +0 -0
  61. data/spec/files/{domains_autorenewal/enable → domains/enable_auto_renewal}/success.http +0 -0
  62. data/spec/files/{domains_privacy/enable → domains/enable_whois_privacy}/success.http +0 -0
  63. data/spec/files/{domains_forwards/get → domains/forward}/success.http +0 -0
  64. data/spec/files/{domains_forwards/list → domains/forwards}/success.http +0 -0
  65. data/spec/files/{domains_sharing/list → domains/memberships}/success.http +0 -0
  66. data/spec/files/domains/{notfound.http → notfound-domain.http} +0 -0
  67. data/spec/files/{domains_forwards/notfound.http → domains/notfound-forward.http} +0 -0
  68. data/spec/files/{domains_sharing/notfound.http → domains/notfound-membership.http} +0 -0
  69. data/spec/files/{domains_records/get → domains/record}/success.http +0 -0
  70. data/spec/files/{domains_records/list → domains/records}/success.http +0 -0
  71. data/spec/files/{domains_records/update → domains/update_record}/success.http +0 -0
  72. data/spec/files/{domains_zones/get → domains/zone}/success.http +0 -0
  73. data/spec/files/nameservers/{list → name_servers}/success.http +0 -0
  74. data/spec/files/{registrar_extended_attributes/list → registrar/extended_attributes}/success.http +0 -0
  75. data/spec/files/{registrar_prices/list → registrar/prices}/success.http +0 -0
  76. data/spec/files/services/{notfound.http → notfound-service.http} +0 -0
  77. data/spec/files/services/{get → service}/success.http +0 -0
  78. data/spec/files/services/{list → services}/success.http +0 -0
  79. data/spec/files/subscriptions/{get → subscription}/success.http +0 -0
  80. data/spec/files/templates/{apply → apply_template}/success.http +0 -0
  81. data/spec/files/templates/{create → create_template}/created.http +0 -0
  82. data/spec/files/templates/{delete → delete_template}/success-204.http +0 -0
  83. data/spec/files/templates/{delete → delete_template}/success.http +0 -0
  84. data/spec/files/templates/{notfound.http → notfound-template.http} +0 -0
  85. data/spec/files/templates/{get → template}/success.http +0 -0
  86. data/spec/files/templates/{list → templates}/success.http +0 -0
  87. data/spec/files/templates/{update → update_template}/success.http +0 -0
  88. data/spec/files/templates_records/{create → create_record}/created.http +0 -0
  89. data/spec/files/templates_records/{delete → delete_record}/success-204.http +0 -0
  90. data/spec/files/templates_records/{delete → delete_record}/success.http +0 -0
  91. data/spec/files/templates_records/{notfound.http → notfound-template-record.http} +0 -0
  92. data/spec/files/templates_records/{get → record}/success.http +0 -0
  93. data/spec/files/templates_records/{list → records}/success.http +0 -0
  94. data/spec/files/templates_records/{update → update_record}/success.http +0 -0
  95. metadata +121 -130
  96. data/spec/files/domains_autorenewal/notfound-domain.http +0 -19
  97. data/spec/files/domains_forwards/notfound-domain.http +0 -19
  98. data/spec/files/domains_privacy/notfound-domain.http +0 -19
  99. data/spec/files/domains_records/notfound.http +0 -17
  100. data/spec/files/domains_sharing/notfound-domain.http +0 -19
  101. data/spec/files/domains_zones/notfound-domain.http +0 -19
@@ -0,0 +1,23 @@
1
+ module Dnsimple
2
+ class Client
3
+ module TemplatesDomains
4
+
5
+ # Applies the template to the domain.
6
+ #
7
+ # @see http://developer.dnsimple.com/templates/#apply
8
+ #
9
+ # @param [#to_s] domain The domain id or domain name.
10
+ # @param [#to_s] template The template id or short-name.
11
+ # @return [void]
12
+ #
13
+ # @raise [NotFoundError]
14
+ # @raise [RequestError] When the request fails.
15
+ def apply_template(domain, template, options = {})
16
+ response = client.post("v1/domains/#{domain}/templates/#{template}/apply", options)
17
+ response.code == 200
18
+ end
19
+ alias :apply :apply_template
20
+
21
+ end
22
+ end
23
+ end
@@ -7,12 +7,12 @@ module Dnsimple
7
7
  # @see http://developer.dnsimple.com/templates/records/#list
8
8
  #
9
9
  # @param [#to_s] template The template id or short-name.
10
- #
11
10
  # @return [Array<Struct::TemplateRecord>]
11
+ #
12
12
  # @raise [NotFoundError]
13
13
  # @raise [RequestError] When the request fails.
14
- def records(template)
15
- response = client.get("v1/templates/#{template}/records")
14
+ def records(template, options = {})
15
+ response = client.get("v1/templates/#{template}/records", options)
16
16
 
17
17
  response.map { |r| Struct::TemplateRecord.new(r["dns_template_record"]) }
18
18
  end
@@ -23,13 +23,13 @@ module Dnsimple
23
23
  #
24
24
  # @param [#to_s] template The template id or short-name.
25
25
  # @param [Hash] attributes
26
- #
27
26
  # @return [Struct::TemplateRecord]
27
+ #
28
28
  # @raise [NotFoundError]
29
29
  # @raise [RequestError] When the request fails.
30
- def create_record(template, attributes = {})
30
+ def create_record(template, attributes = {}, options = {})
31
31
  Extra.validate_mandatory_attributes(attributes, [:name, :record_type, :content])
32
- options = { dns_template_record: attributes }
32
+ options = options.merge({ dns_template_record: attributes })
33
33
  response = client.post("v1/templates/#{template}/records", options)
34
34
 
35
35
  Struct::TemplateRecord.new(response["dns_template_record"])
@@ -41,12 +41,12 @@ module Dnsimple
41
41
  #
42
42
  # @param [#to_s] template The template id or short-name.
43
43
  # @param [Fixnum] record The record id.
44
- #
45
44
  # @return [Struct::TemplateRecord]
45
+ #
46
46
  # @raise [NotFoundError]
47
47
  # @raise [RequestError] When the request fails.
48
- def record(template, record)
49
- response = client.get("v1/templates/#{template}/records/#{record}")
48
+ def record(template, record, options = {})
49
+ response = client.get("v1/templates/#{template}/records/#{record}", options)
50
50
 
51
51
  Struct::TemplateRecord.new(response["dns_template_record"])
52
52
  end
@@ -58,12 +58,12 @@ module Dnsimple
58
58
  # @param [#to_s] template The template id or short-name.
59
59
  # @param [Fixnum] record The record id.
60
60
  # @param [Hash] attributes
61
- #
62
61
  # @return [Struct::TemplateRecord]
62
+ #
63
63
  # @raise [NotFoundError]
64
64
  # @raise [RequestError] When the request fails.
65
- def update_record(template, record, attributes = {})
66
- options = { dns_template_record: attributes }
65
+ def update_record(template, record, attributes = {}, options = {})
66
+ options = options.merge({ dns_template_record: attributes })
67
67
  response = client.put("v1/templates/#{template}/records/#{record}", options)
68
68
 
69
69
  Struct::TemplateRecord.new(response["dns_template_record"])
@@ -75,12 +75,12 @@ module Dnsimple
75
75
  #
76
76
  # @param [#to_s] template The template id or short-name.
77
77
  # @param [Fixnum] record The record id.
78
- #
79
78
  # @return [Template]
79
+ #
80
80
  # @raise [NotFoundError]
81
81
  # @raise [RequestError] When the request fails.
82
- def delete_record(template, record)
83
- client.delete("v1/templates/#{template}/records/#{record}")
82
+ def delete_record(template, record, options = {})
83
+ client.delete("v1/templates/#{template}/records/#{record}", options)
84
84
  end
85
85
 
86
86
  end
@@ -5,9 +5,10 @@ module Dnsimple
5
5
  # Fetches the information about the authenticated user.
6
6
  #
7
7
  # @return [Struct::User] The authenticated user.
8
+ #
8
9
  # @raise [RequestError] When the request fails.
9
- def user
10
- response = client.get("v1/user")
10
+ def user(options = {})
11
+ response = client.get("v1/user", options)
11
12
 
12
13
  Struct::User.new(response["user"])
13
14
  end
@@ -24,11 +25,12 @@ module Dnsimple
24
25
  # # => "cda038832591e34f5df642ce2b61dc78"
25
26
  #
26
27
  # @param [String] otp_token the two-factor one time (OTP) token.
27
- #
28
28
  # @return [String] The two-factor API exchange token.
29
+ #
29
30
  # @raise [AuthenticationFailed] if the provided OTP token is invalid.
30
- def exchange_token(otp_token)
31
- response = client.get("v1/user", headers: { Client::HEADER_2FA_STRICT => "1", Client::HEADER_OTP_TOKEN => otp_token })
31
+ def exchange_token(otp_token, options = {})
32
+ options = Extra.deep_merge(options, headers: { Client::HEADER_2FA_STRICT => "1", Client::HEADER_OTP_TOKEN => otp_token })
33
+ response = client.get("v1/user", options)
32
34
  response.headers[Client::HEADER_EXCHANGE_TOKEN]
33
35
  end
34
36
 
@@ -1,3 +1,3 @@
1
1
  module Dnsimple
2
- VERSION = '2.0.0'
2
+ VERSION = "2.1.0"
3
3
  end
@@ -33,7 +33,7 @@ describe Dnsimple::Client, ".certificates" do
33
33
  context "when something does not exist" do
34
34
  it "raises NotFoundError" do
35
35
  stub_request(:get, %r[/v1]).
36
- to_return(read_fixture("domains/notfound.http"))
36
+ to_return(read_fixture("domains/notfound-domain.http"))
37
37
 
38
38
  expect {
39
39
  subject.certificates("example.com")
@@ -118,7 +118,7 @@ describe Dnsimple::Client, ".certificates" do
118
118
  context "when something does not exist" do
119
119
  it "raises NotFoundError" do
120
120
  stub_request(:post, %r[/v1]).
121
- to_return(read_fixture("domains/notfound.http"))
121
+ to_return(read_fixture("domains/notfound-domain.http"))
122
122
 
123
123
  expect {
124
124
  subject.purchase("example.com", "www", 100)
@@ -8,7 +8,7 @@ describe Dnsimple::Client, ".contacts" do
8
8
  describe "#contacts" do
9
9
  before do
10
10
  stub_request(:get, %r[/v1/contacts$]).
11
- to_return(read_fixture("contacts/list/success.http"))
11
+ to_return(read_fixture("contacts/contacts/success.http"))
12
12
  end
13
13
 
14
14
  it "builds the correct request" do
@@ -31,24 +31,24 @@ describe Dnsimple::Client, ".contacts" do
31
31
  end
32
32
  end
33
33
 
34
- describe "#create" do
34
+ describe "#create_contact" do
35
35
  before do
36
36
  stub_request(:post, %r[/v1/contacts$]).
37
- to_return(read_fixture("contacts/create/created.http"))
37
+ to_return(read_fixture("contacts/create_contact/created.http"))
38
38
  end
39
39
 
40
40
  let(:attributes) { { first_name: "Simone", last_name: "Carletti", address1: "", city: "Rome", state_province: "RM", postal_code: "00171", country: "IT", email_address: "", phone: "" } }
41
41
 
42
42
  it "builds the correct request" do
43
- subject.create(attributes)
43
+ subject.create_contact(attributes)
44
44
 
45
45
  expect(WebMock).to have_requested(:post, "https://api.zone/v1/contacts").
46
- with(body: { contact: attributes }).
47
- with(headers: { 'Accept' => 'application/json' })
46
+ with(body: { contact: attributes }).
47
+ with(headers: { 'Accept' => 'application/json' })
48
48
  end
49
49
 
50
50
  it "returns the contact" do
51
- result = subject.create(attributes)
51
+ result = subject.create_contact(attributes)
52
52
 
53
53
  expect(result).to be_a(Dnsimple::Struct::Contact)
54
54
  expect(result.id).to be_a(Fixnum)
@@ -58,7 +58,7 @@ describe Dnsimple::Client, ".contacts" do
58
58
  describe "#contact" do
59
59
  before do
60
60
  stub_request(:get, %r[/v1/contacts/.+$]).
61
- to_return(read_fixture("contacts/get/success.http"))
61
+ to_return(read_fixture("contacts/contact/success.http"))
62
62
  end
63
63
 
64
64
  it "builds the correct request" do
@@ -94,7 +94,7 @@ describe Dnsimple::Client, ".contacts" do
94
94
  context "when something does not exist" do
95
95
  it "raises NotFoundError" do
96
96
  stub_request(:get, %r[/v1]).
97
- to_return(read_fixture("contacts/notfound.http"))
97
+ to_return(read_fixture("contacts/notfound-contact.http"))
98
98
 
99
99
  expect {
100
100
  subject.contact(1)
@@ -103,10 +103,10 @@ describe Dnsimple::Client, ".contacts" do
103
103
  end
104
104
  end
105
105
 
106
- describe "#update" do
106
+ describe "#update_contact" do
107
107
  before do
108
108
  stub_request(:put, %r[/v1/contacts/.+$]).
109
- to_return(read_fixture("contacts/update/success.http"))
109
+ to_return(read_fixture("contacts/update_contact/success.http"))
110
110
  end
111
111
 
112
112
  it "builds the correct request" do
@@ -118,7 +118,7 @@ describe Dnsimple::Client, ".contacts" do
118
118
  end
119
119
 
120
120
  it "returns the contact" do
121
- result = subject.update(1, {})
121
+ result = subject.update_contact(1, {})
122
122
 
123
123
  expect(result).to be_a(Dnsimple::Struct::Contact)
124
124
  expect(result.id).to be_a(Fixnum)
@@ -127,39 +127,39 @@ describe Dnsimple::Client, ".contacts" do
127
127
  context "when something does not exist" do
128
128
  it "raises NotFoundError" do
129
129
  stub_request(:put, %r[/v1]).
130
- to_return(read_fixture("contacts/notfound.http"))
130
+ to_return(read_fixture("contacts/notfound-contact.http"))
131
131
 
132
132
  expect {
133
- subject.update(1, {})
133
+ subject.update_contact(1, {})
134
134
  }.to raise_error(Dnsimple::NotFoundError)
135
135
  end
136
136
  end
137
137
  end
138
138
 
139
- describe "#delete" do
139
+ describe "#delete_contact" do
140
140
  before do
141
141
  stub_request(:delete, %r[/v1/contacts/1$]).
142
- to_return(read_fixture("contacts/delete/success.http"))
142
+ to_return(read_fixture("contacts/delete_contact/success.http"))
143
143
  end
144
144
 
145
145
  it "builds the correct request" do
146
- subject.delete(1)
146
+ subject.delete_contact(1)
147
147
 
148
148
  expect(WebMock).to have_requested(:delete, "https://api.zone/v1/contacts/1").
149
149
  with(headers: { 'Accept' => 'application/json' })
150
150
  end
151
151
 
152
152
  it "returns nothing" do
153
- result = subject.delete(1)
153
+ result = subject.delete_contact(1)
154
154
 
155
155
  expect(result).to be_truthy
156
156
  end
157
157
 
158
158
  it "supports HTTP 204" do
159
159
  stub_request(:delete, %r[/v1]).
160
- to_return(read_fixture("contacts/delete/success-204.http"))
160
+ to_return(read_fixture("contacts/delete_contact/success-204.http"))
161
161
 
162
- result = subject.delete(1)
162
+ result = subject.delete_contact(1)
163
163
 
164
164
  expect(result).to be_truthy
165
165
  end
@@ -167,10 +167,10 @@ describe Dnsimple::Client, ".contacts" do
167
167
  context "when something does not exist" do
168
168
  it "raises NotFoundError" do
169
169
  stub_request(:delete, %r[/v1]).
170
- to_return(read_fixture("contacts/notfound.http"))
170
+ to_return(read_fixture("contacts/notfound-contact.http"))
171
171
 
172
172
  expect {
173
- subject.delete(1)
173
+ subject.delete_contact(1)
174
174
  }.to raise_error(Dnsimple::NotFoundError)
175
175
  end
176
176
  end
@@ -8,7 +8,7 @@ describe Dnsimple::Client, ".domains / autorenewals" do
8
8
  describe "#enable_auto_renewal" do
9
9
  before do
10
10
  stub_request(:post, %r[/v1/domains/.+/auto_renewal$]).
11
- to_return(read_fixture("domains_autorenewal/enable/success.http"))
11
+ to_return(read_fixture("domains/enable_auto_renewal/success.http"))
12
12
  end
13
13
 
14
14
  it "builds the correct request" do
@@ -28,7 +28,7 @@ describe Dnsimple::Client, ".domains / autorenewals" do
28
28
  context "when the domain does not exist" do
29
29
  it "raises NotFoundError" do
30
30
  stub_request(:post, %r[/v1]).
31
- to_return(read_fixture("domains_autorenewal/notfound-domain.http"))
31
+ to_return(read_fixture("domains/notfound-domain.http"))
32
32
 
33
33
  expect {
34
34
  subject.enable_auto_renewal("example.com")
@@ -40,7 +40,7 @@ describe Dnsimple::Client, ".domains / autorenewals" do
40
40
  describe "#disable_auto_renewal" do
41
41
  before do
42
42
  stub_request(:delete, %r[/v1/domains/.+/auto_renewal$]).
43
- to_return(read_fixture("domains_autorenewal/disable/success.http"))
43
+ to_return(read_fixture("domains/disable_auto_renewal/success.http"))
44
44
  end
45
45
 
46
46
  it "builds the correct request" do
@@ -60,7 +60,7 @@ describe Dnsimple::Client, ".domains / autorenewals" do
60
60
  context "when the domain does not exist" do
61
61
  it "raises NotFoundError" do
62
62
  stub_request(:delete, %r[/v1]).
63
- to_return(read_fixture("domains_autorenewal/notfound-domain.http"))
63
+ to_return(read_fixture("domains/notfound-domain.http"))
64
64
 
65
65
  expect {
66
66
  subject.disable_auto_renewal("example.com")
@@ -8,7 +8,7 @@ describe Dnsimple::Client, ".domains / forwards" do
8
8
  describe "#email_forwards" do
9
9
  before do
10
10
  stub_request(:get, %r[/v1/domains/.+/email_forwards$]).
11
- to_return(read_fixture("domains_forwards/list/success.http"))
11
+ to_return(read_fixture("domains/forwards/success.http"))
12
12
  end
13
13
 
14
14
  it "builds the correct request" do
@@ -33,7 +33,7 @@ describe Dnsimple::Client, ".domains / forwards" do
33
33
  context "when the domain does not exist" do
34
34
  it "raises NotFoundError" do
35
35
  stub_request(:get, %r[/v1]).
36
- to_return(read_fixture("domains_forwards/notfound-domain.http"))
36
+ to_return(read_fixture("domains/notfound-domain.http"))
37
37
 
38
38
  expect {
39
39
  subject.email_forwards("example.com")
@@ -45,7 +45,7 @@ describe Dnsimple::Client, ".domains / forwards" do
45
45
  describe "#create_email_forward" do
46
46
  before do
47
47
  stub_request(:post, %r[/v1/domains/.+/email_forwards$]).
48
- to_return(read_fixture("domains_forwards/create/created.http"))
48
+ to_return(read_fixture("domains/create_forward/created.http"))
49
49
  end
50
50
 
51
51
  it "builds the correct request" do
@@ -66,7 +66,7 @@ describe Dnsimple::Client, ".domains / forwards" do
66
66
  context "when the domain does not exist" do
67
67
  it "raises NotFoundError" do
68
68
  stub_request(:post, %r[/v1]).
69
- to_return(read_fixture("domains_forwards/notfound-domain.http"))
69
+ to_return(read_fixture("domains/notfound-domain.http"))
70
70
 
71
71
  expect {
72
72
  subject.create_email_forward("example.com", { from: "", to: "" })
@@ -78,7 +78,7 @@ describe Dnsimple::Client, ".domains / forwards" do
78
78
  describe "#email_forward" do
79
79
  before do
80
80
  stub_request(:get, %r[/v1/domains/.+/email_forwards/.+$]).
81
- to_return(read_fixture("domains_forwards/get/success.http"))
81
+ to_return(read_fixture("domains/forward/success.http"))
82
82
  end
83
83
 
84
84
  it "builds the correct request" do
@@ -103,7 +103,7 @@ describe Dnsimple::Client, ".domains / forwards" do
103
103
  context "when forward does not exist" do
104
104
  it "raises NotFoundError" do
105
105
  stub_request(:get, %r[/v1]).
106
- to_return(read_fixture("domains_forwards/notfound.http"))
106
+ to_return(read_fixture("domains/notfound-forward.http"))
107
107
 
108
108
  expect {
109
109
  subject.email_forward("example.com", 2)
@@ -115,7 +115,7 @@ describe Dnsimple::Client, ".domains / forwards" do
115
115
  describe "#delete_email_forward" do
116
116
  before do
117
117
  stub_request(:delete, %r[/v1/domains/.+/email_forwards/.+$]).
118
- to_return(read_fixture("domains_forwards/delete/success.http"))
118
+ to_return(read_fixture("domains/delete_forward/success.http"))
119
119
  end
120
120
 
121
121
  it "builds the correct request" do
@@ -134,7 +134,7 @@ describe Dnsimple::Client, ".domains / forwards" do
134
134
  context "when the forward does not exist" do
135
135
  it "raises NotFoundError" do
136
136
  stub_request(:delete, %r[/v1]).
137
- to_return(read_fixture("domains_forwards/notfound.http"))
137
+ to_return(read_fixture("domains/notfound-forward.http"))
138
138
 
139
139
  expect {
140
140
  subject.delete_email_forward("example.com", 2)
@@ -8,7 +8,7 @@ describe Dnsimple::Client, ".domains / privacy" do
8
8
  describe "#enable_whois_privacy" do
9
9
  before do
10
10
  stub_request(:post, %r[/v1/domains/.+/whois_privacy$]).
11
- to_return(read_fixture("domains_privacy/enable/success.http"))
11
+ to_return(read_fixture("domains/enable_whois_privacy/success.http"))
12
12
  end
13
13
 
14
14
  it "builds the correct request" do
@@ -28,7 +28,7 @@ describe Dnsimple::Client, ".domains / privacy" do
28
28
  context "when the domain does not exist" do
29
29
  it "raises NotFoundError" do
30
30
  stub_request(:post, %r[/v1]).
31
- to_return(read_fixture("domains_privacy/notfound-domain.http"))
31
+ to_return(read_fixture("domains/notfound-domain.http"))
32
32
 
33
33
  expect {
34
34
  subject.enable_whois_privacy("example.com")
@@ -40,7 +40,7 @@ describe Dnsimple::Client, ".domains / privacy" do
40
40
  describe "#disable_whois_privacy" do
41
41
  before do
42
42
  stub_request(:delete, %r[/v1/domains/.+/whois_privacy]).
43
- to_return(read_fixture("domains_privacy/disable/success.http"))
43
+ to_return(read_fixture("domains/disable_whois_privacy/success.http"))
44
44
  end
45
45
 
46
46
  it "builds the correct request" do
@@ -60,7 +60,7 @@ describe Dnsimple::Client, ".domains / privacy" do
60
60
  context "when the domain does not exist" do
61
61
  it "raises NotFoundError" do
62
62
  stub_request(:delete, %r[/v1]).
63
- to_return(read_fixture("domains_privacy/notfound-domain.http"))
63
+ to_return(read_fixture("domains/notfound-domain.http"))
64
64
 
65
65
  expect {
66
66
  subject.disable_whois_privacy("example.com")
@@ -8,7 +8,7 @@ describe Dnsimple::Client, ".domains / records" do
8
8
  describe "#records" do
9
9
  before do
10
10
  stub_request(:get, %r[/v1/domains/.+/records$]).
11
- to_return(read_fixture("domains_records/list/success.http"))
11
+ to_return(read_fixture("domains/records/success.http"))
12
12
  end
13
13
 
14
14
  it "builds the correct request" do
@@ -33,7 +33,7 @@ describe Dnsimple::Client, ".domains / records" do
33
33
  context "when something does not exist" do
34
34
  it "raises NotFoundError" do
35
35
  stub_request(:get, %r[/v1]).
36
- to_return(read_fixture("domains_records/notfound.http"))
36
+ to_return(read_fixture("domains/notfound-domain.http"))
37
37
 
38
38
  expect {
39
39
  subject.records("example.com")
@@ -45,7 +45,7 @@ describe Dnsimple::Client, ".domains / records" do
45
45
  describe "#create_record" do
46
46
  before do
47
47
  stub_request(:post, %r[/v1/domains/.+/records$]).
48
- to_return(read_fixture("domains_records/create/created.http"))
48
+ to_return(read_fixture("domains/create_record/created.http"))
49
49
  end
50
50
 
51
51
  it "builds the correct request" do
@@ -66,7 +66,7 @@ describe Dnsimple::Client, ".domains / records" do
66
66
  context "when something does not exist" do
67
67
  it "raises NotFoundError" do
68
68
  stub_request(:post, %r[/v1]).
69
- to_return(read_fixture("domains/notfound.http"))
69
+ to_return(read_fixture("domains/notfound-domain.http"))
70
70
 
71
71
  expect {
72
72
  subject.create_record("example.com", { name: "", record_type: "", content: "" })
@@ -78,7 +78,7 @@ describe Dnsimple::Client, ".domains / records" do
78
78
  describe "#record" do
79
79
  before do
80
80
  stub_request(:get, %r[/v1/domains/.+/records/.+$]).
81
- to_return(read_fixture("domains_records/get/success.http"))
81
+ to_return(read_fixture("domains/record/success.http"))
82
82
  end
83
83
 
84
84
  it "builds the correct request" do
@@ -106,7 +106,7 @@ describe Dnsimple::Client, ".domains / records" do
106
106
  context "when something does not exist" do
107
107
  it "raises NotFoundError" do
108
108
  stub_request(:get, %r[/v1]).
109
- to_return(read_fixture("domains_records/notfound.http"))
109
+ to_return(read_fixture("domains/notfound-domain.http"))
110
110
 
111
111
  expect {
112
112
  subject.record("example.com", 2)
@@ -118,7 +118,7 @@ describe Dnsimple::Client, ".domains / records" do
118
118
  describe "#update_record" do
119
119
  before do
120
120
  stub_request(:put, %r[/v1/domains/.+/records/.+$]).
121
- to_return(read_fixture("domains_records/update/success.http"))
121
+ to_return(read_fixture("domains/update_record/success.http"))
122
122
  end
123
123
 
124
124
  it "builds the correct request" do
@@ -139,7 +139,7 @@ describe Dnsimple::Client, ".domains / records" do
139
139
  context "when something does not exist" do
140
140
  it "raises NotFoundError" do
141
141
  stub_request(:put, %r[/v1]).
142
- to_return(read_fixture("domains_records/notfound.http"))
142
+ to_return(read_fixture("domains/notfound-domain.http"))
143
143
 
144
144
  expect {
145
145
  subject.update_record("example.com", 2, {})
@@ -151,7 +151,7 @@ describe Dnsimple::Client, ".domains / records" do
151
151
  describe "#delete_record" do
152
152
  before do
153
153
  stub_request(:delete, %r[/v1/domains/.+/records/.+$]).
154
- to_return(read_fixture("domains/delete/success.http"))
154
+ to_return(read_fixture("domains/delete_record/success.http"))
155
155
  end
156
156
 
157
157
  it "builds the correct request" do
@@ -169,7 +169,7 @@ describe Dnsimple::Client, ".domains / records" do
169
169
 
170
170
  it "supports HTTP 204" do
171
171
  stub_request(:delete, %r[/v1]).
172
- to_return(read_fixture("domains_records/delete/success-204.http"))
172
+ to_return(read_fixture("domains/delete_record/success-204.http"))
173
173
 
174
174
  result = subject.delete_record("example.com", 2)
175
175
 
@@ -179,7 +179,7 @@ describe Dnsimple::Client, ".domains / records" do
179
179
  context "when something does not exist" do
180
180
  it "raises NotFoundError" do
181
181
  stub_request(:delete, %r[/v1]).
182
- to_return(read_fixture("domains_records/notfound.http"))
182
+ to_return(read_fixture("domains/notfound-domain.http"))
183
183
 
184
184
  expect {
185
185
  subject.delete_record("example.com", 2)