quiz_api_client 4.5.3 → 4.5.4

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: 67900ec0f740056eb710dd6cdc077376bcff73697d6245f2f8ce724502a9149e
4
- data.tar.gz: 7a46d4cd33abad4cd846460829430867e235ed3e6a9750300da8c72ab9018528
3
+ metadata.gz: c34fb90e53a33d8f34b3ed7c71d6df191b0affd3508ea08bb9484952e280c58d
4
+ data.tar.gz: f65f55cdc0a8596399c08b36f3cb14c5eb5e5c25dd6f3769f8c1f6f06dc94584
5
5
  SHA512:
6
- metadata.gz: 8493ad9be849ebf1d74efed623dd0cafb343731b9d80849fa587474c20eeb0588ff4c9daa9bad63b79947340490abaaf2c3110e2c0e8c9c97094466dbb66a489
7
- data.tar.gz: fab7a363cf5a4f9532cef754579c11df219a44c089531dfd3c2b5b4e4910871a3402c0f61c6e7732e00600bf080385228decd8205639322496afbac18789f1d0
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,3 +1,3 @@
1
1
  module QuizApiClient
2
- VERSION = '4.5.3'.freeze
2
+ VERSION = '4.5.4'.freeze
3
3
  end
@@ -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
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.3
4
+ version: 4.5.4
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: 2022-09-27 00:00:00.000000000 Z
18
+ date: 2022-12-14 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: httparty