quiz_api_client 4.11.0 → 4.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/quiz_api_client/services/analyses_service.rb +3 -2
- data/lib/quiz_api_client/services/content_exports_service.rb +12 -0
- data/lib/quiz_api_client/version.rb +1 -1
- data/spec/services/analyses_service_spec.rb +3 -3
- data/spec/services/content_exports_service_spec.rb +36 -16
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf8ebb895e11ed001175aa646a27c6a9b8667f8a1a0caa787f58d2035de8b898
|
4
|
+
data.tar.gz: 52a4fa85e3091c58e852b8c7e5f82b24f724e69793df3fdd449f0a2803df90ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 775ff430f08c656af27901035b17ca44c0ba22a804ae533d97ef938cb78ff5bf774a98241d825a40e0501dfd45119853b187bf810142298ffc19fdba6d7afd2b
|
7
|
+
data.tar.gz: 756a49f30f6bd9e020ad817206a6afaf6121599507fea8dc7399df4f680fe8cf0c0601b2f733356402a1b3978199bb11c97a482b0b1222b9bb87373f4ab128cc
|
@@ -8,8 +8,9 @@ module QuizApiClient::Services
|
|
8
8
|
|
9
9
|
def post_to_quiz_api(params:, token:)
|
10
10
|
client(token: token).post(
|
11
|
-
"/api/quizzes/#{params[:quiz_id]}/
|
12
|
-
|
11
|
+
"/api/quizzes/#{params[:quiz_id]}/analyses",
|
12
|
+
quiz_session_ids: params[:quiz_session_ids],
|
13
|
+
filter: params[:filter]
|
13
14
|
)
|
14
15
|
end
|
15
16
|
end
|
@@ -4,6 +4,12 @@ module QuizApiClient::Services
|
|
4
4
|
post_to_quiz_api(params: params, token: token)
|
5
5
|
end
|
6
6
|
|
7
|
+
def show(params:, token: nil)
|
8
|
+
raise 'Content Export Id Required' unless params && params[:id]
|
9
|
+
|
10
|
+
get_from_quiz_api(params: params, token: token)
|
11
|
+
end
|
12
|
+
|
7
13
|
private
|
8
14
|
|
9
15
|
def post_to_quiz_api(params:, token:)
|
@@ -12,5 +18,11 @@ module QuizApiClient::Services
|
|
12
18
|
content_export: params
|
13
19
|
)
|
14
20
|
end
|
21
|
+
|
22
|
+
def get_from_quiz_api(params:, token:)
|
23
|
+
client(token: token).get(
|
24
|
+
"/api/content_exports/#{params[:id]}"
|
25
|
+
)
|
26
|
+
end
|
15
27
|
end
|
16
28
|
end
|
@@ -5,10 +5,10 @@ describe QuizApiClient::Services::AnalysesService do
|
|
5
5
|
|
6
6
|
describe '#create' do
|
7
7
|
let(:params) do
|
8
|
-
{ quiz_id: 1,
|
8
|
+
{ quiz_id: 1, quiz_session_ids: [1, 5, 10], filter: :last_attempt }
|
9
9
|
end
|
10
10
|
let(:stubbed_response) { { 'job_id' => 1 } }
|
11
|
-
let(:expected_url) { "https://#{host}/api/quizzes/#{params[:quiz_id]}/
|
11
|
+
let(:expected_url) { "https://#{host}/api/quizzes/#{params[:quiz_id]}/analyses" }
|
12
12
|
let(:status_code) { 200 }
|
13
13
|
|
14
14
|
before do
|
@@ -20,7 +20,7 @@ describe QuizApiClient::Services::AnalysesService do
|
|
20
20
|
)
|
21
21
|
end
|
22
22
|
|
23
|
-
it 'posts to quiz_api/api/quizzes/{id}/
|
23
|
+
it 'posts to quiz_api/api/quizzes/{id}/analyses and returns the response' do
|
24
24
|
result = subject.create(params: params, token: 'token')
|
25
25
|
expect(result.parsed_response).to eql(stubbed_response)
|
26
26
|
end
|
@@ -3,6 +3,20 @@ describe QuizApiClient::Services::ContentExportsService do
|
|
3
3
|
let(:config) { QuizApiClient::Config.new { |c| c.host = host } }
|
4
4
|
let(:subject) { described_class.new(config) }
|
5
5
|
|
6
|
+
let(:stubbed_response) do
|
7
|
+
{
|
8
|
+
'id' => '1',
|
9
|
+
'canvas_content_export_id' => '1234',
|
10
|
+
'export_settings' => {
|
11
|
+
'quizzes' => [10, 11],
|
12
|
+
'everything' => false,
|
13
|
+
'content_export_type' => 'qti'
|
14
|
+
},
|
15
|
+
'created_at' => '2023-02-17T01:00:00.000Z',
|
16
|
+
'updated_at' => '2023-02-17T01:00:00.000Z'
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
6
20
|
describe '#create' do
|
7
21
|
let(:params) do
|
8
22
|
{
|
@@ -15,20 +29,6 @@ describe QuizApiClient::Services::ContentExportsService do
|
|
15
29
|
}
|
16
30
|
end
|
17
31
|
|
18
|
-
let(:response) do
|
19
|
-
{
|
20
|
-
'id' => '1',
|
21
|
-
'canvas_content_export_id' => '1234',
|
22
|
-
'export_settings' => {
|
23
|
-
'quizzes' => [10, 11],
|
24
|
-
'everything' => false,
|
25
|
-
'content_export_type' => 'qti'
|
26
|
-
},
|
27
|
-
'created_at' => '2023-02-17T01:00:00.000Z',
|
28
|
-
'updated_at' => '2023-02-17T01:00:00.000Z'
|
29
|
-
}
|
30
|
-
end
|
31
|
-
|
32
32
|
let(:expected_url) { "https://#{host}/api/content_exports" }
|
33
33
|
|
34
34
|
before do
|
@@ -36,7 +36,7 @@ describe QuizApiClient::Services::ContentExportsService do
|
|
36
36
|
.with(body: { content_export: params }.to_json)
|
37
37
|
.to_return(
|
38
38
|
status: 201,
|
39
|
-
body:
|
39
|
+
body: stubbed_response.to_json,
|
40
40
|
headers: { 'Content-Type' => 'application/json' }
|
41
41
|
)
|
42
42
|
end
|
@@ -44,7 +44,27 @@ describe QuizApiClient::Services::ContentExportsService do
|
|
44
44
|
it 'posts to the correct endpoint and returns the response' do
|
45
45
|
expect(
|
46
46
|
subject.create(params: params, token: 'token').parsed_response
|
47
|
-
).to eq(
|
47
|
+
).to eq(stubbed_response)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '#show' do
|
52
|
+
let(:params) { { id: 1 } }
|
53
|
+
let(:expected_url) { "https://#{host}/api/content_exports/#{params[:id]}" }
|
54
|
+
let(:status_code) { 200 }
|
55
|
+
|
56
|
+
before do
|
57
|
+
stub_request(:get, expected_url)
|
58
|
+
.to_return(
|
59
|
+
status: status_code,
|
60
|
+
body: stubbed_response.to_json,
|
61
|
+
headers: { 'Content-Type' => 'application/json' }
|
62
|
+
)
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'gets from quiz_api/api/content_exports and returns the response' do
|
66
|
+
response = subject.show(params: params, token: 'token')
|
67
|
+
expect(response.parsed_response).to eql(stubbed_response)
|
48
68
|
end
|
49
69
|
end
|
50
70
|
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.12.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: 2023-
|
18
|
+
date: 2023-06-05 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: httparty
|
@@ -252,7 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
252
252
|
- !ruby/object:Gem::Version
|
253
253
|
version: '0'
|
254
254
|
requirements: []
|
255
|
-
rubygems_version: 3.
|
255
|
+
rubygems_version: 3.4.10
|
256
256
|
signing_key:
|
257
257
|
specification_version: 4
|
258
258
|
summary: Ruby client for quiz_api
|