quiz_api_client 4.18.0 → 4.19.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: c6a0d785f0b483d712f8c6cbbef7407ef0f41831f013d7c90d1bbf686236681a
|
4
|
+
data.tar.gz: 2ab9f601ee6ec4f73b2319bbe0fedb7f733932266f6ebe5d306248811c2b1e98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f331cf1b2338ff28c863a920694783c615e42ecaeedf9b50d273c6e37b36da6a9285931ee8ab86ac7b898b22118442893595b2981a07443179e952d70f76922e
|
7
|
+
data.tar.gz: 8b2761df171c12a676dd3d7efb01af5eb9da737330d03023159c8178d60056ed94d799d0871301fbf9897d481591e33a76f07609f1c038621f2d7d07d96d8995
|
@@ -1,7 +1,15 @@
|
|
1
1
|
module QuizApiClient::Services
|
2
2
|
class AnalysesService < BaseApiService
|
3
3
|
def create(params:, token: nil)
|
4
|
-
|
4
|
+
post_to_analyses(params: params, token: token)
|
5
|
+
end
|
6
|
+
|
7
|
+
def create_report(params:, token: nil)
|
8
|
+
post_to_create_report(params: params, token: token)
|
9
|
+
end
|
10
|
+
|
11
|
+
def abort_report(params:, token: nil)
|
12
|
+
post_to_abort_report(params: params, token: token)
|
5
13
|
end
|
6
14
|
|
7
15
|
def show(params:, token: nil)
|
@@ -27,11 +35,23 @@ module QuizApiClient::Services
|
|
27
35
|
|
28
36
|
private
|
29
37
|
|
30
|
-
def
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
38
|
+
def post_to_create_report(params:, token:)
|
39
|
+
path = "/api/quizzes/#{params[:quiz_id]}/analyses/create_report"
|
40
|
+
post_to_quiz_api(path: path, params: params, token: token)
|
41
|
+
end
|
42
|
+
|
43
|
+
def post_to_abort_report(params:, token:)
|
44
|
+
path = "/api/quizzes/#{params[:quiz_id]}/analyses/abort"
|
45
|
+
post_to_quiz_api(path: path, params: params, token: token)
|
46
|
+
end
|
47
|
+
|
48
|
+
def post_to_analyses(params:, token:)
|
49
|
+
path = "/api/quizzes/#{params[:quiz_id]}/analyses"
|
50
|
+
post_to_quiz_api(path: path, params: params, token: token)
|
51
|
+
end
|
52
|
+
|
53
|
+
def post_to_quiz_api(path:, params:, token:)
|
54
|
+
client(token: token).post(path, params)
|
35
55
|
end
|
36
56
|
end
|
37
57
|
end
|
@@ -31,6 +31,32 @@ describe QuizApiClient::Services::AnalysesService do
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
describe '#create_report' do
|
35
|
+
let(:params) do
|
36
|
+
{ quiz_id: 1, quiz_session_ids: [1, 5, 10], filter: :last_attempt, analysis_type: 'student_analysis' }
|
37
|
+
end
|
38
|
+
let(:stubbed_response) { { 'job_id' => 1 } }
|
39
|
+
let(:expected_url) { "https://#{host}/api/quizzes/#{params[:quiz_id]}/analyses/create_report" }
|
40
|
+
let(:status_code) { 200 }
|
41
|
+
|
42
|
+
before do
|
43
|
+
stub_request(:post, expected_url)
|
44
|
+
.with(
|
45
|
+
body: params.to_json
|
46
|
+
)
|
47
|
+
.to_return(
|
48
|
+
status: status_code,
|
49
|
+
body: stubbed_response.to_json,
|
50
|
+
headers: { 'Content-Type' => 'application/json' }
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'posts to quiz_api/api/quizzes/{id}/analyses and returns the response' do
|
55
|
+
result = subject.create_report(params: params, token: 'token')
|
56
|
+
expect(result.parsed_response).to eql(stubbed_response)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
34
60
|
describe '#show' do
|
35
61
|
let(:params) do
|
36
62
|
{ quiz_id: 1, id: 2 }
|
@@ -109,4 +135,27 @@ describe QuizApiClient::Services::AnalysesService do
|
|
109
135
|
expect(result.parsed_response).to eql([%w[column1 column2 column3]])
|
110
136
|
end
|
111
137
|
end
|
138
|
+
|
139
|
+
describe 'abort_report' do
|
140
|
+
let(:params) do
|
141
|
+
{ quiz_id: 1, report_id: 2 }
|
142
|
+
end
|
143
|
+
let(:expected_url) { "https://#{host}/api/quizzes/#{params[:quiz_id]}/analyses/abort" }
|
144
|
+
let(:status_code) { 204 }
|
145
|
+
|
146
|
+
before do
|
147
|
+
stub_request(:post, expected_url)
|
148
|
+
.with(
|
149
|
+
body: params.to_json
|
150
|
+
)
|
151
|
+
.to_return(
|
152
|
+
status: status_code
|
153
|
+
)
|
154
|
+
end
|
155
|
+
|
156
|
+
it 'posts to quiz_api/api/quizzes/{id}/analyses/abort and returns the response' do
|
157
|
+
result = subject.abort_report(params: params, token: 'token')
|
158
|
+
expect(result.code).to eql(status_code)
|
159
|
+
end
|
160
|
+
end
|
112
161
|
end
|
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.19.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: 2025-01-27 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: httparty
|