dnsimple 4.2.0 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -10,15 +10,15 @@ describe Dnsimple::Client, ".domains" 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}/email_forwards})
|
14
|
-
to_return(read_http_fixture("listEmailForwards/success.http"))
|
13
|
+
stub_request(:get, %r{/v2/#{account_id}/domains/#{domain_id}/email_forwards})
|
14
|
+
.to_return(read_http_fixture("listEmailForwards/success.http"))
|
15
15
|
end
|
16
16
|
|
17
17
|
it "builds the correct request" do
|
18
18
|
subject.email_forwards(account_id, domain_id)
|
19
19
|
|
20
|
-
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/email_forwards")
|
21
|
-
with(headers: { 'Accept' => 'application/json' })
|
20
|
+
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/email_forwards")
|
21
|
+
.with(headers: { 'Accept' => 'application/json' })
|
22
22
|
end
|
23
23
|
|
24
24
|
it "supports pagination" do
|
@@ -64,8 +64,8 @@ describe Dnsimple::Client, ".domains" do
|
|
64
64
|
|
65
65
|
context "when the domain does not exist" do
|
66
66
|
it "raises NotFoundError" do
|
67
|
-
stub_request(:get, %r{/v2})
|
68
|
-
to_return(read_http_fixture("notfound-domain.http"))
|
67
|
+
stub_request(:get, %r{/v2})
|
68
|
+
.to_return(read_http_fixture("notfound-domain.http"))
|
69
69
|
|
70
70
|
expect {
|
71
71
|
subject.email_forwards(account_id, domain_id)
|
@@ -76,8 +76,8 @@ describe Dnsimple::Client, ".domains" do
|
|
76
76
|
|
77
77
|
describe "#all_email_forwards" do
|
78
78
|
before do
|
79
|
-
stub_request(:get, %r{/v2/#{account_id}/domains/#{domain_id}/email_forwards})
|
80
|
-
to_return(read_http_fixture("listEmailForwards/success.http"))
|
79
|
+
stub_request(:get, %r{/v2/#{account_id}/domains/#{domain_id}/email_forwards})
|
80
|
+
.to_return(read_http_fixture("listEmailForwards/success.http"))
|
81
81
|
end
|
82
82
|
|
83
83
|
let(:account_id) { 1010 }
|
@@ -100,8 +100,8 @@ describe Dnsimple::Client, ".domains" do
|
|
100
100
|
let(:domain_id) { "example.com" }
|
101
101
|
|
102
102
|
before do
|
103
|
-
stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/email_forwards$})
|
104
|
-
to_return(read_http_fixture("createEmailForward/created.http"))
|
103
|
+
stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/email_forwards$})
|
104
|
+
.to_return(read_http_fixture("createEmailForward/created.http"))
|
105
105
|
end
|
106
106
|
|
107
107
|
let(:attributes) { { from: "jim", to: "jim@another.com" } }
|
@@ -109,9 +109,9 @@ describe Dnsimple::Client, ".domains" do
|
|
109
109
|
it "builds the correct request" do
|
110
110
|
subject.create_email_forward(account_id, domain_id, attributes)
|
111
111
|
|
112
|
-
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/email_forwards")
|
113
|
-
with(body: attributes)
|
114
|
-
with(headers: { 'Accept' => 'application/json' })
|
112
|
+
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/email_forwards")
|
113
|
+
.with(body: attributes)
|
114
|
+
.with(headers: { 'Accept' => 'application/json' })
|
115
115
|
end
|
116
116
|
|
117
117
|
it "returns the email forward" do
|
@@ -130,15 +130,15 @@ describe Dnsimple::Client, ".domains" do
|
|
130
130
|
let(:email_forward_id) { 17706 }
|
131
131
|
|
132
132
|
before do
|
133
|
-
stub_request(:get, %r{/v2/#{account_id}/domains/#{domain_id}/email_forwards.+$})
|
134
|
-
to_return(read_http_fixture("getEmailForward/success.http"))
|
133
|
+
stub_request(:get, %r{/v2/#{account_id}/domains/#{domain_id}/email_forwards.+$})
|
134
|
+
.to_return(read_http_fixture("getEmailForward/success.http"))
|
135
135
|
end
|
136
136
|
|
137
137
|
it "builds the correct request" do
|
138
138
|
subject.email_forward(account_id, domain_id, email_forward_id)
|
139
139
|
|
140
|
-
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/email_forwards/#{email_forward_id}")
|
141
|
-
with(headers: { 'Accept' => 'application/json' })
|
140
|
+
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/email_forwards/#{email_forward_id}")
|
141
|
+
.with(headers: { 'Accept' => 'application/json' })
|
142
142
|
end
|
143
143
|
|
144
144
|
it "returns the email forward" do
|
@@ -157,8 +157,8 @@ describe Dnsimple::Client, ".domains" do
|
|
157
157
|
|
158
158
|
context "when the email forward does not exist" do
|
159
159
|
it "raises NotFoundError" do
|
160
|
-
stub_request(:get, %r{/v2})
|
161
|
-
to_return(read_http_fixture("notfound-emailforward.http"))
|
160
|
+
stub_request(:get, %r{/v2})
|
161
|
+
.to_return(read_http_fixture("notfound-emailforward.http"))
|
162
162
|
|
163
163
|
expect {
|
164
164
|
subject.email_forward(account_id, domain_id, email_forward_id)
|
@@ -173,15 +173,15 @@ describe Dnsimple::Client, ".domains" do
|
|
173
173
|
let(:email_forward_id) { 1 }
|
174
174
|
|
175
175
|
before do
|
176
|
-
stub_request(:delete, %r{/v2/#{account_id}/domains/#{domain_id}/email_forwards/#{email_forward_id}$})
|
177
|
-
to_return(read_http_fixture("deleteEmailForward/success.http"))
|
176
|
+
stub_request(:delete, %r{/v2/#{account_id}/domains/#{domain_id}/email_forwards/#{email_forward_id}$})
|
177
|
+
.to_return(read_http_fixture("deleteEmailForward/success.http"))
|
178
178
|
end
|
179
179
|
|
180
180
|
it "builds the correct request" do
|
181
181
|
subject.delete_email_forward(account_id, domain_id, email_forward_id)
|
182
182
|
|
183
|
-
expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/email_forwards/#{email_forward_id}")
|
184
|
-
with(headers: { 'Accept' => 'application/json' })
|
183
|
+
expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/email_forwards/#{email_forward_id}")
|
184
|
+
.with(headers: { 'Accept' => 'application/json' })
|
185
185
|
end
|
186
186
|
|
187
187
|
it "returns nothing" do
|
@@ -194,8 +194,8 @@ describe Dnsimple::Client, ".domains" do
|
|
194
194
|
|
195
195
|
context "when the email forward does not exist" do
|
196
196
|
it "raises NotFoundError" do
|
197
|
-
stub_request(:delete, %r{/v2})
|
198
|
-
to_return(read_http_fixture("notfound-emailforward.http"))
|
197
|
+
stub_request(:delete, %r{/v2})
|
198
|
+
.to_return(read_http_fixture("notfound-emailforward.http"))
|
199
199
|
|
200
200
|
expect {
|
201
201
|
subject.delete_email_forward(account_id, domain_id, email_forward_id)
|
@@ -9,8 +9,8 @@ describe Dnsimple::Client, ".domains" do
|
|
9
9
|
let(:domain_id) { "example.com" }
|
10
10
|
|
11
11
|
before do
|
12
|
-
stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/pushes$})
|
13
|
-
to_return(read_http_fixture("initiatePush/success.http"))
|
12
|
+
stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/pushes$})
|
13
|
+
.to_return(read_http_fixture("initiatePush/success.http"))
|
14
14
|
end
|
15
15
|
|
16
16
|
let(:attributes) { { new_account_email: "admin@target-account.test" } }
|
@@ -18,9 +18,9 @@ describe Dnsimple::Client, ".domains" do
|
|
18
18
|
it "builds the correct request" do
|
19
19
|
subject.initiate_push(account_id, domain_id, attributes)
|
20
20
|
|
21
|
-
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/pushes")
|
22
|
-
with(body: attributes)
|
23
|
-
with(headers: { 'Accept' => 'application/json' })
|
21
|
+
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/pushes")
|
22
|
+
.with(body: attributes)
|
23
|
+
.with(headers: { 'Accept' => 'application/json' })
|
24
24
|
end
|
25
25
|
|
26
26
|
it "returns the domain push" do
|
@@ -37,15 +37,15 @@ describe Dnsimple::Client, ".domains" do
|
|
37
37
|
let(:account_id) { 2020 }
|
38
38
|
|
39
39
|
before do
|
40
|
-
stub_request(:get, %r{/v2/#{account_id}/pushes})
|
41
|
-
to_return(read_http_fixture("listPushes/success.http"))
|
40
|
+
stub_request(:get, %r{/v2/#{account_id}/pushes})
|
41
|
+
.to_return(read_http_fixture("listPushes/success.http"))
|
42
42
|
end
|
43
43
|
|
44
44
|
it "builds the correct request" do
|
45
45
|
subject.pushes(account_id)
|
46
46
|
|
47
|
-
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/pushes")
|
48
|
-
with(headers: { 'Accept' => 'application/json' })
|
47
|
+
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/pushes")
|
48
|
+
.with(headers: { 'Accept' => 'application/json' })
|
49
49
|
end
|
50
50
|
|
51
51
|
it "supports pagination" do
|
@@ -89,8 +89,8 @@ describe Dnsimple::Client, ".domains" do
|
|
89
89
|
let(:push_id) { 1 }
|
90
90
|
|
91
91
|
before do
|
92
|
-
stub_request(:post, %r{/v2/#{account_id}/pushes/#{push_id}$})
|
93
|
-
to_return(read_http_fixture("acceptPush/success.http"))
|
92
|
+
stub_request(:post, %r{/v2/#{account_id}/pushes/#{push_id}$})
|
93
|
+
.to_return(read_http_fixture("acceptPush/success.http"))
|
94
94
|
end
|
95
95
|
|
96
96
|
let(:attributes) { { contact_id: 2 } }
|
@@ -98,9 +98,9 @@ describe Dnsimple::Client, ".domains" do
|
|
98
98
|
it "builds the correct request" do
|
99
99
|
subject.accept_push(account_id, push_id, attributes)
|
100
100
|
|
101
|
-
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/pushes/#{push_id}")
|
102
|
-
with(body: attributes)
|
103
|
-
with(headers: { 'Accept' => 'application/json' })
|
101
|
+
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/pushes/#{push_id}")
|
102
|
+
.with(body: attributes)
|
103
|
+
.with(headers: { 'Accept' => 'application/json' })
|
104
104
|
end
|
105
105
|
|
106
106
|
it "returns nothing" do
|
@@ -113,8 +113,8 @@ describe Dnsimple::Client, ".domains" do
|
|
113
113
|
|
114
114
|
context "when the domain push does not exist" do
|
115
115
|
it "raises NotFoundError" do
|
116
|
-
stub_request(:post, %r{/v2})
|
117
|
-
to_return(read_http_fixture("notfound-domainpush.http"))
|
116
|
+
stub_request(:post, %r{/v2})
|
117
|
+
.to_return(read_http_fixture("notfound-domainpush.http"))
|
118
118
|
|
119
119
|
expect {
|
120
120
|
subject.accept_push(account_id, push_id, attributes)
|
@@ -128,15 +128,15 @@ describe Dnsimple::Client, ".domains" do
|
|
128
128
|
let(:push_id) { 1 }
|
129
129
|
|
130
130
|
before do
|
131
|
-
stub_request(:delete, %r{/v2/#{account_id}/pushes/#{push_id}$})
|
132
|
-
to_return(read_http_fixture("rejectPush/success.http"))
|
131
|
+
stub_request(:delete, %r{/v2/#{account_id}/pushes/#{push_id}$})
|
132
|
+
.to_return(read_http_fixture("rejectPush/success.http"))
|
133
133
|
end
|
134
134
|
|
135
135
|
it "builds the correct request" do
|
136
136
|
subject.reject_push(account_id, push_id)
|
137
137
|
|
138
|
-
expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/pushes/#{push_id}")
|
139
|
-
with(headers: { 'Accept' => 'application/json' })
|
138
|
+
expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/pushes/#{push_id}")
|
139
|
+
.with(headers: { 'Accept' => 'application/json' })
|
140
140
|
end
|
141
141
|
|
142
142
|
it "returns nothing" do
|
@@ -149,8 +149,8 @@ describe Dnsimple::Client, ".domains" do
|
|
149
149
|
|
150
150
|
context "when the domain push does not exist" do
|
151
151
|
it "raises NotFoundError" do
|
152
|
-
stub_request(:delete, %r{/v2})
|
153
|
-
to_return(read_http_fixture("notfound-domainpush.http"))
|
152
|
+
stub_request(:delete, %r{/v2})
|
153
|
+
.to_return(read_http_fixture("notfound-domainpush.http"))
|
154
154
|
|
155
155
|
expect {
|
156
156
|
subject.reject_push(account_id, push_id)
|
@@ -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
|
@@ -70,8 +70,8 @@ describe Dnsimple::Client, ".domains" do
|
|
70
70
|
|
71
71
|
describe "#all_domains" do
|
72
72
|
before do
|
73
|
-
stub_request(:get, %r{/v2/#{account_id}/domains})
|
74
|
-
to_return(read_http_fixture("listDomains/success.http"))
|
73
|
+
stub_request(:get, %r{/v2/#{account_id}/domains})
|
74
|
+
.to_return(read_http_fixture("listDomains/success.http"))
|
75
75
|
end
|
76
76
|
|
77
77
|
let(:account_id) { 1010 }
|
@@ -98,8 +98,8 @@ describe Dnsimple::Client, ".domains" do
|
|
98
98
|
let(:account_id) { 1010 }
|
99
99
|
|
100
100
|
before do
|
101
|
-
stub_request(:post, %r{/v2/#{account_id}/domains$})
|
102
|
-
to_return(read_http_fixture("createDomain/created.http"))
|
101
|
+
stub_request(:post, %r{/v2/#{account_id}/domains$})
|
102
|
+
.to_return(read_http_fixture("createDomain/created.http"))
|
103
103
|
end
|
104
104
|
|
105
105
|
let(:attributes) { { name: "example.com" } }
|
@@ -107,9 +107,9 @@ describe Dnsimple::Client, ".domains" do
|
|
107
107
|
it "builds the correct request" do
|
108
108
|
subject.create_domain(account_id, attributes)
|
109
109
|
|
110
|
-
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains")
|
111
|
-
with(body: attributes)
|
112
|
-
with(headers: { 'Accept' => 'application/json' })
|
110
|
+
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains")
|
111
|
+
.with(body: attributes)
|
112
|
+
.with(headers: { 'Accept' => 'application/json' })
|
113
113
|
end
|
114
114
|
|
115
115
|
it "returns the domain" do
|
@@ -126,15 +126,15 @@ describe Dnsimple::Client, ".domains" do
|
|
126
126
|
let(:account_id) { 1010 }
|
127
127
|
|
128
128
|
before do
|
129
|
-
stub_request(:get, %r{/v2/#{account_id}/domains/.+$})
|
130
|
-
to_return(read_http_fixture("getDomain/success.http"))
|
129
|
+
stub_request(:get, %r{/v2/#{account_id}/domains/.+$})
|
130
|
+
.to_return(read_http_fixture("getDomain/success.http"))
|
131
131
|
end
|
132
132
|
|
133
133
|
it "builds the correct request" do
|
134
134
|
subject.domain(account_id, domain = "example.com")
|
135
135
|
|
136
|
-
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain}")
|
137
|
-
with(headers: { 'Accept' => 'application/json' })
|
136
|
+
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain}")
|
137
|
+
.with(headers: { 'Accept' => 'application/json' })
|
138
138
|
end
|
139
139
|
|
140
140
|
it "returns the domain" do
|
@@ -157,8 +157,8 @@ describe Dnsimple::Client, ".domains" do
|
|
157
157
|
|
158
158
|
context "when the domain does not exist" do
|
159
159
|
it "raises NotFoundError" do
|
160
|
-
stub_request(:get, %r{/v2})
|
161
|
-
to_return(read_http_fixture("notfound-domain.http"))
|
160
|
+
stub_request(:get, %r{/v2})
|
161
|
+
.to_return(read_http_fixture("notfound-domain.http"))
|
162
162
|
|
163
163
|
expect {
|
164
164
|
subject.domain(account_id, "example.com")
|
@@ -171,15 +171,15 @@ describe Dnsimple::Client, ".domains" do
|
|
171
171
|
let(:account_id) { 1010 }
|
172
172
|
|
173
173
|
before do
|
174
|
-
stub_request(:delete, %r{/v2/#{account_id}/domains/.+$})
|
175
|
-
to_return(read_http_fixture("deleteDomain/success.http"))
|
174
|
+
stub_request(:delete, %r{/v2/#{account_id}/domains/.+$})
|
175
|
+
.to_return(read_http_fixture("deleteDomain/success.http"))
|
176
176
|
end
|
177
177
|
|
178
178
|
it "builds the correct request" do
|
179
179
|
subject.delete_domain(account_id, domain = "example.com")
|
180
180
|
|
181
|
-
expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain}")
|
182
|
-
with(headers: { 'Accept' => 'application/json' })
|
181
|
+
expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain}")
|
182
|
+
.with(headers: { 'Accept' => 'application/json' })
|
183
183
|
end
|
184
184
|
|
185
185
|
it "returns nothing" do
|
@@ -192,8 +192,8 @@ describe Dnsimple::Client, ".domains" do
|
|
192
192
|
|
193
193
|
context "when the domain does not exist" do
|
194
194
|
it "raises NotFoundError" do
|
195
|
-
stub_request(:delete, %r{/v2})
|
196
|
-
to_return(read_http_fixture("notfound-domain.http"))
|
195
|
+
stub_request(:delete, %r{/v2})
|
196
|
+
.to_return(read_http_fixture("notfound-domain.http"))
|
197
197
|
|
198
198
|
expect {
|
199
199
|
subject.delete_domain(account_id, "example.com")
|
@@ -207,15 +207,15 @@ describe Dnsimple::Client, ".domains" do
|
|
207
207
|
let(:domain_id) { "example.com" }
|
208
208
|
|
209
209
|
before do
|
210
|
-
stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/token})
|
211
|
-
to_return(read_http_fixture("resetDomainToken/success.http"))
|
210
|
+
stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/token})
|
211
|
+
.to_return(read_http_fixture("resetDomainToken/success.http"))
|
212
212
|
end
|
213
213
|
|
214
214
|
it "builds the correct request" do
|
215
215
|
subject.reset_domain_token(account_id, domain_id)
|
216
216
|
|
217
|
-
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/token")
|
218
|
-
with(headers: { 'Accept' => 'application/json' })
|
217
|
+
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/token")
|
218
|
+
.with(headers: { 'Accept' => 'application/json' })
|
219
219
|
end
|
220
220
|
|
221
221
|
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 the whoami" 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
|
@@ -12,16 +12,16 @@ describe Dnsimple::Client, ".oauth" do
|
|
12
12
|
let(:state) { "super-state" }
|
13
13
|
|
14
14
|
before do
|
15
|
-
stub_request(:post, %r{/v2/oauth/access_token$})
|
16
|
-
to_return(read_http_fixture("oauthAccessToken/success.http"))
|
15
|
+
stub_request(:post, %r{/v2/oauth/access_token$})
|
16
|
+
.to_return(read_http_fixture("oauthAccessToken/success.http"))
|
17
17
|
end
|
18
18
|
|
19
19
|
it "builds the correct request" do
|
20
20
|
subject.exchange_authorization_for_token(code, client_id, client_secret, state: state)
|
21
21
|
|
22
|
-
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/oauth/access_token")
|
23
|
-
with(body: { client_id: client_id, client_secret: client_secret, code: code, state: state, grant_type: "authorization_code" })
|
24
|
-
with(headers: { 'Accept' => 'application/json' })
|
22
|
+
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/oauth/access_token")
|
23
|
+
.with(body: { client_id: client_id, client_secret: client_secret, code: code, state: state, grant_type: "authorization_code" })
|
24
|
+
.with(headers: { 'Accept' => 'application/json' })
|
25
25
|
end
|
26
26
|
|
27
27
|
it "returns oauth token" do
|
@@ -39,9 +39,9 @@ describe Dnsimple::Client, ".oauth" do
|
|
39
39
|
it "builds the correct request" do
|
40
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("enableDomainAutoRenewal/success.http"))
|
12
|
+
stub_request(:put, %r{/v2/#{account_id}/registrar/domains/#{domain_id}})
|
13
|
+
.to_return(read_http_fixture("enableDomainAutoRenewal/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)
|
@@ -46,16 +46,16 @@ describe Dnsimple::Client, ".registrar" do
|
|
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("disableDomainAutoRenewal/success.http"))
|
49
|
+
stub_request(:delete, %r{/v2/#{account_id}/registrar/domains/#{domain_id}})
|
50
|
+
.to_return(read_http_fixture("disableDomainAutoRenewal/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)
|