dnsimple 4.2.0 → 4.3.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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_dnsimple.yml +128 -74
  3. data/.travis.yml +2 -2
  4. data/CHANGELOG.md +9 -0
  5. data/LICENSE.txt +1 -1
  6. data/README.md +1 -1
  7. data/dnsimple.gemspec +2 -2
  8. data/lib/dnsimple/client/certificates.rb +24 -0
  9. data/lib/dnsimple/client/registrar.rb +4 -4
  10. data/lib/dnsimple/version.rb +1 -1
  11. data/spec/dnsimple/client/accounts_spec.rb +4 -4
  12. data/spec/dnsimple/client/certificates_spec.rb +43 -22
  13. data/spec/dnsimple/client/client_service_spec.rb +6 -6
  14. data/spec/dnsimple/client/collaborators_spec.rb +20 -20
  15. data/spec/dnsimple/client/contacts_spec.rb +30 -30
  16. data/spec/dnsimple/client/domains_delegation_signer_records_spec.rb +25 -25
  17. data/spec/dnsimple/client/domains_dnssec_spec.rb +18 -18
  18. data/spec/dnsimple/client/domains_email_forwards_spec.rb +25 -25
  19. data/spec/dnsimple/client/domains_pushes_spec.rb +22 -22
  20. data/spec/dnsimple/client/domains_spec.rb +27 -27
  21. data/spec/dnsimple/client/identity_spec.rb +8 -8
  22. data/spec/dnsimple/client/oauth_spec.rb +8 -8
  23. data/spec/dnsimple/client/registrar_auto_renewal_spec.rb +12 -12
  24. data/spec/dnsimple/client/registrar_delegation_spec.rb +18 -18
  25. data/spec/dnsimple/client/registrar_spec.rb +37 -37
  26. data/spec/dnsimple/client/registrar_whois_privacy_spec.rb +16 -16
  27. data/spec/dnsimple/client/services_domains_spec.rb +13 -13
  28. data/spec/dnsimple/client/services_spec.rb +10 -10
  29. data/spec/dnsimple/client/templates_domains_spec.rb +4 -4
  30. data/spec/dnsimple/client/templates_records_spec.rb +25 -25
  31. data/spec/dnsimple/client/templates_spec.rb +26 -26
  32. data/spec/dnsimple/client/tlds_spec.rb +16 -16
  33. data/spec/dnsimple/client/vanity_name_servers_spec.rb +8 -8
  34. data/spec/dnsimple/client/webhooks_spec.rb +21 -21
  35. data/spec/dnsimple/client/zones_records_spec.rb +40 -40
  36. data/spec/dnsimple/client/zones_spec.rb +18 -18
  37. data/spec/dnsimple/client_spec.rb +25 -25
  38. metadata +3 -5
@@ -11,15 +11,15 @@ describe Dnsimple::Client, ".templates" do
11
11
  let(:domain_id) { 'example.com' }
12
12
 
13
13
  before do
14
- stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/templates/#{template_id}$}).
15
- to_return(read_http_fixture("applyTemplate/success.http"))
14
+ stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/templates/#{template_id}$})
15
+ .to_return(read_http_fixture("applyTemplate/success.http"))
16
16
  end
17
17
 
18
18
  it "builds the correct request" do
19
19
  subject.apply_template(account_id, template_id, domain_id)
20
20
 
21
- expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/templates/#{template_id}").
22
- with(headers: { "Accept" => "application/json" })
21
+ expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/templates/#{template_id}")
22
+ .with(headers: { "Accept" => "application/json" })
23
23
  end
24
24
 
25
25
  it "returns nil" do
@@ -10,15 +10,15 @@ describe Dnsimple::Client, ".templates" do
10
10
  let(:template_id) { "alpha" }
11
11
 
12
12
  before do
