dnsimple 3.0.0.pre.beta2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +13 -0
  3. data/.rubocop_dnsimple.yml +216 -0
  4. data/.rubocop_todo.yml +14 -0
  5. data/CHANGELOG.md +16 -1
  6. data/Gemfile +1 -0
  7. data/Rakefile +8 -3
  8. data/lib/dnsimple/client.rb +9 -12
  9. data/lib/dnsimple/client/clients.rb +36 -2
  10. data/lib/dnsimple/client/contacts.rb +6 -6
  11. data/lib/dnsimple/client/domains.rb +5 -5
  12. data/lib/dnsimple/client/identity.rb +2 -2
  13. data/lib/dnsimple/client/oauth.rb +2 -2
  14. data/lib/dnsimple/client/registrar.rb +1 -1
  15. data/lib/dnsimple/client/registrar_auto_renewal.rb +2 -2
  16. data/lib/dnsimple/client/registrar_delegation.rb +49 -0
  17. data/lib/dnsimple/client/registrar_whois_privacy.rb +1 -1
  18. data/lib/dnsimple/client/services.rb +68 -0
  19. data/lib/dnsimple/client/templates.rb +139 -0
  20. data/lib/dnsimple/client/tlds.rb +3 -3
  21. data/lib/dnsimple/client/webhooks.rb +4 -4
  22. data/lib/dnsimple/client/zones.rb +2 -2
  23. data/lib/dnsimple/client/zones_records.rb +1 -1
  24. data/lib/dnsimple/default.rb +2 -2
  25. data/lib/dnsimple/error.rb +14 -1
  26. data/lib/dnsimple/struct.rb +3 -1
  27. data/lib/dnsimple/struct/contact.rb +2 -2
  28. data/lib/dnsimple/struct/extended_attribute.rb +5 -1
  29. data/lib/dnsimple/struct/service.rb +64 -0
  30. data/lib/dnsimple/struct/template.rb +22 -0
  31. data/lib/dnsimple/struct/tld.rb +1 -1
  32. data/lib/dnsimple/version.rb +1 -1
  33. data/spec/dnsimple/client/client_service_spec.rb +6 -6
  34. data/spec/dnsimple/client/contacts_spec.rb +30 -30
  35. data/spec/dnsimple/client/domains_email_forwards_spec.rb +25 -25
  36. data/spec/dnsimple/client/domains_spec.rb +27 -27
  37. data/spec/dnsimple/client/identity_spec.rb +8 -8
  38. data/spec/dnsimple/client/oauth_spec.rb +9 -9
  39. data/spec/dnsimple/client/registrar_auto_renewal_spec.rb +13 -13
  40. data/spec/dnsimple/client/registrar_delegation_spec.rb +55 -0
  41. data/spec/dnsimple/client/registrar_spec.rb +29 -29
  42. data/spec/dnsimple/client/registrar_whois_privacy_spec.rb +16 -16
  43. data/spec/dnsimple/client/services_spec.rb +78 -0
  44. data/spec/dnsimple/client/templates_spec.rb +163 -0
  45. data/spec/dnsimple/client/tlds_spec.rb +22 -23
  46. data/spec/dnsimple/client/webhooks_spec.rb +22 -22
  47. data/spec/dnsimple/client/zones_records_spec.rb +40 -40
  48. data/spec/dnsimple/client/zones_spec.rb +12 -12
  49. data/spec/dnsimple/client_spec.rb +52 -44
  50. data/spec/dnsimple/extra_spec.rb +3 -3
  51. data/spec/fixtures.http/changeDomainDelegation/success.http +17 -0
  52. data/spec/fixtures.http/createTemplate/created.http +17 -0
  53. data/spec/fixtures.http/deleteTemplate/success.http +13 -0
  54. data/spec/fixtures.http/getDomainDelegation/success-empty.http +17 -0
  55. data/spec/fixtures.http/getDomainDelegation/success.http +17 -0
  56. data/spec/fixtures.http/getService/success.http +17 -0
  57. data/spec/fixtures.http/getTemplate/success.http +17 -0
  58. data/spec/fixtures.http/listServices/success.http +17 -0
  59. data/spec/fixtures.http/listTemplates/success.http +17 -0
  60. data/spec/fixtures.http/method-not-allowed.http +11 -0
  61. data/spec/fixtures.http/updateTemplate/success.http +17 -0
  62. metadata +41 -5
