quiz_api_client 4.5.2 → 4.5.4
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/lib/quiz_api_client/services/courses_service.rb +7 -0
- data/lib/quiz_api_client/services/quiz_clone_jobs_service.rb +5 -4
- data/lib/quiz_api_client/version.rb +1 -1
- data/spec/services/courses_service_spec.rb +35 -0
- data/spec/services/quiz_clone_jobs_service_spec.rb +2 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c34fb90e53a33d8f34b3ed7c71d6df191b0affd3508ea08bb9484952e280c58d
|
4
|
+
data.tar.gz: f65f55cdc0a8596399c08b36f3cb14c5eb5e5c25dd6f3769f8c1f6f06dc94584
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcac6b8e778f3e404612e5bdda4cd48475f624001004901403a6f5549586a9f93c80bdf51bddcd2aeebad78d3410a0d010a56128e540355f8f7cf334f209b4b2
|
7
|
+
data.tar.gz: 9f6fa6e356e4702bee44a3dded1bbff9ddfb2f223cbe0727b5bdbfa3bafce62c0c748edc7f1b36ddc722032cb70850abc975cd387c45c03143b7f812a4dac735
|
@@ -19,6 +19,13 @@ module QuizApiClient::Services
|
|
19
19
|
)
|
20
20
|
end
|
21
21
|
|
22
|
+
def associate_quizzes(params:, token: nil)
|
23
|
+
client(token: token).patch(
|
24
|
+
"/api/courses/#{params[:canvas_id]}/associate_quizzes",
|
25
|
+
quiz_ids: params[:quiz_ids]
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
22
29
|
private
|
23
30
|
|
24
31
|
def post_to_quiz_api(params:, token:)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module QuizApiClient::Services
|
2
2
|
class QuizCloneJobsService < BaseApiService
|
3
|
-
def create(params:, token: nil)
|
4
|
-
post_to_quiz_api(params: params, token: token)
|
3
|
+
def create(body: nil, params:, token: nil)
|
4
|
+
post_to_quiz_api(body: body, params: params, token: token)
|
5
5
|
end
|
6
6
|
|
7
7
|
def create_batch(body:, token: nil)
|
@@ -10,9 +10,10 @@ module QuizApiClient::Services
|
|
10
10
|
|
11
11
|
private
|
12
12
|
|
13
|
-
def post_to_quiz_api(params:, token:)
|
13
|
+
def post_to_quiz_api(body:, params:, token:)
|
14
14
|
client(token: token).post(
|
15
|
-
"/api/quizzes/#{params.fetch(:quiz_id)}/quiz_clone_jobs"
|
15
|
+
"/api/quizzes/#{params.fetch(:quiz_id)}/quiz_clone_jobs",
|
16
|
+
body
|
16
17
|
)
|
17
18
|
end
|
18
19
|
|
@@ -139,4 +139,39 @@ describe QuizApiClient::Services::CoursesService do
|
|
139
139
|
).to eq(response)
|
140
140
|
end
|
141
141
|
end
|
142
|
+
|
143
|
+
describe '#associate_quizzes' do
|
144
|
+
let(:params) { { canvas_id: 1, quiz_ids: [1, 2, 3] } }
|
145
|
+
let(:response) do
|
146
|
+
{
|
147
|
+
'course' => {
|
148
|
+
'id' => '4',
|
149
|
+
'title' => 'foo',
|
150
|
+
'canvas_id' => '2',
|
151
|
+
'is_blueprint' => true,
|
152
|
+
'created_at' => '2022-06-22T18:59:27.577Z',
|
153
|
+
'updated_at' => '2022-06-22T18:59:27.577Z'
|
154
|
+
},
|
155
|
+
'quizzes_synced' => params[:quiz_ids]
|
156
|
+
}
|
157
|
+
end
|
158
|
+
|
159
|
+
let(:expected_url) { "https://#{host}/api/courses/1/associate_quizzes" }
|
160
|
+
|
161
|
+
before do
|
162
|
+
stub_request(:patch, expected_url)
|
163
|
+
.with(body: { quiz_ids: params[:quiz_ids] }.to_json)
|
164
|
+
.to_return(
|
165
|
+
status: 200,
|
166
|
+
body: response.to_json,
|
167
|
+
headers: { 'Content-Type' => 'application/json' }
|
168
|
+
)
|
169
|
+
end
|
170
|
+
|
171
|
+
it 'patches to the correct endpoint and returns the response' do
|
172
|
+
expect(
|
173
|
+
subject.associate_quizzes(params: params, token: 'token').parsed_response
|
174
|
+
).to eq(response)
|
175
|
+
end
|
176
|
+
end
|
142
177
|
end
|
@@ -5,6 +5,7 @@ describe QuizApiClient::Services::QuizCloneJobsService do
|
|
5
5
|
|
6
6
|
describe '#create' do
|
7
7
|
let(:expected_url) { "https://#{host}/api/quizzes/#{params[:quiz_id]}/quiz_clone_jobs" }
|
8
|
+
let(:body) { { field_overrides: { course_id: 1 } } }
|
8
9
|
let(:params) { { quiz_id: 1 } }
|
9
10
|
let(:stubbed_response) { { 'id' => '1' } }
|
10
11
|
|
@@ -19,7 +20,7 @@ describe QuizApiClient::Services::QuizCloneJobsService do
|
|
19
20
|
end
|
20
21
|
|
21
22
|
it 'posts to /api/quizzes/:quiz_id/quiz_clone_job' do
|
22
|
-
result = subject.create(params: params, token: 'token')
|
23
|
+
result = subject.create(body: body, params: params, token: 'token')
|
23
24
|
expect(result.parsed_response).to eql(stubbed_response)
|
24
25
|
end
|
25
26
|
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.5.
|
4
|
+
version: 4.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Slaughter
|
@@ -11,10 +11,11 @@ authors:
|
|
11
11
|
- Michael Hargiss
|
12
12
|
- Robin Kuss
|
13
13
|
- Ryan Taylor
|
14
|
+
- Dustin Cowles
|
14
15
|
autorequire:
|
15
16
|
bindir: exe
|
16
17
|
cert_chain: []
|
17
|
-
date: 2022-
|
18
|
+
date: 2022-12-14 00:00:00.000000000 Z
|
18
19
|
dependencies:
|
19
20
|
- !ruby/object:Gem::Dependency
|
20
21
|
name: httparty
|
@@ -165,6 +166,7 @@ email:
|
|
165
166
|
- mhargiss@instructure.com
|
166
167
|
- rkuss@instructure.com
|
167
168
|
- rtaylor@instructure.com
|
169
|
+
- dustin.cowles@instructure.com
|
168
170
|
executables: []
|
169
171
|
extensions: []
|
170
172
|
extra_rdoc_files: []
|