13
- stub_request(:get, %r{/v2/#{account_id}/templates/#{template_id}/records}).
14
- to_return(read_http_fixture("listTemplateRecords/success.http"))
13
+ stub_request(:get, %r{/v2/#{account_id}/templates/#{template_id}/records})
14
+ .to_return(read_http_fixture("listTemplateRecords/success.http"))
15
15
  end
16
16
 
17
17
  it "builds the correct request" do
18
18
  subject.records(account_id, template_id)
19
19
 
20
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/templates/#{template_id}/records").
21
- with(headers: { "Accept" => "application/json" })
20
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/templates/#{template_id}/records")
21
+ .with(headers: { "Accept" => "application/json" })
22
22
  end
23
23
 
24
24
  it "supports pagination" do
@@ -55,8 +55,8 @@ describe Dnsimple::Client, ".templates" do
55
55
 
56
56
  describe "#all_templates" do
57
57
  before do
58
- stub_request(:get, %r{/v2/#{account_id}/templates/#{template_id}/records}).
59
- to_return(read_http_fixture("listTemplateRecords/success.http"))
58
+ stub_request(:get, %r{/v2/#{account_id}/templates/#{template_id}/records})
59
+ .to_return(read_http_fixture("listTemplateRecords/success.http"))
60
60
  end
61
61
 
62
62
  let(:account_id) { 1010 }
@@ -79,8 +79,8 @@ describe Dnsimple::Client, ".templates" do
79
79
  let(:template_id) { "alpha" }
80
80
 
81
81
  before do
82
- stub_request(:post, %r{/v2/#{account_id}/templates/#{template_id}/records$}).
83
- to_return(read_http_fixture("createTemplateRecord/created.http"))
82
+ stub_request(:post, %r{/v2/#{account_id}/templates/#{template_id}/records$})
83
+ .to_return(read_http_fixture("createTemplateRecord/created.http"))
84
84
  end
85
85
 
86
86
  let(:attributes) { { type: "MX", name: "", content: "mx.example.com", priority: 10, ttl: 600 } }
@@ -88,9 +88,9 @@ describe Dnsimple::Client, ".templates" do
88
88
  it "builds the correct request" do
89
89
  subject.create_record(account_id, template_id, attributes)
90
90
 
91
- expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/templates/#{template_id}/records").
92
- with(body: attributes).
93
- with(headers: { 'Accept' => 'application/json' })
91
+ expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/templates/#{template_id}/records")
92
+ .with(body: attributes)
93
+ .with(headers: { 'Accept' => 'application/json' })
94
94
  end
95
95
 
96
96
  it "returns the record" do
@@ -132,8 +132,8 @@ describe Dnsimple::Client, ".templates" do
132
132
 
133
133
  context "when the template does not exist" do
134
134
  it "raises NotFoundError" do
135
- stub_request(:post, %r{/v2}).
136
- to_return(read_http_fixture("notfound-template.http"))
135
+ stub_request(:post, %r{/v2})
136
+ .to_return(read_http_fixture("notfound-template.http"))
137
137
 
138
138
  expect {
139
139
  subject.create_record(account_id, template_id, attributes)
@@ -147,15 +147,15 @@ describe Dnsimple::Client, ".templates" do
147
147
  let(:template_id) { "alpha.com" }
148
148
 
149
149
  before do
150
- stub_request(:get, %r{/v2/#{account_id}/templates/#{template_id}/records/.+$}).
151
- to_return(read_http_fixture("getTemplateRecord/success.http"))
150
+ stub_request(:get, %r{/v2/#{account_id}/templates/#{template_id}/records/.+$})
151
+ .to_return(read_http_fixture("getTemplateRecord/success.http"))
152
152
  end
153
153
 
154
154
  it "builds the correct request" do
155
155
  subject.record(account_id, template_id, record_id = 301)
156
156
 
157
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/templates/#{template_id}/records/#{record_id}").
158
- with(headers: { 'Accept' => 'application/json' })
157
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/templates/#{template_id}/records/#{record_id}")
158
+ .with(headers: { 'Accept' => 'application/json' })
159
159
  end
160
160
 
161
161
  it "returns the record" do
@@ -181,15 +181,15 @@ describe Dnsimple::Client, ".templates" do
181
181
  let(:template_id) { "example.com" }
182
182
 
183
183
  before do
184
- stub_request(:delete, %r{/v2/#{account_id}/templates/#{template_id}/records/.+$}).
185
- to_return(read_http_fixture("deleteTemplateRecord/success.http"))
184
+ stub_request(:delete, %r{/v2/#{account_id}/templates/#{template_id}/records/.+$})
185
+ .to_return(read_http_fixture("deleteTemplateRecord/success.http"))
186
186
  end
187
187
 
188
188
  it "builds the correct request" do
189
189
  subject.delete_record(account_id, template_id, record_id = 301)
190
190
 
191
- expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/templates/#{template_id}/records/#{record_id}").
192
- with(headers: { 'Accept' => 'application/json' })
191
+ expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/templates/#{template_id}/records/#{record_id}")
192
+ .with(headers: { 'Accept' => 'application/json' })
193
193
  end
194
194
 
195
195
  it "returns nothing" do
@@ -202,8 +202,8 @@ describe Dnsimple::Client, ".templates" do
202
202
 
203
203
  context "when the template does not exist" do
204
204
  it "raises NotFoundError" do
205
- stub_request(:delete, %r{/v2}).
206
- to_return(read_http_fixture("notfound-template.http"))
205
+ stub_request(:delete, %r{/v2})
206
+ .to_return(read_http_fixture("notfound-template.http"))
207
207
 
208
208
  expect {
209
209
  subject.delete_record(account_id, template_id, 0)
@@ -213,8 +213,8 @@ describe Dnsimple::Client, ".templates" do
213
213
 
214
214
  context "when the record does not exist" do
215
215
  it "raises NotFoundError" do
216
- stub_request(:delete, %r{/v2}).
217
- to_return(read_http_fixture("notfound-record.http"))
216
+ stub_request(:delete, %r{/v2})
217
+ .to_return(read_http_fixture("notfound-record.http"))
218
218
 
219
219
  expect {
220
220
  subject.delete_record(account_id, template_id, 0)
@@ -9,15 +9,15 @@ describe Dnsimple::Client, ".templates" do
9
9
  let(:account_id) { 1010 }
10
10
 
11
11
  before do
12
- stub_request(:get, %r{/v2/#{account_id}/templates}).
13
- to_return(read_http_fixture("listTemplates/success.http"))
12
+ stub_request(:get, %r{/v2/#{account_id}/templates})
13
+ .to_return(read_http_fixture("listTemplates/success.http"))
14
14
  end
15
15
 
16
16
  it "builds the correct request" do
17
17
  subject.list_templates(account_id)
18
18
 
19
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/templates").
20
- with(headers: { "Accept" => "application/json" })
19
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/templates")
20
+ .with(headers: { "Accept" => "application/json" })
21
21
  end
22
22
 
23
23
  it "supports pagination" do
@@ -55,8 +55,8 @@ describe Dnsimple::Client, ".templates" do
55
55
 
56
56
  describe "#all_templates" do
57
57
  before do
58
- stub_request(:get, %r{/v2/#{account_id}/templates}).
59
- to_return(read_http_fixture("listTemplates/success.http"))
58
+ stub_request(:get, %r{/v2/#{account_id}/templates})
59
+ .to_return(read_http_fixture("listTemplates/success.http"))
60
60
  end
61
61
 
62
62
  let(:account_id) { 1010 }
@@ -77,8 +77,8 @@ describe Dnsimple::Client, ".templates" do
77
77
  let(:account_id) { 1010 }
78
78
 
79
79
  before do
80
- stub_request(:post, %r{/v2/#{account_id}/templates$}).
81
- to_return(read_http_fixture("createTemplate/created.http"))
80
+ stub_request(:post, %r{/v2/#{account_id}/templates$})
81
+ .to_return(read_http_fixture("createTemplate/created.http"))
82
82
  end
83
83
 
84
84
  let(:attributes) { { name: "Beta", short_name: "beta", description: "A beta template." } }
@@ -86,8 +86,8 @@ describe Dnsimple::Client, ".templates" do
86
86
  it "builds the correct request" do
87
87
  subject.create_template(account_id, attributes)
88
88
 
89
- expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/templates").
90
- with(headers: { "Accept" => "application/json" })
89
+ expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/templates")
90
+ .with(headers: { "Accept" => "application/json" })
91
91
  end
92
92
 
93
93
  it "returns the list of templates" do
@@ -109,15 +109,15 @@ describe Dnsimple::Client, ".templates" do
109
109
  let(:template_id) { 1 }
110
110
 
111
111
  before do
112
- stub_request(:get, %r{/v2/#{account_id}/templates/#{template_id}$}).
113
- to_return(read_http_fixture("getTemplate/success.http"))
112
+ stub_request(:get, %r{/v2/#{account_id}/templates/#{template_id}$})
113
+ .to_return(read_http_fixture("getTemplate/success.http"))
114
114
  end
115
115
 
116
116
  it "builds the correct request" do
117
117
  subject.template(account_id, template_id)
118
118
 
119
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/templates/#{template_id}").
120
- with(headers: { "Accept" => "application/json" })
119
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/templates/#{template_id}")
120
+ .with(headers: { "Accept" => "application/json" })
121
121
  end
122
122
 
123
123
  it "returns the list of templates" do
@@ -139,8 +139,8 @@ describe Dnsimple::Client, ".templates" do
139
139
  let(:template_id) { 1 }
140
140
 
141
141
  before do
142
- stub_request(:patch, %r{/v2/#{account_id}/templates/#{template_id}$}).
143
- to_return(read_http_fixture("updateTemplate/success.http"))
142
+ stub_request(:patch, %r{/v2/#{account_id}/templates/#{template_id}$})
143
+ .to_return(read_http_fixture("updateTemplate/success.http"))
144
144
  end
145
145
 
146
146
  let(:attributes) { { name: "Alpha", short_name: "alpha", description: "An alpha template." } }
@@ -148,8 +148,8 @@ describe Dnsimple::Client, ".templates" do
148
148
  it "builds the correct request" do
149
149
  subject.update_template(account_id, template_id, attributes)
150
150
 
151
- expect(WebMock).to have_requested(:patch, "https://api.dnsimple.test/v2/#{account_id}/templates/#{template_id}").
152
- with(headers: { "Accept" => "application/json" })
151
+ expect(WebMock).to have_requested(:patch, "https://api.dnsimple.test/v2/#{account_id}/templates/#{template_id}")
152
+ .with(headers: { "Accept" => "application/json" })
153
153
  end
154
154
 
155
155
  it "returns the list of templates" do
@@ -171,15 +171,15 @@ describe Dnsimple::Client, ".templates" do
171
171
  let(:template_id) { 5410 }
172
172
 
173
173
  before do
174
- stub_request(:delete, %r{/v2/#{account_id}/templates/#{template_id}$}).
175
- to_return(read_http_fixture("deleteTemplate/success.http"))
174
+ stub_request(:delete, %r{/v2/#{account_id}/templates/#{template_id}$})
175
+ .to_return(read_http_fixture("deleteTemplate/success.http"))
176
176
  end
177
177
 
178
178
  it "builds the correct request" do
179
179
  subject.delete_template(account_id, template_id)
180
180
 
181
- expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/templates/#{template_id}").
182
- with(headers: { "Accept" => "application/json" })
181
+ expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/templates/#{template_id}")
182
+ .with(headers: { "Accept" => "application/json" })
183
183
  end
184
184
 
185
185
  it "returns nil" do
@@ -195,15 +195,15 @@ describe Dnsimple::Client, ".templates" do
195
195
  let(:domain_id) { 'example.com' }
196
196
 
197
197
  before do
198
- stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/templates/#{template_id}$}).
199
- to_return(read_http_fixture("applyTemplate/success.http"))
198
+ stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/templates/#{template_id}$})
199
+ .to_return(read_http_fixture("applyTemplate/success.http"))
200
200
  end
201
201
 
202
202
  it "builds the correct request" do
203
203
  subject.apply_template(account_id, template_id, domain_id)
204
204
 
205
- expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/templates/#{template_id}").
206
- with(headers: { "Accept" => "application/json" })
205
+ expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/templates/#{template_id}")
206
+ .with(headers: { "Accept" => "application/json" })
207
207
  end
208
208
 
209
209
  it "returns nil" do
@@ -5,15 +5,15 @@ describe Dnsimple::Client, ".tlds" do
5
5
 
6
6
  describe "#tlds" do
7
7
  before do
8
- stub_request(:get, %r{/v2/tlds}).
9
- to_return(read_http_fixture("listTlds/success.http"))
8
+ stub_request(:get, %r{/v2/tlds})
9
+ .to_return(read_http_fixture("listTlds/success.http"))
10
10
  end
11
11
 
12
12
  it "builds the correct request" do
13
13
  subject.tlds
14
14
 
15
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/tlds").
16
- with(headers: { 'Accept' => 'application/json' })
15
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/tlds")
16
+ .with(headers: { 'Accept' => 'application/json' })
17
17
  end
18
18
 
19
19
  it "supports pagination" do
@@ -61,8 +61,8 @@ describe Dnsimple::Client, ".tlds" do
61
61
 
62
62
  describe "#all_tlds" do
63
63
  before do
64
- stub_request(:get, %r{/v2/tlds}).
65
- to_return(read_http_fixture("listTlds/success.http"))
64
+ stub_request(:get, %r{/v2/tlds})
65
+ .to_return(read_http_fixture("listTlds/success.http"))
66
66
  end
67
67
 
68
68
  it "delegates to client.paginate" do
@@ -79,15 +79,15 @@ describe Dnsimple::Client, ".tlds" do
79
79
 
80
80
  describe "#tld" do
81
81
  before do
82
- stub_request(:get, %r{/v2/tlds/.+$}).
83
- to_return(read_http_fixture("getTld/success.http"))
82
+ stub_request(:get, %r{/v2/tlds/.+$})
83
+ .to_return(read_http_fixture("getTld/success.http"))
84
84
  end
85
85
 
86
86
  it "builds the correct request" do
87
87
  subject.tld(tld = "com")
88
88
 
89
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/tlds/#{tld}").
90
- with(headers: { 'Accept' => 'application/json' })
89
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/tlds/#{tld}")
90
+ .with(headers: { 'Accept' => 'application/json' })
91
91
  end
92
92
 
93
93
  it "returns the tld" do
@@ -110,15 +110,15 @@ describe Dnsimple::Client, ".tlds" do
110
110
 
111
111
  describe "#extended_attributes" do
112
112
  before do
113
- stub_request(:get, %r{/v2/tlds/uk/extended_attributes$}).
114
- to_return(read_http_fixture("getTldExtendedAttributes/success.http"))
113
+ stub_request(:get, %r{/v2/tlds/uk/extended_attributes$})
114
+ .to_return(read_http_fixture("getTldExtendedAttributes/success.http"))
115
115
  end
116
116
 
117
117
  it "builds the correct request" do
118
118
  subject.extended_attributes(tld = "uk")
119
119
 
120
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/tlds/#{tld}/extended_attributes").
121
- with(headers: { 'Accept' => 'application/json' })
120
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/tlds/#{tld}/extended_attributes")
121
+ .with(headers: { 'Accept' => 'application/json' })
122
122
  end
123
123
 
124
124
  it "returns the extended attributes" do
@@ -143,8 +143,8 @@ describe Dnsimple::Client, ".tlds" do
143
143
 
144
144
  context "when there are no extended attributes for a TLD" do
145
145
  before do
146
- stub_request(:get, %r{/v2/tlds/com/extended_attributes$}).
147
- to_return(read_http_fixture("getTldExtendedAttributes/success-noattributes.http"))
146
+ stub_request(:get, %r{/v2/tlds/com/extended_attributes$})
147
+ .to_return(read_http_fixture("getTldExtendedAttributes/success-noattributes.http"))
148
148
  end
149
149
 
150
150
  it "returns an empty CollectionResponse" do
@@ -8,15 +8,15 @@ describe Dnsimple::Client, ".vanity_name_servers" do
8
8
  let(:account_id) { 1010 }
9
9
 
10
10
  before do
11
- stub_request(:put, %r{/v2/#{account_id}/vanity/.+$}).
12
- to_return(read_http_fixture("enableVanityNameServers/success.http"))
11
+ stub_request(:put, %r{/v2/#{account_id}/vanity/.+$})
12
+ .to_return(read_http_fixture("enableVanityNameServers/success.http"))
13
13
  end
14
14
 
15
15
  it "builds the correct request" do
16
16
  subject.enable_vanity_name_servers(account_id, domain_name = "example.com")
17
17
 
18
- expect(WebMock).to have_requested(:put, "https://api.dnsimple.test/v2/#{account_id}/vanity/#{domain_name}").
19
- with(headers: { "Accept" => "application/json" })
18
+ expect(WebMock).to have_requested(:put, "https://api.dnsimple.test/v2/#{account_id}/vanity/#{domain_name}")
19
+ .with(headers: { "Accept" => "application/json" })
20
20
  end
21
21
 
22
22
  it "returns vanity name servers of the domain" do
@@ -32,15 +32,15 @@ describe Dnsimple::Client, ".vanity_name_servers" do
32
32
  let(:account_id) { 1010 }
33
33
 
34
34
  before do
35
- stub_request(:delete, %r{/v2/#{account_id}/vanity/.+$}).
36
- to_return(read_http_fixture("disableVanityNameServers/success.http"))
35
+ stub_request(:delete, %r{/v2/#{account_id}/vanity/.+$})
36
+ .to_return(read_http_fixture("disableVanityNameServers/success.http"))
37
37
  end
38
38
 
39
39
  it "builds the correct request" do
40
40
  subject.disable_vanity_name_servers(account_id, domain_name = "example.com")
41
41
 
42
- expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/vanity/#{domain_name}").
43
- with(headers: { "Accept" => "application/json" })
42
+ expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/vanity/#{domain_name}")
43
+ .with(headers: { "Accept" => "application/json" })
44
44
  end
45
45
 
46
46
  it "returns empty response" do
@@ -8,15 +8,15 @@ describe Dnsimple::Client, ".webhooks" do
8
8
  let(:account_id) { 1010 }
9
9
 
10
10
  before do
11
- stub_request(:get, %r{/v2/#{account_id}/webhooks}).
12
- to_return(read_http_fixture("listWebhooks/success.http"))
11
+ stub_request(:get, %r{/v2/#{account_id}/webhooks})
12
+ .to_return(read_http_fixture("listWebhooks/success.http"))
13
13
  end
14
14
 
15
15
  it "builds the correct request" do
16
16
  subject.webhooks(account_id)
17
17
 
18
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/webhooks").
19
- with(headers: { 'Accept' => 'application/json' })
18
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/webhooks")
19
+ .with(headers: { 'Accept' => 'application/json' })
20
20
  end
21
21
 
22
22
  it "supports extra request options" do
@@ -49,8 +49,8 @@ describe Dnsimple::Client, ".webhooks" do
49
49
  let(:account_id) { 1010 }
50
50
 
51
51
  before do
52
- stub_request(:post, %r{/v2/#{account_id}/webhooks$}).
53
- to_return(read_http_fixture("createWebhook/created.http"))
52
+ stub_request(:post, %r{/v2/#{account_id}/webhooks$})
53
+ .to_return(read_http_fixture("createWebhook/created.http"))
54
54
  end
55
55
 
56
56
  let(:attributes) { { url: "https://webhook.test" } }
@@ -58,9 +58,9 @@ describe Dnsimple::Client, ".webhooks" do
58
58
  it "builds the correct request" do
59
59
  subject.create_webhook(account_id, attributes)
60
60
 
61
- expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/webhooks").
62
- with(body: attributes).
63
- with(headers: { 'Accept' => 'application/json' })
61
+ expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/webhooks")
62
+ .with(body: attributes)
63
+ .with(headers: { 'Accept' => 'application/json' })
64
64
  end
65
65
 
66
66
  it "returns the webhook" do
@@ -77,15 +77,15 @@ describe Dnsimple::Client, ".webhooks" do
77
77
  let(:account_id) { 1010 }
78
78
 
79
79
  before do
80
- stub_request(:get, %r{/v2/#{account_id}/webhooks/.+$}).
81
- to_return(read_http_fixture("getWebhook/success.http"))
80
+ stub_request(:get, %r{/v2/#{account_id}/webhooks/.+$})
81
+ .to_return(read_http_fixture("getWebhook/success.http"))
82
82
  end
83
83
 
84
84
  it "builds the correct request" do
85
85
  subject.webhook(account_id, webhook_id = "1")
86
86
 
87
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/webhooks/#{webhook_id}").
88
- with(headers: { 'Accept' => 'application/json' })
87
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/webhooks/#{webhook_id}")
88
+ .with(headers: { 'Accept' => 'application/json' })
89
89
  end
90
90
 
91
91
  it "returns the webhook" do
@@ -100,8 +100,8 @@ describe Dnsimple::Client, ".webhooks" do
100
100
 
101
101
  context "when the webhook does not exist" do
102
102
  it "raises NotFoundError" do
103
- stub_request(:get, %r{/v2}).
104
- to_return(read_http_fixture("notfound-webhook.http"))
103
+ stub_request(:get, %r{/v2})
104
+ .to_return(read_http_fixture("notfound-webhook.http"))
105
105
 
106
106
  expect {
107
107
  subject.webhook(account_id, 0)
@@ -114,15 +114,15 @@ describe Dnsimple::Client, ".webhooks" do
114
114
  let(:account_id) { 1010 }
115
115
 
116
116
  before do
117
- stub_request(:delete, %r{/v2/#{account_id}/webhooks/.+$}).
118
- to_return(read_http_fixture("deleteWebhook/success.http"))
117
+ stub_request(:delete, %r{/v2/#{account_id}/webhooks/.+$})
118
+ .to_return(read_http_fixture("deleteWebhook/success.http"))
119
119
  end
120
120
 
121
121
  it "builds the correct request" do
122
122
  subject.delete_webhook(account_id, webhook_id = "1")
123
123
 
124
- expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/webhooks/#{webhook_id}").
125
- with(headers: { 'Accept' => 'application/json' })
124
+ expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/webhooks/#{webhook_id}")
125
+ .with(headers: { 'Accept' => 'application/json' })
126
126
  end
127
127
 
128
128
  it "returns nothing" do
@@ -135,8 +135,8 @@ describe Dnsimple::Client, ".webhooks" do
135
135
 
136
136
  context "when the webhook does not exist" do
137
137
  it "raises NotFoundError" do
138
- stub_request(:delete, %r{/v2}).
139
- to_return(read_http_fixture("notfound-webhook.http"))
138
+ stub_request(:delete, %r{/v2})
139
+ .to_return(read_http_fixture("notfound-webhook.http"))
140
140
 
141
141
  expect {
142
142
  subject.delete_webhook(account_id, 0)