@@ -9,15 +9,15 @@ describe Dnsimple::Client, ".domains" do
9
9
  let(:account_id) { 1010 }
10
10
 
11
11
  before do
12
- stub_request(:get, %r[/v2/#{account_id}/domains])
13
- .to_return(read_http_fixture("listDomains/success.http"))
12
+ stub_request(:get, %r{/v2/#{account_id}/domains}).
13
+ to_return(read_http_fixture("listDomains/success.http"))
14
14
  end
15
15
 
16
16
  it "builds the correct request" do
17
17
  subject.domains(account_id)
18
18
 
19
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains")
20
- .with(headers: { 'Accept' => 'application/json' })
19
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains").
20
+ with(headers: { 'Accept' => 'application/json' })
21
21
  end
22
22
 
23
23
  it "supports pagination" do
@@ -60,8 +60,8 @@ describe Dnsimple::Client, ".domains" do
60
60
  let(:account_id) { 1010 }
61
61
 
62
62
  it "delegates to client.paginate" do
63
- expect(subject).to receive(:paginate).with(:domains, account_id, { foo: "bar" })
64
- subject.all_domains(account_id, { foo: "bar" })
63
+ expect(subject).to receive(:paginate).with(:domains, account_id, foo: "bar")
64
+ subject.all_domains(account_id, foo: "bar")
65
65
  end
66
66
  end
67
67
 
@@ -69,8 +69,8 @@ describe Dnsimple::Client, ".domains" do
69
69
  let(:account_id) { 1010 }
70
70
 
71
71
  before do
72
- stub_request(:post, %r[/v2/#{account_id}/domains$])
73
- .to_return(read_http_fixture("createDomain/created.http"))
72
+ stub_request(:post, %r{/v2/#{account_id}/domains$}).
73
+ to_return(read_http_fixture("createDomain/created.http"))
74
74
  end
75
75
 
76
76
  let(:attributes) { { name: "example.com" } }
@@ -78,9 +78,9 @@ describe Dnsimple::Client, ".domains" do
78
78
  it "builds the correct request" do
79
79
  subject.create_domain(account_id, attributes)
80
80
 
81
- expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains")
82
- .with(body: attributes)
83
- .with(headers: { 'Accept' => 'application/json' })
81
+ expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains").
82
+ with(body: attributes).
83
+ with(headers: { 'Accept' => 'application/json' })
84
84
  end
85
85
 
86
86
  it "returns the domain" do
@@ -97,15 +97,15 @@ describe Dnsimple::Client, ".domains" do
97
97
  let(:account_id) { 1010 }
98
98
 
99
99
  before do
100
- stub_request(:get, %r[/v2/#{account_id}/domains/.+$])
101
- .to_return(read_http_fixture("getDomain/success.http"))
100
+ stub_request(:get, %r{/v2/#{account_id}/domains/.+$}).
101
+ to_return(read_http_fixture("getDomain/success.http"))
102
102
  end
103
103
 
104
104
  it "builds the correct request" do
105
105
  subject.domain(account_id, domain = "example.com")
106
106
 
107
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain}")
108
- .with(headers: { 'Accept' => 'application/json' })
107
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain}").
108
+ with(headers: { 'Accept' => 'application/json' })
109
109
  end
110
110
 
111
111
  it "returns the domain" do
@@ -128,8 +128,8 @@ describe Dnsimple::Client, ".domains" do
128
128
 
129
129
  context "when the domain does not exist" do
130
130
  it "raises NotFoundError" do
131
- stub_request(:get, %r[/v2])
132
- .to_return(read_http_fixture("notfound-domain.http"))
131
+ stub_request(:get, %r{/v2}).
132
+ to_return(read_http_fixture("notfound-domain.http"))
133
133
 
134
134
  expect {
135
135
  subject.domain(account_id, "example.com")
@@ -142,15 +142,15 @@ describe Dnsimple::Client, ".domains" do
142
142
  let(:account_id) { 1010 }
143
143
 
144
144
  before do
145
- stub_request(:delete, %r[/v2/#{account_id}/domains/.+$])
146
- .to_return(read_http_fixture("deleteDomain/success.http"))
145
+ stub_request(:delete, %r{/v2/#{account_id}/domains/.+$}).
146
+ to_return(read_http_fixture("deleteDomain/success.http"))
147
147
  end
148
148
 
149
149
  it "builds the correct request" do
150
150
  subject.delete_domain(account_id, domain = "example.com")
151
151
 
152
- expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain}")
153
- .with(headers: { 'Accept' => 'application/json' })
152
+ expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain}").
153
+ with(headers: { 'Accept' => 'application/json' })
154
154
  end
155
155
 
156
156
  it "returns nothing" do
@@ -163,8 +163,8 @@ describe Dnsimple::Client, ".domains" do
163
163
 
164
164
  context "when the domain does not exist" do
165
165
  it "raises NotFoundError" do
166
- stub_request(:delete, %r[/v2])
167
- .to_return(read_http_fixture("notfound-domain.http"))
166
+ stub_request(:delete, %r{/v2}).
167
+ to_return(read_http_fixture("notfound-domain.http"))
168
168
 
169
169
  expect {
170
170
  subject.delete_domain(account_id, "example.com")
@@ -178,15 +178,15 @@ describe Dnsimple::Client, ".domains" do
178
178
  let(:domain_id) { "example.com" }
179
179
 
180
180
  before do
181
- stub_request(:post, %r[/v2/#{account_id}/domains/#{domain_id}/token])
182
- .to_return(read_http_fixture("resetDomainToken/success.http"))
181
+ stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/token}).
182
+ to_return(read_http_fixture("resetDomainToken/success.http"))
183
183
  end
184
184
 
185
185
  it "builds the correct request" do
186
186
  subject.reset_domain_token(account_id, domain_id)
187
187
 
188
- expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/token")
189
- .with(headers: { 'Accept' => 'application/json' })
188
+ expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/token").
189
+ with(headers: { 'Accept' => 'application/json' })
190
190
  end
191
191
 
192
192
  it "returns the domain" do
@@ -7,15 +7,15 @@ describe Dnsimple::Client, ".identity" do
7
7
 
8
8
  describe "#whoami" do
9
9
  before do
10
- stub_request(:get, %r[/v2/whoami$])
11
- .to_return(read_http_fixture("whoami/success.http"))
10
+ stub_request(:get, %r{/v2/whoami$}).
11
+ to_return(read_http_fixture("whoami/success.http"))
12
12
  end
13
13
 
14
14
  it "builds the correct request" do
15
15
  subject.whoami
16
16
 
17
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/whoami")
18
- .with(headers: { 'Accept' => 'application/json' })
17
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/whoami").
18
+ with(headers: { 'Accept' => 'application/json' })
19
19
  end
20
20
 
21
21
  it "returns a response" do
@@ -28,8 +28,8 @@ describe Dnsimple::Client, ".identity" do
28
28
 
29
29
  context "when authenticated as account" do
30
30
  before do
31
- stub_request(:get, %r[/v2/whoami$])
32
- .to_return(read_http_fixture("whoami/success_account.http"))
31
+ stub_request(:get, %r{/v2/whoami$}).
32
+ to_return(read_http_fixture("whoami/success_account.http"))
33
33
  end
34
34
 
35
35
  it "sets the account" do
@@ -41,8 +41,8 @@ describe Dnsimple::Client, ".identity" do
41
41
 
42
42
  context "when authenticated as user" do
43
43
  before do
44
- stub_request(:get, %r[/v2/whoami$])
45
- .to_return(read_http_fixture("whoami/success_user.http"))
44
+ stub_request(:get, %r{/v2/whoami$}).
45
+ to_return(read_http_fixture("whoami/success_user.http"))
46
46
  end
47
47
 
48
48
  it "sets the user" do
@@ -11,16 +11,16 @@ describe Dnsimple::Client, ".oauth" do
11
11
  let(:code) { "super-code" }
12
12
 
13
13
  before do
14
- stub_request(:post, %r[/v2/oauth/access_token$])
15
- .to_return(read_http_fixture("oauthAccessToken/success.http"))
14
+ stub_request(:post, %r{/v2/oauth/access_token$}).
15
+ to_return(read_http_fixture("oauthAccessToken/success.http"))
16
16
  end
17
17
 
18
18
  it "builds the correct request" do
19
19
  subject.exchange_authorization_for_token(code, client_id, client_secret)
20
20
 
21
- expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/oauth/access_token")
22
- .with(body: { client_id: client_id, client_secret: client_secret, code: code, grant_type: "authorization_code" })
23
- .with(headers: { 'Accept' => 'application/json' })
21
+ expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/oauth/access_token").
22
+ with(body: { client_id: client_id, client_secret: client_secret, code: code, grant_type: "authorization_code" }).
23
+ with(headers: { 'Accept' => 'application/json' })
24
24
  end
25
25
 
26
26
  it "returns oauth token" do
@@ -37,11 +37,11 @@ describe Dnsimple::Client, ".oauth" do
37
37
  let(:redirect_uri) { "super-redirect-uri" }
38
38
 
39
39
  it "builds the correct request" do
40
- subject.exchange_authorization_for_token(code, client_id, client_secret, state:state, redirect_uri: redirect_uri)
40
+ subject.exchange_authorization_for_token(code, client_id, client_secret, state: state, redirect_uri: redirect_uri)
41
41
 
42
- expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/oauth/access_token")
43
- .with(body: { client_id: client_id, client_secret: client_secret, code: code, state: state, redirect_uri: redirect_uri, grant_type: "authorization_code" })
44
- .with(headers: { 'Accept' => 'application/json' })
42
+ expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/oauth/access_token").
43
+ with(body: { client_id: client_id, client_secret: client_secret, code: code, state: state, redirect_uri: redirect_uri, grant_type: "authorization_code" }).
44
+ with(headers: { 'Accept' => 'application/json' })
45
45
  end
46
46
  end
47
47
  end
@@ -9,16 +9,16 @@ describe Dnsimple::Client, ".registrar" do
9
9
  let(:domain_id) { "example.com" }
10
10
 
11
11
  before do
12
- stub_request(:put, %r[/v2/#{account_id}/registrar/domains/#{domain_id}])
13
- .to_return(read_http_fixture("enableAutoRenewal/success.http"))
12
+ stub_request(:put, %r{/v2/#{account_id}/registrar/domains/#{domain_id}}).
13
+ to_return(read_http_fixture("enableAutoRenewal/success.http"))
14
14
  end
15
15
 
16
16
 
17
17
  it "builds the correct request" do
18
18
  subject.enable_auto_renewal(account_id, domain_id)
19
19
 
20
- expect(WebMock).to have_requested(:put, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_id}/auto_renewal")
21
- .with(headers: { 'Accept' => 'application/json' })
20
+ expect(WebMock).to have_requested(:put, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_id}/auto_renewal").
21
+ with(headers: { 'Accept' => 'application/json' })
22
22
  end
23
23
 
24
24
  it "returns nothing" do
@@ -31,8 +31,8 @@ describe Dnsimple::Client, ".registrar" do
31
31
 
32
32
  context "when the domain does not exist" do
33
33
  it "raises NotFoundError" do
34
- stub_request(:put, %r[/v2])
35
- .to_return(read_http_fixture("notfound-domain.http"))
34
+ stub_request(:put, %r{/v2}).
35
+ to_return(read_http_fixture("notfound-domain.http"))
36
36
 
37
37
  expect {
38
38
  subject.enable_auto_renewal(account_id, domain_id)
@@ -40,22 +40,22 @@ describe Dnsimple::Client, ".registrar" do
40
40
  end
41
41
  end
42
42
  end
43
-
43
+
44
44
  describe "#disable_auto_renewal" do
45
45
  let(:account_id) { 1010 }
46
46
  let(:domain_id) { "example.com" }
47
47
 
48
48
  before do
49
- stub_request(:delete, %r[/v2/#{account_id}/registrar/domains/#{domain_id}])
50
- .to_return(read_http_fixture("disableAutoRenewal/success.http"))
49
+ stub_request(:delete, %r{/v2/#{account_id}/registrar/domains/#{domain_id}}).
50
+ to_return(read_http_fixture("disableAutoRenewal/success.http"))
51
51
  end
52
52
 
53
53
 
54
54
  it "builds the correct request" do
55
55
  subject.disable_auto_renewal(account_id, domain_id)
56
56
 
57
- expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_id}/auto_renewal")
58
- .with(headers: { 'Accept' => 'application/json' })
57
+ expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_id}/auto_renewal").
58
+ with(headers: { 'Accept' => 'application/json' })
59
59
  end
60
60
 
61
61
  it "returns nothing" do
@@ -68,8 +68,8 @@ describe Dnsimple::Client, ".registrar" do
68
68
 
69
69
  context "when the domain does not exist" do
70
70
  it "raises NotFoundError" do
71
- stub_request(:delete, %r[/v2])
72
- .to_return(read_http_fixture("notfound-domain.http"))
71
+ stub_request(:delete, %r{/v2}).
72
+ to_return(read_http_fixture("notfound-domain.http"))
73
73
 
74
74
  expect {
75
75
  subject.disable_auto_renewal(account_id, domain_id)
@@ -0,0 +1,55 @@
1
+ require 'spec_helper'
2
+
3
+ describe Dnsimple::Client, ".registrar" do
4
+
5
+ subject { described_class.new(base_url: "https://api.dnsimple.test", access_token: "a1b2c3").registrar }
6
+
7
+ describe "#domain_delegation" do
8
+ let(:account_id) { 1010 }
9
+
10
+ before do
11
+ stub_request(:get, %r{/v2/#{account_id}/registrar/domains/.+/delegation$}).
12
+ to_return(read_http_fixture("getDomainDelegation/success.http"))
13
+ end
14
+
15
+ it "builds the correct request" do
16
+ subject.domain_delegation(account_id, domain_name = "example.com")
17
+
18
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/delegation").
19
+ with(headers: { "Accept" => "application/json" })
20
+ end
21
+
22
+ it "returns the name servers of the domain" do
23
+ response = subject.domain_delegation(account_id, "example.com")
24
+ expect(response).to be_a(Dnsimple::Response)
25
+
26
+ expect(response.data).to match_array(%w(ns1.dnsimple.com ns2.dnsimple.com ns3.dnsimple.com ns4.dnsimple.com))
27
+ end
28
+ end
29
+
30
+ describe "#change_domain_delegation" do
31
+ let(:account_id) { 1010 }
32
+
33
+ before do
34
+ stub_request(:put, %r{/v2/#{account_id}/registrar/domains/.+/delegation$}).
35
+ to_return(read_http_fixture("changeDomainDelegation/success.http"))
36
+ end
37
+
38
+ let(:attributes) { %w(ns1.dnsimple.com ns2.dnsimple.com ns3.dnsimple.com ns4.dnsimple.com) }
39
+
40
+ it "builds the correct request" do
41
+ subject.change_domain_delegation(account_id, domain_name = "example.com", attributes)
42
+
43
+ expect(WebMock).to have_requested(:put, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/delegation").
44
+ with(body: JSON.dump(attributes)).
45
+ with(headers: { "Accept" => "application/json" })
46
+ end
47
+
48
+ it "returns the name servers of the domain" do
49
+ response = subject.change_domain_delegation(account_id, "example.com", attributes)
50
+ expect(response).to be_a(Dnsimple::Response)
51
+
52
+ expect(response.data).to match_array(%w(ns1.dnsimple.com ns2.dnsimple.com ns3.dnsimple.com ns4.dnsimple.com))
53
+ end
54
+ end
55
+ end
@@ -9,15 +9,15 @@ describe Dnsimple::Client, ".registrar" do
9
9
  let(:account_id) { 1010 }
10
10
 
11
11
  before do
12
- stub_request(:get, %r[/v2/#{account_id}/registrar/domains/.+/check$])
13
- .to_return(read_http_fixture("checkDomain/success.http"))
12
+ stub_request(:get, %r{/v2/#{account_id}/registrar/domains/.+/check$}).
13
+ to_return(read_http_fixture("checkDomain/success.http"))
14
14
  end
15
15
 
16
16
  it "builds the correct request" do
17
17
  subject.check_domain(account_id, domain_name = "example.com")
18
18
 
19
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/check")
20
- .with(headers: { "Accept" => "application/json" })
19
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/check").
20
+ with(headers: { "Accept" => "application/json" })
21
21
  end
22
22
 
23
23
  it "returns the availability" do
@@ -36,8 +36,8 @@ describe Dnsimple::Client, ".registrar" do
36
36
  let(:account_id) { 1010 }
37
37
 
38
38
  before do
39
- stub_request(:post, %r[/v2/#{account_id}/registrar/domains/.+/registration$])
40
- .to_return(read_http_fixture("registerDomain/success.http"))
39
+ stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/registration$}).
40
+ to_return(read_http_fixture("registerDomain/success.http"))
41
41
  end
42
42
 
43
43
  let(:attributes) { { registrant_id: "10" } }
@@ -45,9 +45,9 @@ describe Dnsimple::Client, ".registrar" do
45
45
  it "builds the correct request" do
46
46
  subject.register_domain(account_id, domain_name = "example.com", attributes)
47
47
 
48
- expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/registration")
49
- .with(body: attributes)
50
- .with(headers: { "Accept" => "application/json" })
48
+ expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/registration").
49
+ with(body: attributes).
50
+ with(headers: { "Accept" => "application/json" })
51
51
  end
52
52
 
53
53
  it "returns the domain" do
@@ -70,8 +70,8 @@ describe Dnsimple::Client, ".registrar" do
70
70
  let(:account_id) { 1010 }
71
71
 
72
72
  before do
73
- stub_request(:post, %r[/v2/#{account_id}/registrar/domains/.+/renew$])
74
- .to_return(read_http_fixture("renewDomain/success.http"))
73
+ stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/renewal$}).
74
+ to_return(read_http_fixture("renewDomain/success.http"))
75
75
  end
76
76
 
77
77
  let(:attributes) { { period: "3" } }
@@ -79,9 +79,9 @@ describe Dnsimple::Client, ".registrar" do
79
79
  it "builds the correct request" do
80
80
  subject.renew_domain(account_id, domain_name = "example.com", attributes)
81
81
 
82
- expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/renew")
83
- .with(body: attributes)
84
- .with(headers: { "Accept" => "application/json" })
82
+ expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/renewal").
83
+ with(body: attributes).
84
+ with(headers: { "Accept" => "application/json" })
85
85
  end
86
86
 
87
87
  it "returns the domain" do
@@ -95,8 +95,8 @@ describe Dnsimple::Client, ".registrar" do
95
95
 
96
96
  context "when it is too son for the domain to be renewed" do
97
97
  it "raises a BadRequestError" do
98
- stub_request(:post, %r[/v2/#{account_id}/registrar/domains/.+/renew$])
99
- .to_return(read_http_fixture("renewDomain/error-tooearly.http"))
98
+ stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/renewal$}).
99
+ to_return(read_http_fixture("renewDomain/error-tooearly.http"))
100
100
 
101
101
  expect {
102
102
  subject.renew_domain(account_id, "example.com", attributes)
@@ -109,8 +109,8 @@ describe Dnsimple::Client, ".registrar" do
109
109
  let(:account_id) { 1010 }
110
110
 
111
111
  before do
112
- stub_request(:post, %r[/v2/#{account_id}/registrar/domains/.+/transfer$])
113
- .to_return(read_http_fixture("transferDomain/success.http"))
112
+ stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/transfer$}).
113
+ to_return(read_http_fixture("transferDomain/success.http"))
114
114
  end
115
115
 
116
116
  let(:attributes) { { registrant_id: "10", auth_info: "x1y2z3" } }
@@ -118,9 +118,9 @@ describe Dnsimple::Client, ".registrar" do
118
118
  it "builds the correct request" do
119
119
  subject.transfer_domain(account_id, domain_name = "example.com", attributes)
120
120
 
121
- expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/transfer")
122
- .with(body: attributes)
123
- .with(headers: { "Accept" => "application/json" })
121
+ expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/transfer").
122
+ with(body: attributes).
123
+ with(headers: { "Accept" => "application/json" })
124
124
  end
125
125
 
126
126
  it "returns the domain" do
@@ -141,8 +141,8 @@ describe Dnsimple::Client, ".registrar" do
141
141
 
142
142
  context "when the domain is already in DNSimple" do
143
143
  it "raises a BadRequestError" do
144
- stub_request(:post, %r[/v2/#{account_id}/registrar/domains/.+/transfer$])
145
- .to_return(read_http_fixture("transferDomain/error-indnsimple.http"))
144
+ stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/transfer$}).
145
+ to_return(read_http_fixture("transferDomain/error-indnsimple.http"))
146
146
 
147
147
  expect {
148
148
  subject.transfer_domain(account_id, "example.com", attributes)
@@ -152,8 +152,8 @@ describe Dnsimple::Client, ".registrar" do
152
152
 
153
153
  context "when :auth_info wasn't provided and is required by the TLD" do
154
154
  it "raises a BadRequestError" do
155
- stub_request(:post, %r[/v2/#{account_id}/registrar/domains/.+/transfer$])
156
- .to_return(read_http_fixture("transferDomain/error-missing-authcode.http"))
155
+ stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/transfer$}).
156
+ to_return(read_http_fixture("transferDomain/error-missing-authcode.http"))
157
157
 
158
158
  expect {
159
159
  subject.transfer_domain(account_id, "example.com", registrant_id: 10)
@@ -166,15 +166,15 @@ describe Dnsimple::Client, ".registrar" do
166
166
  let(:account_id) { 1010 }
167
167
 
168
168
  before do
169
- stub_request(:post, %r[/v2/#{account_id}/registrar/domains/.+/transfer_out$])
170
- .to_return(read_http_fixture("transferDomainOut/success.http"))
169
+ stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/transfer_out$}).
170
+ to_return(read_http_fixture("transferDomainOut/success.http"))
171
171
  end
172
172
 
173
173
  it "builds the correct request" do
174
174
  subject.transfer_domain_out(account_id, domain_name = "example.com")
175
175
 
176
- expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/transfer_out")
177
- .with(headers: { "Accept" => "application/json" })
176
+ expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/transfer_out").
177
+ with(headers: { "Accept" => "application/json" })
178
178
  end
179
179
 
180
180
  it "returns nothing" do