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
@@ -8,7 +8,7 @@ describe Dnsimple::Client, ".domains / sharing" do
8
8
  describe "#memberships" do
9
9
  before do
10
10
  stub_request(:get, %r[/v1/domains/.+/memberships$]).
11
- to_return(read_fixture("domains_sharing/list/success.http"))
11
+ to_return(read_fixture("domains/memberships/success.http"))
12
12
  end
13
13
 
14
14
  it "builds the correct request" do
@@ -33,7 +33,7 @@ describe Dnsimple::Client, ".domains / sharing" 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_sharing/notfound-domain.http"))
36
+ to_return(read_fixture("domains/notfound-domain.http"))
37
37
 
38
38
  expect {
39
39
  subject.memberships("example.com")
@@ -45,7 +45,7 @@ describe Dnsimple::Client, ".domains / sharing" do
45
45
  describe "#create_membership" do
46
46
  before do
47
47
  stub_request(:post, %r[/v1/domains/.+/memberships$]).
48
- to_return(read_fixture("domains_sharing/create/success.http"))
48
+ to_return(read_fixture("domains/create_membership/success.http"))
49
49
  end
50
50
 
51
51
  it "builds the correct request" do
@@ -66,7 +66,7 @@ describe Dnsimple::Client, ".domains / sharing" 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_membership("example.com", "someone@example.com")
@@ -78,7 +78,7 @@ describe Dnsimple::Client, ".domains / sharing" do
78
78
  describe "#delete_membership" do
79
79
  before do
80
80
  stub_request(:delete, %r[/v1/domains/.+/memberships/.+$]).
81
- to_return(read_fixture("domains_sharing/delete/success.http"))
81
+ to_return(read_fixture("domains/delete_membership/success.http"))
82
82
  end
83
83
 
84
84
  it "builds the correct request" do
@@ -97,7 +97,7 @@ describe Dnsimple::Client, ".domains / sharing" do
97
97
  context "when the membership does not exist" do
98
98
  it "raises NotFoundError" do
99
99
  stub_request(:delete, %r[/v1]).
100
- to_return(read_fixture("domains_sharing/notfound.http"))
100
+ to_return(read_fixture("domains/notfound-membership.http"))
101
101
 
102
102
  expect {
103
103
  subject.delete_membership("example.com", 2)
@@ -8,7 +8,7 @@ describe Dnsimple::Client, ".domains" do
8
8
  describe "#domains" do
9
9
  before do
10
10
  stub_request(:get, %r[/v1/domains$]).
11
- to_return(read_fixture("domains/list/success.http"))
11
+ to_return(read_fixture("domains/domains/success.http"))
12
12
  end
13
13
 
14
14
  it "builds the correct request" do
@@ -31,16 +31,16 @@ describe Dnsimple::Client, ".domains" do
31
31
  end
32
32
  end
33
33
 
34
- describe "#create" do
34
+ describe "#create_domain" do
35
35
  before do
36
36
  stub_request(:post, %r[/v1/domains$]).
37
- to_return(read_fixture("domains/create/created.http"))
37
+ to_return(read_fixture("domains/create_domain/created.http"))
38
38
  end
39
39
 
40
40
  let(:attributes) { { name: "example.com" } }
41
41
 
42
42
  it "builds the correct request" do
43
- subject.create(attributes)
43
+ subject.create_domain(attributes)
44
44
 
45
45
  expect(WebMock).to have_requested(:post, "https://api.zone/v1/domains").
46
46
  with(body: { domain: attributes }).
@@ -48,7 +48,7 @@ describe Dnsimple::Client, ".domains" do
48
48
  end
49
49
 
50
50
  it "returns the domain" do
51
- result = subject.create(attributes)
51
+ result = subject.create_domain(attributes)
52
52
 
53
53
  expect(result).to be_a(Dnsimple::Struct::Domain)
54
54
  expect(result.id).to be_a(Fixnum)
@@ -58,7 +58,7 @@ describe Dnsimple::Client, ".domains" do
58
58
  describe "#domain" do
59
59
  before do
60
60
  stub_request(:get, %r[/v1/domains/.+$]).
61
- to_return(read_fixture("domains/get/success.http"))
61
+ to_return(read_fixture("domains/domain/success.http"))
62
62
  end
63
63
 
64
64
  it "builds the correct request" do
@@ -87,7 +87,7 @@ describe Dnsimple::Client, ".domains" do
87
87
  context "when something does not exist" do
88
88
  it "raises NotFoundError" do
89
89
  stub_request(:get, %r[/v1]).
90
- to_return(read_fixture("domains/notfound.http"))
90
+ to_return(read_fixture("domains/notfound-domain.http"))
91
91
 
92
92
  expect {
93
93
  subject.domain("example.com")
@@ -96,30 +96,30 @@ describe Dnsimple::Client, ".domains" do
96
96
  end
97
97
  end
98
98
 
99
- describe "#delete" do
99
+ describe "#delete_domain" do
100
100
  before do
101
101
  stub_request(:delete, %r[/v1/domains/.+$]).
102
- to_return(read_fixture("domains/delete/success.http"))
102
+ to_return(read_fixture("domains/delete_domain/success.http"))
103
103
  end
104
104
 
105
105
  it "builds the correct request" do
106
- subject.delete("example.com")
106
+ subject.delete_domain("example.com")
107
107
 
108
108
  expect(WebMock).to have_requested(:delete, "https://api.zone/v1/domains/example.com").
109
109
  with(headers: { 'Accept' => 'application/json' })
110
110
  end
111
111
 
112
112
  it "returns nothing" do
113
- result = subject.delete("example.com")
113
+ result = subject.delete_domain("example.com")
114
114
 
115
115
  expect(result).to be_truthy
116
116
  end
117
117
 
118
118
  it "supports HTTP 204" do
119
119
  stub_request(:delete, %r[/v1]).
120
- to_return(read_fixture("domains/delete/success-204.http"))
120
+ to_return(read_fixture("domains/delete_domain/success-204.http"))
121
121
 
122
- result = subject.delete("example.com")
122
+ result = subject.delete_domain("example.com")
123
123
 
124
124
  expect(result).to be_truthy
125
125
  end
@@ -127,10 +127,10 @@ describe Dnsimple::Client, ".domains" do
127
127
  context "when something does not exist" do
128
128
  it "raises NotFoundError" do
129
129
  stub_request(:delete, %r[/v1]).
130
- to_return(read_fixture("domains/notfound.http"))
130
+ to_return(read_fixture("domains/notfound-domain.http"))
131
131
 
132
132
  expect {
133
- subject.delete("example.com")
133
+ subject.delete_domain("example.com")
134
134
  }.to raise_error(Dnsimple::NotFoundError)
135
135
  end
136
136
  end
@@ -8,7 +8,7 @@ describe Dnsimple::Client, ".domains / zones" do
8
8
  describe "#zone" do
9
9
  before do
10
10
  stub_request(:get, %r[/v1/domains/.+/zone$]).
11
- to_return(read_fixture("domains_zones/get/success.http"))
11
+ to_return(read_fixture("domains/zone/success.http"))
12
12
  end
13
13
 
14
14
  it "builds the correct request" do
@@ -28,7 +28,7 @@ describe Dnsimple::Client, ".domains / zones" do
28
28
  context "when domain does not exist" do
29
29
  it "raises NotFoundError" do
30
30
  stub_request(:get, %r[/v1]).
31
- to_return(read_fixture("domains_zones/notfound-domain.http"))
31
+ to_return(read_fixture("domains/notfound-domain.http"))
32
32
 
33
33
  expect {
34
34
  subject.zone("example.com")
@@ -8,7 +8,7 @@ describe Dnsimple::Client, ".name_servers" do
8
8
  describe "#name_servers" do
9
9
  before do
10
10
  stub_request(:get, %r[/v1/domains/.+/name_servers$]).
11
- to_return(read_fixture("nameservers/list/success.http"))
11
+ to_return(read_fixture("nameservers/name_servers/success.http"))
12
12
  end
13
13
 
14
14
  it "builds the correct request" do
@@ -128,7 +128,7 @@ describe Dnsimple::Client, ".registrar" do
128
128
  context "when something does not exist" do
129
129
  it "raises NotFoundError" do
130
130
  stub_request(:post, %r[/v1]).
131
- to_return(read_fixture("domains/notfound.http"))
131
+ to_return(read_fixture("domains/notfound-domain.http"))
132
132
 
133
133
  expect {
134
134
  subject.renew("example.com")
@@ -138,21 +138,21 @@ describe Dnsimple::Client, ".registrar" do
138
138
  end
139
139
 
140
140
 
141
- describe "#list_extended_attributes" do
141
+ describe "#extended_attributes" do
142
142
  before do
143
143
  stub_request(:get, %r[/v1/extended_attributes/.+$]).
144
- to_return(read_fixture("registrar_extended_attributes/list/success.http"))
144
+ to_return(read_fixture("registrar/extended_attributes/success.http"))
145
145
  end
146
146
 
147
147
  it "builds the correct request" do
148
- subject.list_extended_attributes("uk")
148
+ subject.extended_attributes("uk")
149
149
 
150
150
  expect(WebMock).to have_requested(:get, "https://api.zone/v1/extended_attributes/uk").
151
151
  with(headers: { 'Accept' => 'application/json' })
152
152
  end
153
153
 
154
154
  it "returns the extended attributes" do
155
- results = subject.list_extended_attributes("uk")
155
+ results = subject.extended_attributes("uk")
156
156
 
157
157
  expect(results).to be_a(Array)
158
158
  expect(results.size).to eq(4)
@@ -173,21 +173,21 @@ describe Dnsimple::Client, ".registrar" do
173
173
  end
174
174
 
175
175
 
176
- describe "#list_prices" do
176
+ describe "#prices" do
177
177
  before do
178
178
  stub_request(:get, %r[/v1/prices$]).
179
- to_return(read_fixture("registrar_prices/list/success.http"))
179
+ to_return(read_fixture("registrar/prices/success.http"))
180
180
  end
181
181
 
182
182
  it "builds the correct request" do
183
- subject.list_prices
183
+ subject.prices
184
184
 
185
185
  expect(WebMock).to have_requested(:get, "https://api.zone/v1/prices").
186
186
  with(headers: { 'Accept' => 'application/json' })
187
187
  end
188
188
 
189
189
  it "returns the prices" do
190
- results = subject.list_prices
190
+ results = subject.prices
191
191
 
192
192
  expect(results).to be_a(Array)
193
193
  expect(results.size).to be > 0
@@ -8,7 +8,7 @@ describe Dnsimple::Client, ".services" do
8
8
  describe "#services" do
9
9
  before do
10
10
  stub_request(:get, %r[/v1/services$]).
11
- to_return(read_fixture("services/list/success.http"))
11
+ to_return(read_fixture("services/services/success.http"))
12
12
  end
13
13
 
14
14
  it "builds the correct request" do
@@ -34,7 +34,7 @@ describe Dnsimple::Client, ".services" do
34
34
  describe "#service" do
35
35
  before do
36
36
  stub_request(:get, %r[/v1/services/.+$]).
37
- to_return(read_fixture("services/get/success.http"))
37
+ to_return(read_fixture("services/service/success.http"))
38
38
  end
39
39
 
40
40
  it "builds the correct request" do
@@ -57,7 +57,7 @@ describe Dnsimple::Client, ".services" do
57
57
  context "when something does not exist" do
58
58
  it "raises NotFoundError" do
59
59
  stub_request(:get, %r[/v1]).
60
- to_return(read_fixture("services/notfound.http"))
60
+ to_return(read_fixture("services/notfound-service.http"))
61
61
 
62
62
  expect {
63
63
  subject.service(1)
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ describe Dnsimple::Client, ".templates / domains" do
4
+
5
+ subject { described_class.new(api_endpoint: "https://api.zone", username: "user", api_token: "token").templates }
6
+
7
+ describe "#apply_template" do
8
+ before do
9
+ stub_request(:post, %r[/v1/domains/.+/templates/.+/apply$]).
10
+ to_return(read_fixture("templates/apply_template/success.http"))
11
+ end
12
+
13
+ it "builds the correct request" do
14
+ subject.apply(1, 2)
15
+
16
+ expect(WebMock).to have_requested(:post, "https://api.zone/v1/domains/1/templates/2/apply").
17
+ with(headers: { 'Accept' => 'application/json' })
18
+ end
19
+
20
+ it "returns nothing" do
21
+ result = subject.apply_template(1, 2)
22
+
23
+ expect(result).to be_truthy
24
+ end
25
+
26
+ context "when something does not exist" do
27
+ it "raises NotFoundError" do
28
+ stub_request(:post, %r[/v1]).
29
+ to_return(read_fixture("templates/notfound-template.http"))
30
+
31
+ expect {
32
+ subject.apply_template(1, 2)
33
+ }.to raise_error(Dnsimple::NotFoundError)
34
+ end
35
+ end
36
+ end
37
+
38
+ end
@@ -8,7 +8,7 @@ describe Dnsimple::Client, ".templates / records" do
8
8
  describe "#records" do
9
9
  before do
10
10
  stub_request(:get, %r[/v1/templates/.+/records$]).
11
- to_return(read_fixture("templates_records/list/success.http"))
11
+ to_return(read_fixture("templates_records/records/success.http"))
12
12
  end
13
13
 
14
14
  it "builds the correct request" do
@@ -34,7 +34,7 @@ describe Dnsimple::Client, ".templates / records" do
34
34
  describe "#create_record" do
35
35
  before do
36
36
  stub_request(:post, %r[/v1/templates/.+/records$]).
37
- to_return(read_fixture("templates_records/create/created.http"))
37
+ to_return(read_fixture("templates_records/create_record/created.http"))
38
38
  end
39
39
 
40
40
  it "builds the correct request" do
@@ -55,7 +55,7 @@ describe Dnsimple::Client, ".templates / records" do
55
55
  context "when something does not exist" do
56
56
  it "raises NotFoundError" do
57
57
  stub_request(:post, %r[/v1]).
58
- to_return(read_fixture("templates_records/notfound.http"))
58
+ to_return(read_fixture("templates/notfound-template.http"))
59
59
 
60
60
  expect {
61
61
  subject.create_record(1, { name: "", record_type: "", content: "" })
@@ -67,7 +67,7 @@ describe Dnsimple::Client, ".templates / records" do
67
67
  describe "#record" do
68
68
  before do
69
69
  stub_request(:get, %r[/v1/templates/.+/records/.+$]).
70
- to_return(read_fixture("templates_records/get/success.http"))
70
+ to_return(read_fixture("templates_records/record/success.http"))
71
71
  end
72
72
 
73
73
  it "builds the correct request" do
@@ -95,7 +95,7 @@ describe Dnsimple::Client, ".templates / records" do
95
95
  context "when something does not exist" do
96
96
  it "raises NotFoundError" do
97
97
  stub_request(:get, %r[/v1]).
98
- to_return(read_fixture("templates_records/notfound.http"))
98
+ to_return(read_fixture("templates_records/notfound-template-record.http"))
99
99
 
100
100
  expect {
101
101
  subject.record(1, 2)
@@ -107,7 +107,7 @@ describe Dnsimple::Client, ".templates / records" do
107
107
  describe "#update_record" do
108
108
  before do
109
109
  stub_request(:put, %r[/v1/templates/.+/records/.+$]).
110
- to_return(read_fixture("templates_records/update/success.http"))
110
+ to_return(read_fixture("templates_records/update_record/success.http"))
111
111
  end
112
112
 
113
113
  it "builds the correct request" do
@@ -128,7 +128,7 @@ describe Dnsimple::Client, ".templates / records" do
128
128
  context "when something does not exist" do
129
129
  it "raises NotFoundError" do
130
130
  stub_request(:put, %r[/v1]).
131
- to_return(read_fixture("templates_records/notfound.http"))
131
+ to_return(read_fixture("templates_records/notfound-template-record.http"))
132
132
 
133
133
  expect {
134
134
  subject.update_record(1, 2, {})
@@ -140,7 +140,7 @@ describe Dnsimple::Client, ".templates / records" do
140
140
  describe "#delete_record" do
141
141
  before do
142
142
  stub_request(:delete, %r[/v1/templates/.+/records/.+$]).
143
- to_return(read_fixture("templates_records/delete/success.http"))
143
+ to_return(read_fixture("templates_records/delete_record/success.http"))
144
144
  end
145
145
 
146
146
  it "builds the correct request" do
@@ -158,7 +158,7 @@ describe Dnsimple::Client, ".templates / records" do
158
158
 
159
159
  it "supports HTTP 204" do
160
160
  stub_request(:delete, %r[/v1]).
161
- to_return(read_fixture("templates_records/delete/success-204.http"))
161
+ to_return(read_fixture("templates_records/delete_record/success-204.http"))
162
162
 
163
163
  result = subject.delete_record(1, 2)
164
164
 
@@ -168,7 +168,7 @@ describe Dnsimple::Client, ".templates / records" do
168
168
  context "when something does not exist" do
169
169
  it "raises NotFoundError" do
170
170
  stub_request(:delete, %r[/v1]).
171
- to_return(read_fixture("templates_records/notfound.http"))
171
+ to_return(read_fixture("templates_records/notfound-template-record.http"))
172
172
 
173
173
  expect {
174
174
  subject.delete_record(1, 2)
@@ -8,7 +8,7 @@ describe Dnsimple::Client, ".templates" do
8
8
  describe "#templates" do
9
9
  before do
10
10
  stub_request(:get, %r[/v1/templates$]).
11
- to_return(read_fixture("templates/list/success.http"))
11
+ to_return(read_fixture("templates/templates/success.http"))
12
12
  end
13
13
 
14
14
  it "builds the correct request" do
@@ -31,16 +31,16 @@ describe Dnsimple::Client, ".templates" do
31
31
  end
32
32
  end
33
33
 
34
- describe "#create" do
34
+ describe "#create_template" do
35
35
  before do
36
36
  stub_request(:post, %r[/v1/templates]).
37
- to_return(read_fixture("templates/create/created.http"))
37
+ to_return(read_fixture("templates/create_template/created.http"))
38
38
  end
39
39
 
40
40
  let(:attributes) { { name: "", short_name: "" } }
41
41
 
42
42
  it "builds the correct request" do
43
- subject.create(attributes)
43
+ subject.create_template(attributes)
44
44
 
45
45
  expect(WebMock).to have_requested(:post, "https://api.zone/v1/templates").
46
46
  with(body: { dns_template: attributes }).
@@ -48,7 +48,7 @@ describe Dnsimple::Client, ".templates" do
48
48
  end
49
49
 
50
50
  it "returns the template" do
51
- result = subject.create(attributes)
51
+ result = subject.create_template(attributes)
52
52
 
53
53
  expect(result).to be_a(Dnsimple::Struct::Template)
54
54
  expect(result.id).to be_a(Fixnum)
@@ -58,7 +58,7 @@ describe Dnsimple::Client, ".templates" do
58
58
  describe "#template" do
59
59
  before do
60
60
  stub_request(:get, %r[/v1/templates/.+$]).
61
- to_return(read_fixture("templates/get/success.http"))
61
+ to_return(read_fixture("templates/template/success.http"))
62
62
  end
63
63
 
64
64
  it "builds the correct request" do
@@ -81,7 +81,7 @@ describe Dnsimple::Client, ".templates" do
81
81
  context "when something does not exist" do
82
82
  it "raises NotFoundError" do
83
83
  stub_request(:get, %r[/v1]).
84
- to_return(read_fixture("templates/notfound.http"))
84
+ to_return(read_fixture("templates/notfound-template.http"))
85
85
 
86
86
  expect {
87
87
  subject.template(1)
@@ -90,14 +90,14 @@ describe Dnsimple::Client, ".templates" do
90
90
  end
91
91
  end
92
92
 
93
- describe "#update" do
93
+ describe "#update_template" do
94
94
  before do
95
95
  stub_request(:put, %r[/v1/templates/.+$]).
96
- to_return(read_fixture("templates/update/success.http"))
96
+ to_return(read_fixture("templates/update_template/success.http"))
97
97
  end
98
98
 
99
99
  it "builds the correct request" do
100
- subject.update(1, { name: "Updated" })
100
+ subject.update_template(1, { name: "Updated" })
101
101
 
102
102
  expect(WebMock).to have_requested(:put, "https://api.zone/v1/templates/1").
103
103
  with(body: { dns_template: { name: "Updated" } }).
@@ -105,7 +105,7 @@ describe Dnsimple::Client, ".templates" do
105
105
  end
106
106
 
107
107
  it "returns the template" do
108
- result = subject.update(1, {})
108
+ result = subject.update_template(1, {})
109
109
 
110
110
  expect(result).to be_a(Dnsimple::Struct::Template)
111
111
  expect(result.id).to be_a(Fixnum)
@@ -114,39 +114,39 @@ describe Dnsimple::Client, ".templates" do
114
114
  context "when something does not exist" do
115
115
  it "raises NotFoundError" do
116
116
  stub_request(:put, %r[/v1]).
117
- to_return(read_fixture("templates/notfound.http"))
117
+ to_return(read_fixture("templates/notfound-template.http"))
118
118
 
119
119
  expect {
120
- subject.update(1, {})
120
+ subject.update_template(1, {})
121
121
  }.to raise_error(Dnsimple::NotFoundError)
122
122
  end
123
123
  end
124
124
  end
125
125
 
126
- describe "#delete" do
126
+ describe "#delete_template" do
127
127
  before do
128
128
  stub_request(:delete, %r[/v1/templates/.+$]).
129
- to_return(read_fixture("templates/delete/success.http"))
129
+ to_return(read_fixture("templates/delete_template/success.http"))
130
130
  end
131
131
 
132
132
  it "builds the correct request" do
133
- subject.delete(1)
133
+ subject.delete_template(1)
134
134
 
135
135
  expect(WebMock).to have_requested(:delete, "https://api.zone/v1/templates/1").
136
136
  with(headers: { 'Accept' => 'application/json' })
137
137
  end
138
138
 
139
139
  it "returns nothing" do
140
- result = subject.delete(1)
140
+ result = subject.delete_template(1)
141
141
 
142
142
  expect(result).to be_truthy
143
143
  end
144
144
 
145
145
  it "supports HTTP 204" do
146
146
  stub_request(:delete, %r[/v1]).
147
- to_return(read_fixture("templates/delete/success-204.http"))
147
+ to_return(read_fixture("templates/delete_template/success-204.http"))
148
148
 
149
- result = subject.delete(1)
149
+ result = subject.delete_template(1)
150
150
 
151
151
  expect(result).to be_truthy
152
152
  end
@@ -154,42 +154,10 @@ describe Dnsimple::Client, ".templates" do
154
154
  context "when something does not exist" do
155
155
  it "raises NotFoundError" do
156
156
  stub_request(:delete, %r[/v1]).
157
- to_return(read_fixture("templates/notfound.http"))
157
+ to_return(read_fixture("templates/notfound-template.http"))
158
158
 
159
159
  expect {
160
- subject.delete(1)
161
- }.to raise_error(Dnsimple::NotFoundError)
162
- end
163
- end
164
- end
165
-
166
-
167
- describe "#apply" do
168
- before do
169
- stub_request(:post, %r[/v1/domains/.+/templates/.+/apply$]).
170
- to_return(read_fixture("templates/apply/success.http"))
171
- end
172
-
173
- it "builds the correct request" do
174
- subject.apply(1, 2)
175
-
176
- expect(WebMock).to have_requested(:post, "https://api.zone/v1/domains/1/templates/2/apply").
177
- with(headers: { 'Accept' => 'application/json' })
178
- end
179
-
180
- it "returns nothing" do
181
- result = subject.apply(1, 2)
182
-
183
- expect(result).to be_truthy
184
- end
185
-
186
- context "when something does not exist" do
187
- it "raises NotFoundError" do
188
- stub_request(:post, %r[/v1]).
189
- to_return(read_fixture("templates/notfound.http"))
190
-
191
- expect {
192
- subject.apply(1, 2)
160
+ subject.delete_template(1)
193
161
  }.to raise_error(Dnsimple::NotFoundError)
194
162
  end
195
163
  end