quiz_api_client 4.5.0 → 4.5.2

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: 20c474d0431dbdf5c2cf34902592b90336b535e1d5d9197570fa727b5d6cbb00
4
- data.tar.gz: c029697bd27fae184dd98e524cfe94fdc4525b3fea9fb8163ae0d06e4d8a719e
3
+ metadata.gz: 70b15efbfcbaa839cb8926bd79a9e59ff4fac43d23fb9d9006b018660c57c208
4
+ data.tar.gz: 660cbf7a8ed8a218609c048412353c49144b27cbaad8ed7c2f7358fade2741f5
5
5
  SHA512:
6
- metadata.gz: c333252cda2aac00b2704651253493fb2fc0e8a50c4a9687605b54ea8bd6fb8da1ebbbda039daa019fec9f5b726cab6b1566ced7e72e9970830950f697195577
7
- data.tar.gz: 66c6aafb605ccc6c54fc8d7f7c3c3d3055d017984ac4dba6fb5c1be8f085abb72bdb3bf8e8b531da3a1cbc2a3db7aea3648b38e6f31644ba98bc0df4e5615c0f
6
+ metadata.gz: 957d26373a0ede105dd0cf541282101b33fd356cc1ad35458983f3bcb687fa0ff6d65bedb4cc1ff9bb64fa1d603d315845cb61e6b5d05949a294e6412e248b97
7
+ data.tar.gz: e5e1211e0a2d0556ab4ccf4b1273ea1ff0b179bc074bdc00e9f8cf11fdc2bd38b96c61c3ebdc81c6df7c64092adfae83817ae7b73557c62a46afbd2088757720
@@ -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:)
@@ -24,7 +31,7 @@ module QuizApiClient::Services
24
31
  def patch_to_quiz_api(params:, token:)
25
32
  client(token: token).patch(
26
33
  "/api/courses/#{params[:canvas_id]}",
27
- course: params.tap { |p| p.delete(:canvas_id) }
34
+ course: params.dup.tap { |p| p.delete(:canvas_id) }
28
35
  )
29
36
  end
30
37
 
@@ -1,3 +1,3 @@
1
1
  module QuizApiClient
2
- VERSION = '4.5.0'.freeze
2
+ VERSION = '4.5.2'.freeze
3
3
  end
@@ -79,6 +79,11 @@ describe QuizApiClient::Services::CoursesService do
79
79
  subject.update(params: params, token: 'token').parsed_response
80
80
  ).to eq(response)
81
81
  end
82
+
83
+ it 'does not modify params' do
84
+ subject.update(params: params, token: 'token')
85
+ expect(params).to eq params
86
+ end
82
87
  end
83
88
 
84
89
  describe '#destroy' do
@@ -95,4 +100,43 @@ describe QuizApiClient::Services::CoursesService do
95
100
  expect(response.body).to be_nil
96
101
  end
97
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
98
142
  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.0
4
+ version: 4.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Slaughter
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: exe
16
16
  cert_chain: []
17
- date: 2022-07-28 00:00:00.000000000 Z
17
+ date: 2022-09-27 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: httparty
@@ -246,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
246
246
  - !ruby/object:Gem::Version
247
247
  version: '0'
248
248
  requirements: []
249
- rubygems_version: 3.1.6
249
+ rubygems_version: 3.3.7
250
250
  signing_key:
251
251
  specification_version: 4
252
252
  summary: Ruby client for quiz_api