quiz_api_client 4.5.3 → 4.5.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67900ec0f740056eb710dd6cdc077376bcff73697d6245f2f8ce724502a9149e
4
- data.tar.gz: 7a46d4cd33abad4cd846460829430867e235ed3e6a9750300da8c72ab9018528
3
+ metadata.gz: e196b0e4e13e76a80714e5e7a2f0c673f6e66e11e3a7fb364a852eaac05308a4
4
+ data.tar.gz: 83c1f4e73aeb96e2ee17e2ffd53a6bafd2a238682630e9436ab8105261b24799
5
5
  SHA512:
6
- metadata.gz: 8493ad9be849ebf1d74efed623dd0cafb343731b9d80849fa587474c20eeb0588ff4c9daa9bad63b79947340490abaaf2c3110e2c0e8c9c97094466dbb66a489
7
- data.tar.gz: fab7a363cf5a4f9532cef754579c11df219a44c089531dfd3c2b5b4e4910871a3402c0f61c6e7732e00600bf080385228decd8205639322496afbac18789f1d0
6
+ metadata.gz: b9b0add32c57db8335f8cf7279eac5d13b14dc18de2addbb4c288e2509bc01ddab937ee5a1889ecfc45ef58850dde445325cea10f1df5ae05a71dc0c8a9b2a6c
7
+ data.tar.gz: d964ce65c877a98d75b458ae0bde45a0dd6e878e92abc293cdb01ed1f0dd77ab2717e4e93f8d11d464c2b7247b95aac2d9f7a9703ae8bd01712d260ea3a71296
@@ -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,6 +1,6 @@
1
1
  module QuizApiClient::Services
2
2
  class QuizCloneJobsService < BaseApiService
3
- def create(body: nil, params:, token: nil)
3
+ def create(body: {}, params:, token: nil)
4
4
  post_to_quiz_api(body: body, params: params, token: token)
5
5
  end
6
6
 
@@ -1,3 +1,3 @@
1
1
  module QuizApiClient
2
- VERSION = '4.5.3'.freeze
2
+ VERSION = '4.5.5'.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.5
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