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.
- checksums.yaml +4 -4
- data/.rubocop_dnsimple.yml +128 -74
- data/.travis.yml +2 -2
- data/CHANGELOG.md +9 -0
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/dnsimple.gemspec +2 -2
- data/lib/dnsimple/client/certificates.rb +24 -0
- data/lib/dnsimple/client/registrar.rb +4 -4
- data/lib/dnsimple/version.rb +1 -1
- data/spec/dnsimple/client/accounts_spec.rb +4 -4
- data/spec/dnsimple/client/certificates_spec.rb +43 -22
- data/spec/dnsimple/client/client_service_spec.rb +6 -6
- data/spec/dnsimple/client/collaborators_spec.rb +20 -20
- data/spec/dnsimple/client/contacts_spec.rb +30 -30
- data/spec/dnsimple/client/domains_delegation_signer_records_spec.rb +25 -25
- data/spec/dnsimple/client/domains_dnssec_spec.rb +18 -18
- data/spec/dnsimple/client/domains_email_forwards_spec.rb +25 -25
- data/spec/dnsimple/client/domains_pushes_spec.rb +22 -22
- data/spec/dnsimple/client/domains_spec.rb +27 -27
- data/spec/dnsimple/client/identity_spec.rb +8 -8
- data/spec/dnsimple/client/oauth_spec.rb +8 -8
- data/spec/dnsimple/client/registrar_auto_renewal_spec.rb +12 -12
- data/spec/dnsimple/client/registrar_delegation_spec.rb +18 -18
- data/spec/dnsimple/client/registrar_spec.rb +37 -37
- data/spec/dnsimple/client/registrar_whois_privacy_spec.rb +16 -16
- data/spec/dnsimple/client/services_domains_spec.rb +13 -13
- data/spec/dnsimple/client/services_spec.rb +10 -10
- data/spec/dnsimple/client/templates_domains_spec.rb +4 -4
- data/spec/dnsimple/client/templates_records_spec.rb +25 -25
- data/spec/dnsimple/client/templates_spec.rb +26 -26
- data/spec/dnsimple/client/tlds_spec.rb +16 -16
- data/spec/dnsimple/client/vanity_name_servers_spec.rb +8 -8
- data/spec/dnsimple/client/webhooks_spec.rb +21 -21
- data/spec/dnsimple/client/zones_records_spec.rb +40 -40
- data/spec/dnsimple/client/zones_spec.rb +18 -18
- data/spec/dnsimple/client_spec.rb +25 -25
- metadata +3 -5
@@ -8,15 +8,15 @@ describe Dnsimple::Client, ".registrar" do
|
|
8
8
|
let(:account_id) { 1010 }
|
9
9
|
|
10
10
|
before do
|
11
|
-
stub_request(:get, %r{/v2/#{account_id}/registrar/domains/.+/delegation$})
|
12
|
-
to_return(read_http_fixture("getDomainDelegation/success.http"))
|
11
|
+
stub_request(:get, %r{/v2/#{account_id}/registrar/domains/.+/delegation$})
|
12
|
+
.to_return(read_http_fixture("getDomainDelegation/success.http"))
|
13
13
|
end
|
14
14
|
|
15
15
|
it "builds the correct request" do
|
16
16
|
subject.domain_delegation(account_id, domain_name = "example.com")
|
17
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" })
|
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
20
|
end
|
21
21
|
|
22
22
|
it "returns the name servers of the domain" do
|
@@ -31,8 +31,8 @@ describe Dnsimple::Client, ".registrar" do
|
|
31
31
|
let(:account_id) { 1010 }
|
32
32
|
|
33
33
|
before do
|
34
|
-
stub_request(:put, %r{/v2/#{account_id}/registrar/domains/.+/delegation$})
|
35
|
-
to_return(read_http_fixture("changeDomainDelegation/success.http"))
|
34
|
+
stub_request(:put, %r{/v2/#{account_id}/registrar/domains/.+/delegation$})
|
35
|
+
.to_return(read_http_fixture("changeDomainDelegation/success.http"))
|
36
36
|
end
|
37
37
|
|
38
38
|
let(:attributes) { %w(ns1.dnsimple.com ns2.dnsimple.com ns3.dnsimple.com ns4.dnsimple.com) }
|
@@ -40,9 +40,9 @@ describe Dnsimple::Client, ".registrar" do
|
|
40
40
|
it "builds the correct request" do
|
41
41
|
subject.change_domain_delegation(account_id, domain_name = "example.com", attributes)
|
42
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" })
|
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
46
|
end
|
47
47
|
|
48
48
|
it "returns the name servers of the domain" do
|
@@ -57,8 +57,8 @@ describe Dnsimple::Client, ".registrar" do
|
|
57
57
|
let(:account_id) { 1010 }
|
58
58
|
|
59
59
|
before do
|
60
|
-
stub_request(:put, %r{/v2/#{account_id}/registrar/domains/.+/delegation/vanity$})
|
61
|
-
to_return(read_http_fixture("changeDomainDelegationToVanity/success.http"))
|
60
|
+
stub_request(:put, %r{/v2/#{account_id}/registrar/domains/.+/delegation/vanity$})
|
61
|
+
.to_return(read_http_fixture("changeDomainDelegationToVanity/success.http"))
|
62
62
|
end
|
63
63
|
|
64
64
|
let(:attributes) { %w(ns1.example.com ns2.example.com) }
|
@@ -66,9 +66,9 @@ describe Dnsimple::Client, ".registrar" do
|
|
66
66
|
it "builds the correct request" do
|
67
67
|
subject.change_domain_delegation_to_vanity(account_id, domain_name = "example.com", attributes)
|
68
68
|
|
69
|
-
expect(WebMock).to have_requested(:put, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/delegation/vanity")
|
70
|
-
with(body: JSON.dump(attributes))
|
71
|
-
with(headers: { "Accept" => "application/json" })
|
69
|
+
expect(WebMock).to have_requested(:put, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/delegation/vanity")
|
70
|
+
.with(body: JSON.dump(attributes))
|
71
|
+
.with(headers: { "Accept" => "application/json" })
|
72
72
|
end
|
73
73
|
|
74
74
|
it "returns vanity name servers of the domain" do
|
@@ -84,15 +84,15 @@ describe Dnsimple::Client, ".registrar" do
|
|
84
84
|
let(:account_id) { 1010 }
|
85
85
|
|
86
86
|
before do
|
87
|
-
stub_request(:delete, %r{/v2/#{account_id}/registrar/domains/.+/delegation/vanity$})
|
88
|
-
to_return(read_http_fixture("changeDomainDelegationFromVanity/success.http"))
|
87
|
+
stub_request(:delete, %r{/v2/#{account_id}/registrar/domains/.+/delegation/vanity$})
|
88
|
+
.to_return(read_http_fixture("changeDomainDelegationFromVanity/success.http"))
|
89
89
|
end
|
90
90
|
|
91
91
|
it "builds the correct request" do
|
92
92
|
subject.change_domain_delegation_from_vanity(account_id, domain_name = "example.com")
|
93
93
|
|
94
|
-
expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/delegation/vanity")
|
95
|
-
with(headers: { "Accept" => "application/json" })
|
94
|
+
expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/delegation/vanity")
|
95
|
+
.with(headers: { "Accept" => "application/json" })
|
96
96
|
end
|
97
97
|
|
98
98
|
it "returns empty response" do
|
@@ -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
|
@@ -37,15 +37,15 @@ describe Dnsimple::Client, ".registrar" do
|
|
37
37
|
|
38
38
|
context "when premium price" do
|
39
39
|
before do
|
40
|
-
stub_request(:get, %r{/v2/#{account_id}/registrar/domains/.+/premium_price[\?action]*})
|
41
|
-
to_return(read_http_fixture("getDomainPremiumPrice/success.http"))
|
40
|
+
stub_request(:get, %r{/v2/#{account_id}/registrar/domains/.+/premium_price[\?action]*})
|
41
|
+
.to_return(read_http_fixture("getDomainPremiumPrice/success.http"))
|
42
42
|
end
|
43
43
|
|
44
44
|
it "builds the correct request" do
|
45
45
|
subject.domain_premium_price(account_id, domain_name = "ruby.codes")
|
46
46
|
|
47
|
-
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/premium_price")
|
48
|
-
with(headers: { "Accept" => "application/json" })
|
47
|
+
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/premium_price")
|
48
|
+
.with(headers: { "Accept" => "application/json" })
|
49
49
|
end
|
50
50
|
|
51
51
|
it "returns the premium price" do
|
@@ -61,15 +61,15 @@ describe Dnsimple::Client, ".registrar" do
|
|
61
61
|
it "builds the correct request when action is passed" do
|
62
62
|
subject.domain_premium_price(account_id, domain_name = "ruby.codes", action: "registration")
|
63
63
|
|
64
|
-
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/premium_price?action=registration")
|
65
|
-
with(headers: { "Accept" => "application/json" })
|
64
|
+
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/premium_price?action=registration")
|
65
|
+
.with(headers: { "Accept" => "application/json" })
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
69
|
context "when not premium price" do
|
70
70
|
before do
|
71
|
-
stub_request(:get, %r{/v2/#{account_id}/registrar/domains/.+/premium_price$})
|
72
|
-
to_return(read_http_fixture("getDomainPremiumPrice/failure.http"))
|
71
|
+
stub_request(:get, %r{/v2/#{account_id}/registrar/domains/.+/premium_price$})
|
72
|
+
.to_return(read_http_fixture("getDomainPremiumPrice/failure.http"))
|
73
73
|
end
|
74
74
|
|
75
75
|
it "raises error" do
|
@@ -84,8 +84,8 @@ describe Dnsimple::Client, ".registrar" do
|
|
84
84
|
let(:account_id) { 1010 }
|
85
85
|
|
86
86
|
before do
|
87
|
-
stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/
|
88
|
-
to_return(read_http_fixture("registerDomain/success.http"))
|
87
|
+
stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/registrations$})
|
88
|
+
.to_return(read_http_fixture("registerDomain/success.http"))
|
89
89
|
end
|
90
90
|
|
91
91
|
let(:attributes) { { registrant_id: "10" } }
|
@@ -93,9 +93,9 @@ describe Dnsimple::Client, ".registrar" do
|
|
93
93
|
it "builds the correct request" do
|
94
94
|
subject.register_domain(account_id, domain_name = "example.com", attributes)
|
95
95
|
|
96
|
-
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/
|
97
|
-
with(body: attributes)
|
98
|
-
with(headers: { "Accept" => "application/json" })
|
96
|
+
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/registrations")
|
97
|
+
.with(body: attributes)
|
98
|
+
.with(headers: { "Accept" => "application/json" })
|
99
99
|
end
|
100
100
|
|
101
101
|
it "returns the domain" do
|
@@ -119,8 +119,8 @@ describe Dnsimple::Client, ".registrar" do
|
|
119
119
|
let(:account_id) { 1010 }
|
120
120
|
|
121
121
|
before do
|
122
|
-
stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/
|
123
|
-
to_return(read_http_fixture("renewDomain/success.http"))
|
122
|
+
stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/renewals$})
|
123
|
+
.to_return(read_http_fixture("renewDomain/success.http"))
|
124
124
|
end
|
125
125
|
|
126
126
|
let(:attributes) { { period: "3" } }
|
@@ -128,9 +128,9 @@ describe Dnsimple::Client, ".registrar" do
|
|
128
128
|
it "builds the correct request" do
|
129
129
|
subject.renew_domain(account_id, domain_name = "example.com", attributes)
|
130
130
|
|
131
|
-
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/
|
132
|
-
with(body: attributes)
|
133
|
-
with(headers: { "Accept" => "application/json" })
|
131
|
+
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/renewals")
|
132
|
+
.with(body: attributes)
|
133
|
+
.with(headers: { "Accept" => "application/json" })
|
134
134
|
end
|
135
135
|
|
136
136
|
it "returns the domain" do
|
@@ -145,8 +145,8 @@ describe Dnsimple::Client, ".registrar" do
|
|
145
145
|
|
146
146
|
context "when it is too soon for the domain to be renewed" do
|
147
147
|
it "raises a BadRequestError" do
|
148
|
-
stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/
|
149
|
-
to_return(read_http_fixture("renewDomain/error-tooearly.http"))
|
148
|
+
stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/renewals$})
|
149
|
+
.to_return(read_http_fixture("renewDomain/error-tooearly.http"))
|
150
150
|
|
151
151
|
expect {
|
152
152
|
subject.renew_domain(account_id, "example.com", attributes)
|
@@ -159,8 +159,8 @@ describe Dnsimple::Client, ".registrar" do
|
|
159
159
|
let(:account_id) { 1010 }
|
160
160
|
|
161
161
|
before do
|
162
|
-
stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/
|
163
|
-
to_return(read_http_fixture("transferDomain/success.http"))
|
162
|
+
stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/transfers$})
|
163
|
+
.to_return(read_http_fixture("transferDomain/success.http"))
|
164
164
|
end
|
165
165
|
|
166
166
|
let(:attributes) { { registrant_id: "10", auth_code: "x1y2z3" } }
|
@@ -168,9 +168,9 @@ describe Dnsimple::Client, ".registrar" do
|
|
168
168
|
it "builds the correct request" do
|
169
169
|
subject.transfer_domain(account_id, domain_name = "example.com", attributes)
|
170
170
|
|
171
|
-
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/
|
172
|
-
with(body: attributes)
|
173
|
-
with(headers: { "Accept" => "application/json" })
|
171
|
+
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/transfers")
|
172
|
+
.with(body: attributes)
|
173
|
+
.with(headers: { "Accept" => "application/json" })
|
174
174
|
end
|
175
175
|
|
176
176
|
it "returns the domain" do
|
@@ -191,8 +191,8 @@ describe Dnsimple::Client, ".registrar" do
|
|
191
191
|
|
192
192
|
context "when the domain is already in DNSimple" do
|
193
193
|
it "raises a BadRequestError" do
|
194
|
-
stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/
|
195
|
-
to_return(read_http_fixture("transferDomain/error-indnsimple.http"))
|
194
|
+
stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/transfers$})
|
195
|
+
.to_return(read_http_fixture("transferDomain/error-indnsimple.http"))
|
196
196
|
|
197
197
|
expect {
|
198
198
|
subject.transfer_domain(account_id, "example.com", attributes)
|
@@ -202,8 +202,8 @@ describe Dnsimple::Client, ".registrar" do
|
|
202
202
|
|
203
203
|
context "when :auth_code wasn't provided and is required by the TLD" do
|
204
204
|
it "raises a BadRequestError" do
|
205
|
-
stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/
|
206
|
-
to_return(read_http_fixture("transferDomain/error-missing-authcode.http"))
|
205
|
+
stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/transfers$})
|
206
|
+
.to_return(read_http_fixture("transferDomain/error-missing-authcode.http"))
|
207
207
|
|
208
208
|
expect {
|
209
209
|
subject.transfer_domain(account_id, "example.com", registrant_id: 10)
|
@@ -216,15 +216,15 @@ describe Dnsimple::Client, ".registrar" do
|
|
216
216
|
let(:account_id) { 1010 }
|
217
217
|
|
218
218
|
before do
|
219
|
-
stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/
|
220
|
-
to_return(read_http_fixture("transferDomainOut/success.http"))
|
219
|
+
stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/authorize_transfer_out$})
|
220
|
+
.to_return(read_http_fixture("transferDomainOut/success.http"))
|
221
221
|
end
|
222
222
|
|
223
223
|
it "builds the correct request" do
|
224
224
|
subject.transfer_domain_out(account_id, domain_name = "example.com")
|
225
225
|
|
226
|
-
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/
|
227
|
-
with(headers: { "Accept" => "application/json" })
|
226
|
+
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/authorize_transfer_out")
|
227
|
+
.with(headers: { "Accept" => "application/json" })
|
228
228
|
end
|
229
229
|
|
230
230
|
it "returns nothing" do
|
@@ -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/.+/whois_privacy$})
|
13
|
-
to_return(read_http_fixture("getWhoisPrivacy/success.http"))
|
12
|
+
stub_request(:get, %r{/v2/#{account_id}/registrar/domains/.+/whois_privacy$})
|
13
|
+
.to_return(read_http_fixture("getWhoisPrivacy/success.http"))
|
14
14
|
end
|
15
15
|
|
16
16
|
it "builds the correct request" do
|
17
17
|
subject.whois_privacy(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}/whois_privacy")
|
20
|
-
with(headers: { "Accept" => "application/json" })
|
19
|
+
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/whois_privacy")
|
20
|
+
.with(headers: { "Accept" => "application/json" })
|
21
21
|
end
|
22
22
|
|
23
23
|
it "returns the whois privacy" do
|
@@ -37,15 +37,15 @@ describe Dnsimple::Client, ".registrar" do
|
|
37
37
|
|
38
38
|
context "when the whois privacy had already been purchased" do
|
39
39
|
before do
|
40
|
-
stub_request(:put, %r{/v2/#{account_id}/registrar/domains/.+/whois_privacy$})
|
41
|
-
to_return(read_http_fixture("enableWhoisPrivacy/success.http"))
|
40
|
+
stub_request(:put, %r{/v2/#{account_id}/registrar/domains/.+/whois_privacy$})
|
41
|
+
.to_return(read_http_fixture("enableWhoisPrivacy/success.http"))
|
42
42
|
end
|
43
43
|
|
44
44
|
it "builds the correct request" do
|
45
45
|
subject.enable_whois_privacy(account_id, domain_name = "example.com")
|
46
46
|
|
47
|
-
expect(WebMock).to have_requested(:put, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/whois_privacy")
|
48
|
-
with(headers: { "Accept" => "application/json" })
|
47
|
+
expect(WebMock).to have_requested(:put, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/whois_privacy")
|
48
|
+
.with(headers: { "Accept" => "application/json" })
|
49
49
|
end
|
50
50
|
|
51
51
|
it "returns the whois privacy" do
|
@@ -63,15 +63,15 @@ describe Dnsimple::Client, ".registrar" do
|
|
63
63
|
|
64
64
|
context "when the whois privacy is newly purchased" do
|
65
65
|
before do
|
66
|
-
stub_request(:put, %r{/v2/#{account_id}/registrar/domains/.+/whois_privacy$})
|
67
|
-
to_return(read_http_fixture("enableWhoisPrivacy/created.http"))
|
66
|
+
stub_request(:put, %r{/v2/#{account_id}/registrar/domains/.+/whois_privacy$})
|
67
|
+
.to_return(read_http_fixture("enableWhoisPrivacy/created.http"))
|
68
68
|
end
|
69
69
|
|
70
70
|
it "builds the correct request" do
|
71
71
|
subject.enable_whois_privacy(account_id, domain_name = "example.com")
|
72
72
|
|
73
|
-
expect(WebMock).to have_requested(:put, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/whois_privacy")
|
74
|
-
with(headers: { "Accept" => "application/json" })
|
73
|
+
expect(WebMock).to have_requested(:put, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/whois_privacy")
|
74
|
+
.with(headers: { "Accept" => "application/json" })
|
75
75
|
end
|
76
76
|
|
77
77
|
it "returns the whois privacy" do
|
@@ -93,15 +93,15 @@ describe Dnsimple::Client, ".registrar" do
|
|
93
93
|
let(:account_id) { 1010 }
|
94
94
|
|
95
95
|
before do
|
96
|
-
stub_request(:delete, %r{/v2/#{account_id}/registrar/domains/.+/whois_privacy$})
|
97
|
-
to_return(read_http_fixture("disableWhoisPrivacy/success.http"))
|
96
|
+
stub_request(:delete, %r{/v2/#{account_id}/registrar/domains/.+/whois_privacy$})
|
97
|
+
.to_return(read_http_fixture("disableWhoisPrivacy/success.http"))
|
98
98
|
end
|
99
99
|
|
100
100
|
it "builds the correct request" do
|
101
101
|
subject.disable_whois_privacy(account_id, domain_name = "example.com")
|
102
102
|
|
103
|
-
expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/whois_privacy")
|
104
|
-
with(headers: { "Accept" => "application/json" })
|
103
|
+
expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/whois_privacy")
|
104
|
+
.with(headers: { "Accept" => "application/json" })
|
105
105
|
end
|
106
106
|
|
107
107
|
it "returns the whois privacy" do
|
@@ -10,15 +10,15 @@ describe Dnsimple::Client, ".services" do
|
|
10
10
|
let(:domain_id) { 'example.com' }
|
11
11
|
|
12
12
|
before do
|
13
|
-
stub_request(:get, %r{/v2/#{account_id}/domains/#{domain_id}/services})
|
14
|
-
to_return(read_http_fixture("appliedServices/success.http"))
|
13
|
+
stub_request(:get, %r{/v2/#{account_id}/domains/#{domain_id}/services})
|
14
|
+
.to_return(read_http_fixture("appliedServices/success.http"))
|
15
15
|
end
|
16
16
|
|
17
17
|
it "builds the correct request" do
|
18
18
|
subject.applied_services(account_id, domain_id)
|
19
19
|
|
20
|
-
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/services")
|
21
|
-
with(headers: { "Accept" => "application/json" })
|
20
|
+
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/services")
|
21
|
+
.with(headers: { "Accept" => "application/json" })
|
22
22
|
end
|
23
23
|
|
24
24
|
it "supports pagination" do
|
@@ -63,8 +63,8 @@ describe Dnsimple::Client, ".services" do
|
|
63
63
|
let(:service_id) { "service1" }
|
64
64
|
|
65
65
|
before do
|
66
|
-
stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/services/#{service_id}$})
|
67
|
-
to_return(read_http_fixture("applyService/success.http"))
|
66
|
+
stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/services/#{service_id}$})
|
67
|
+
.to_return(read_http_fixture("applyService/success.http"))
|
68
68
|
end
|
69
69
|
|
70
70
|
let(:settings) { { app: "foo" } }
|
@@ -72,9 +72,9 @@ describe Dnsimple::Client, ".services" do
|
|
72
72
|
it "builds the correct request" do
|
73
73
|
subject.apply_service(account_id, service_id, domain_id, settings)
|
74
74
|
|
75
|
-
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/services/#{service_id}")
|
76
|
-
with(body: settings)
|
77
|
-
with(headers: { 'Accept' => 'application/json' })
|
75
|
+
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/services/#{service_id}")
|
76
|
+
.with(body: settings)
|
77
|
+
.with(headers: { 'Accept' => 'application/json' })
|
78
78
|
end
|
79
79
|
|
80
80
|
it "returns empty response" do
|
@@ -92,15 +92,15 @@ describe Dnsimple::Client, ".services" do
|
|
92
92
|
let(:service_id) { "service1" }
|
93
93
|
|
94
94
|
before do
|
95
|
-
stub_request(:delete, %r{/v2/#{account_id}/domains/#{domain_id}/services/#{service_id}$})
|
96
|
-
to_return(read_http_fixture("unapplyService/success.http"))
|
95
|
+
stub_request(:delete, %r{/v2/#{account_id}/domains/#{domain_id}/services/#{service_id}$})
|
96
|
+
.to_return(read_http_fixture("unapplyService/success.http"))
|
97
97
|
end
|
98
98
|
|
99
99
|
it "builds the correct request" do
|
100
100
|
subject.unapply_service(account_id, service_id, domain_id)
|
101
101
|
|
102
|
-
expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/services/#{service_id}")
|
103
|
-
with(headers: { 'Accept' => 'application/json' })
|
102
|
+
expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/services/#{service_id}")
|
103
|
+
.with(headers: { 'Accept' => 'application/json' })
|
104
104
|
end
|
105
105
|
|
106
106
|
it "returns empty response" do
|
@@ -7,15 +7,15 @@ describe Dnsimple::Client, ".services" do
|
|
7
7
|
|
8
8
|
describe "#list_services" do
|
9
9
|
before do
|
10
|
-
stub_request(:get, %r{/v2/services})
|
11
|
-
to_return(read_http_fixture("listServices/success.http"))
|
10
|
+
stub_request(:get, %r{/v2/services})
|
11
|
+
.to_return(read_http_fixture("listServices/success.http"))
|
12
12
|
end
|
13
13
|
|
14
14
|
it "builds the correct request" do
|
15
15
|
subject.list_services
|
16
16
|
|
17
|
-
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/services")
|
18
|
-
with(headers: { "Accept" => "application/json" })
|
17
|
+
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/services")
|
18
|
+
.with(headers: { "Accept" => "application/json" })
|
19
19
|
end
|
20
20
|
|
21
21
|
it "supports pagination" do
|
@@ -56,8 +56,8 @@ describe Dnsimple::Client, ".services" do
|
|
56
56
|
|
57
57
|
describe "#all_services" do
|
58
58
|
before do
|
59
|
-
stub_request(:get, %r{/v2/services})
|
60
|
-
to_return(read_http_fixture("listServices/success.http"))
|
59
|
+
stub_request(:get, %r{/v2/services})
|
60
|
+
.to_return(read_http_fixture("listServices/success.http"))
|
61
61
|
end
|
62
62
|
|
63
63
|
it "delegates to client.paginate" do
|
@@ -76,15 +76,15 @@ describe Dnsimple::Client, ".services" do
|
|
76
76
|
let(:service_id) { 1 }
|
77
77
|
|
78
78
|
before do
|
79
|
-
stub_request(:get, %r{/v2/services/#{service_id}$})
|
80
|
-
to_return(read_http_fixture("getService/success.http"))
|
79
|
+
stub_request(:get, %r{/v2/services/#{service_id}$})
|
80
|
+
.to_return(read_http_fixture("getService/success.http"))
|
81
81
|
end
|
82
82
|
|
83
83
|
it "builds the correct request" do
|
84
84
|
subject.service(service_id)
|
85
85
|
|
86
|
-
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/services/#{service_id}")
|
87
|
-
with(headers: { "Accept" => "application/json" })
|
86
|
+
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/services/#{service_id}")
|
87
|
+
.with(headers: { "Accept" => "application/json" })
|
88
88
|
end
|
89
89
|
|
90
90
|
it "returns the service" do
|