quiz_api_client 4.5.5 → 4.6.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbda532d39d3bc76cb64465b5e393d150a469448b9747f5556a0e09f0ccb70cd
|
4
|
+
data.tar.gz: dc2b0545c2b6b7b031fdec7e9fcf084cb69ab897444521fabd62944cfd38e70a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b12c35f7e25194b3e9aa20ecbdd4f9bdc835ba4f948f6659cc62dd360b0288629d4ccda99c65c8b0ba155573c26f0516f1395c5b5151dbc1da4cd30504136695
|
7
|
+
data.tar.gz: 5547cc8b2d32ec019868f88e346285b6fb03b5ebe68bd1c1018aa278a658c38a4f7f76dd1f26aaa8cbb10767731210d94984850dd80077c48cfc6af08a4f41f6
|
@@ -8,6 +8,10 @@ module QuizApiClient::Services
|
|
8
8
|
get_from_quiz_api(params: params, token: token)
|
9
9
|
end
|
10
10
|
|
11
|
+
def destroy(params:, token: nil)
|
12
|
+
delete_from_quiz_api(params: params, token: token)
|
13
|
+
end
|
14
|
+
|
11
15
|
private
|
12
16
|
|
13
17
|
def patch_to_quiz_api(params:, token:)
|
@@ -22,5 +26,11 @@ module QuizApiClient::Services
|
|
22
26
|
"/api/quizzes/#{params[:id]}"
|
23
27
|
)
|
24
28
|
end
|
29
|
+
|
30
|
+
def delete_from_quiz_api(params:, token:)
|
31
|
+
client(token: token).delete(
|
32
|
+
"/api/quizzes/#{params[:id]}"
|
33
|
+
)
|
34
|
+
end
|
25
35
|
end
|
26
36
|
end
|
@@ -26,6 +26,26 @@ describe QuizApiClient::Services::QuizService do
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
describe '#delete' do
|
30
|
+
let(:params) { { id: 1 } }
|
31
|
+
let(:stubbed_response) { { 'id' => 1, 'title' => 'some title' } }
|
32
|
+
let(:expected_url) { "https://#{host}/api/quizzes/#{params[:id]}" }
|
33
|
+
|
34
|
+
before do
|
35
|
+
stub_request(:delete, expected_url)
|
36
|
+
.to_return(
|
37
|
+
status: 200,
|
38
|
+
body: stubbed_response.to_json,
|
39
|
+
headers: { 'Content-Type' => 'application/json' }
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'deletes in quiz_api/api/quizzes and returns the response' do
|
44
|
+
result = subject.destroy(params: params, token: 'token')
|
45
|
+
expect(result.parsed_response).to eql(stubbed_response)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
29
49
|
describe '#show' do
|
30
50
|
let(:params) { { id: 1 } }
|
31
51
|
let(:stubbed_response) { { 'id' => 1, 'title' => 'some title' } }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quiz_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Slaughter
|
@@ -15,7 +15,7 @@ authors:
|
|
15
15
|
autorequire:
|
16
16
|
bindir: exe
|
17
17
|
cert_chain: []
|
18
|
-
date:
|
18
|
+
date: 2023-02-08 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: httparty
|