quiz_api_client 4.5.1 → 4.5.3

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: 316ba7a8bde533e2ef09e6e0a5e2c443a597ae3bfda7c00cf5280c2ab5e75bb0
4
- data.tar.gz: ec869a63880d44c2fb7920f95dd80b042671c954bb4a5a972d6ebbc00261f5b1
3
+ metadata.gz: 67900ec0f740056eb710dd6cdc077376bcff73697d6245f2f8ce724502a9149e
4
+ data.tar.gz: 7a46d4cd33abad4cd846460829430867e235ed3e6a9750300da8c72ab9018528
5
5
  SHA512:
6
- metadata.gz: 3611bb4fb2775b6a96669bd276cfa513cd47f1177dd98b76757fea5311241e4066184228dce6c9aa78b9f70a004ae908b56981870301f21527ae87068e7a29a0
7
- data.tar.gz: 4f9988a4c3791f69c25b53eb9db65194643d2d1639c8327f942a71e4264e7662c17f24a6094d6dfd58fd4168a6e53e78da613ba8f268f745d209b615838d62ac
6
+ metadata.gz: 8493ad9be849ebf1d74efed623dd0cafb343731b9d80849fa587474c20eeb0588ff4c9daa9bad63b79947340490abaaf2c3110e2c0e8c9c97094466dbb66a489
7
+ data.tar.gz: fab7a363cf5a4f9532cef754579c11df219a44c089531dfd3c2b5b4e4910871a3402c0f61c6e7732e00600bf080385228decd8205639322496afbac18789f1d0
@@ -12,6 +12,13 @@ module QuizApiClient::Services
12
12
  delete_from_quiz_api(params: params, token: token)
13
13
  end
14
14
 
15
+ def sync_blueprint_restrictions(params:, token: nil)
16
+ client(token: token).post(
17
+ "/api/courses/#{params[:canvas_id]}/sync_blueprint_restrictions",
18
+ lock_quizzes: params[:lock_quizzes]
19
+ )
20
+ end
21
+
15
22
  private
16
23
 
17
24
  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
 
@@ -1,3 +1,3 @@
1
1
  module QuizApiClient
2
- VERSION = '4.5.1'.freeze
2
+ VERSION = '4.5.3'.freeze
3
3
  end
@@ -100,4 +100,43 @@ describe QuizApiClient::Services::CoursesService do
100
100
  expect(response.body).to be_nil
101
101
  end
102
102
  end
103
+
104
+ describe '#sync_blueprint_restrictions' do
105
+ let(:params) { { canvas_id: 1, lock_quizzes: true } }
106
+ let(:response) do
107
+ {
108
+ 'course' => {
109
+ 'id' => '1',
110
+ 'title' => 'course one',
111
+ 'canvas_id' => '1',
112
+ 'is_blueprint' => true,
113
+ 'parent_course_id' => '',
114
+ 'created_at' => '2022-09-13T18:53:21.303Z',
115
+ 'updated_at' => '2022-09-13T18:53:21.367Z'
116
+ },
117
+ 'quizzes_synced' => [
118
+ 1,
119
+ 2
120
+ ]
121
+ }
122
+ end
123
+
124
+ let(:expected_url) { "https://#{host}/api/courses/1/sync_blueprint_restrictions" }
125
+
126
+ before do
127
+ stub_request(:post, expected_url)
128
+ .with(body: { lock_quizzes: true }.to_json)
129
+ .to_return(
130
+ status: 200,
131
+ body: response.to_json,
132
+ headers: { 'Content-Type' => 'application/json' }
133
+ )
134
+ end
135
+
136
+ it 'posts to the correct endpoint and returns the response' do
137
+ expect(
138
+ subject.sync_blueprint_restrictions(params: params, token: 'token').parsed_response
139
+ ).to eq(response)
140
+ end
141
+ end
103
142
  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.1
4
+ version: 4.5.3
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-08-08 00:00:00.000000000 Z
18
+ date: 2022-09-27 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: []
@@ -246,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
246
248
  - !ruby/object:Gem::Version
247
249
  version: '0'
248
250
  requirements: []
249
- rubygems_version: 3.1.6
251
+ rubygems_version: 3.3.7
250
252
  signing_key:
251
253
  specification_version: 4
252
254
  summary: Ruby client for quiz_api