quiz_api_client 4.26.0 → 4.28.0

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: 182251d8d198f02d1428d74caf6b3216ca7f5a919a6b2eeec7ac2c4c932df208
4
- data.tar.gz: e8ec9ef5a7b469d01a246417705ffb4cb80bbe82b69786ccd6635a789bc60efe
3
+ metadata.gz: 46ae43ef7251183265800713aa817ab4a64dae2857ffefdb7cb41c2b0c382f55
4
+ data.tar.gz: 56c7f637f9ce24e5c1dcd413196ea0f22eb231730b1d136dc08376bd5f7ae94e
5
5
  SHA512:
6
- metadata.gz: 1c5ef1655f96677079f022b6f014a244795702708e3ec48d88b16f7982c72a2d35fe3e755d6e509f0dab7e2e8e50ae71145d93dc5384ef304b5a69f48d4561e6
7
- data.tar.gz: f700f9a028f4ecbcc7fd34866e6690093a4af5b084cfb999f9873269c56f3d970c76ed380a4d53f5895a46517f8a58a623ffdcc693f2d89784f97d0a314d18b1
6
+ metadata.gz: 51237cf5f7622748da9ff40d3ae9a4e3d713e1bc8215a14ed7f7965c1ce738c918f354b3986de0311900d228fc09b040b9b8d97c888f1724c946114f90003167
7
+ data.tar.gz: 4fb59568a7ad19f902d5362cea762cd02b6eebb2cee67bbb1f6ed397ebd2b500951a9eb8fc8a934cb88ec4f90d96201e1cd33acd2420c39990d867746d861ebd
data/README.md CHANGED
@@ -188,6 +188,15 @@ You can also run `bundle exec rake console` for an interactive prompt that will
188
188
 
189
189
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
190
190
 
191
+ # Development with Docker
192
+
193
+ 1. Install Docker
194
+ 2. Use the following command to start a temporary container and run a bash shell:
195
+
196
+ ```shell
197
+ docker compose -f docker-compose.yml -f docker-compose.dev.override.yml run --rm app /bin/bash
198
+ ```
199
+
191
200
  ## Development with Quiz LTI
192
201
 
193
202
  Copy this repo inside the Quiz LTI docker container:
@@ -15,7 +15,11 @@ module QuizApiClient::Services
15
15
  session: params[:quiz_session_id],
16
16
  result: params[:quiz_session_result_id]
17
17
  )
18
- client(token: token).get(path, all: all)
18
+ client(token: token).get(
19
+ path,
20
+ query: params.slice(:per_page, :last_evaluated_hash_key, :last_evaluated_range_key),
21
+ all: all
22
+ )
19
23
  end
20
24
  end
21
25
  end
@@ -11,6 +11,7 @@ module QuizApiClient::Services
11
11
  def get_from_quiz_api(params:, token:, all:)
12
12
  client(token: token).get(
13
13
  "/api/quiz_sessions/#{params[:quiz_session_id]}/session_items",
14
+ query: params.slice(:per_page, :last_evaluated_hash_key, :last_evaluated_range_key),
14
15
  all: all
15
16
  )
16
17
  end
@@ -1,3 +1,3 @@
1
1
  module QuizApiClient
2
- VERSION = '4.26.0'.freeze
2
+ VERSION = '4.28.0'.freeze
3
3
  end
@@ -3,9 +3,8 @@ describe QuizApiClient::Services::SessionItemResultsService do
3
3
  let(:config) { QuizApiClient::Config.new { |c| c.host = host } }
4
4
  let(:subject) { described_class.new(config) }
5
5
 
6
- describe '#index' do
6
+ describe '#list' do
7
7
  let(:params) { { quiz_session_id: 1, quiz_session_result_id: 1 } }
8
- let(:stubbed_response) { { 'id' => '1_1', 'item' => { 'id' => '1' } } }
9
8
  let(:expected_url) do
10
9
  format(
11
10
  'https://%<host>s/api/quiz_sessions/%<session>d/results/%<result>d/session_item_results',
@@ -14,20 +13,28 @@ describe QuizApiClient::Services::SessionItemResultsService do
14
13
  result: params[:quiz_session_result_id]
15
14
  )
16
15
  end
17
- let(:status_code) { 200 }
18
16
 
19
- before do
20
- stub_request(:get, expected_url)
21
- .to_return(
22
- status: status_code,
23
- body: stubbed_response.to_json,
24
- headers: { 'Content-Type' => 'application/json' }
25
- )
26
- end
17
+ it 'reads a bounded page and resumes from its cursor' do
18
+ cursor = { last_evaluated_hash_key: 'result/account+', last_evaluated_range_key: '1_2' }
19
+ stub_request(:get, expected_url).with(query: { per_page: '1' }).to_return(
20
+ body: [{ 'item_id' => 1 }].to_json,
21
+ headers: {
22
+ 'Content-Type' => 'application/json',
23
+ 'X-Last-Evaluated-Hash-Key' => 'result/account+',
24
+ 'X-Last-Evaluated-Range-Key' => '1_2'
25
+ }
26
+ )
27
+ stub_request(:get, expected_url).with(query: { per_page: '1', **cursor }).to_return(
28
+ body: [{ 'item_id' => 2 }].to_json,
29
+ headers: { 'Content-Type' => 'application/json' }
30
+ )
31
+
32
+ first = subject.list(params: params.merge(per_page: 1), token: 'token')
33
+ expect(first.parsed_response).to eq([{ 'item_id' => 1 }])
34
+ expect(first.headers['x-last-evaluated-range-key']).to eq('1_2')
27
35
 
28
- it 'gets session_item_results and returns the response' do
29
- response = subject.list(params: params, token: 'token')
30
- expect(response.parsed_response).to eql(stubbed_response)
36
+ second = subject.list(params: params.merge(per_page: 1, **cursor, unrelated: 'ignored'), token: 'token')
37
+ expect(second.parsed_response).to eq([{ 'item_id' => 2 }])
31
38
  end
32
39
  end
33
40
  end
@@ -3,24 +3,31 @@ describe QuizApiClient::Services::SessionItemsService do
3
3
  let(:config) { QuizApiClient::Config.new { |c| c.host = host } }
4
4
  let(:subject) { described_class.new(config) }
5
5
 
6
- describe '#index' do
6
+ describe '#list' do
7
7
  let(:params) { { quiz_session_id: 1 } }
8
- let(:stubbed_response) { { 'id' => '1_1', 'item' => { 'id' => '1' } } }
9
8
  let(:expected_url) { "https://#{host}/api/quiz_sessions/#{params[:quiz_session_id]}/session_items" }
10
- let(:status_code) { 200 }
11
9
 
12
- before do
13
- stub_request(:get, expected_url)
14
- .to_return(
15
- status: status_code,
16
- body: stubbed_response.to_json,
17
- headers: { 'Content-Type' => 'application/json' }
18
- )
19
- end
10
+ it 'reads a bounded page and resumes from its cursor' do
11
+ cursor = { last_evaluated_hash_key: 'session/account+', last_evaluated_range_key: '1' }
12
+ stub_request(:get, expected_url).with(query: { per_page: '1' }).to_return(
13
+ body: [{ 'position' => 1 }].to_json,
14
+ headers: {
15
+ 'Content-Type' => 'application/json',
16
+ 'X-Last-Evaluated-Hash-Key' => 'session/account+',
17
+ 'X-Last-Evaluated-Range-Key' => '1'
18
+ }
19
+ )
20
+ stub_request(:get, expected_url).with(query: { per_page: '1', **cursor }).to_return(
21
+ body: [{ 'position' => 2 }].to_json,
22
+ headers: { 'Content-Type' => 'application/json' }
23
+ )
24
+
25
+ first = subject.list(params: params.merge(per_page: 1), token: 'token')
26
+ expect(first.parsed_response).to eq([{ 'position' => 1 }])
27
+ expect(first.headers['x-last-evaluated-range-key']).to eq('1')
20
28
 
21
- it 'gets from quiz_api/api/quiz_sessions/:id/session_items and returns the response' do
22
- result = subject.list(params: params, token: 'token')
23
- expect(result.parsed_response).to eql(stubbed_response)
29
+ second = subject.list(params: params.merge(per_page: 1, **cursor, unrelated: 'ignored'), token: 'token')
30
+ expect(second.parsed_response).to eq([{ 'position' => 2 }])
24
31
  end
25
32
  end
26
33
  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.26.0
4
+ version: 4.28.0
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: 2026-05-08 00:00:00.000000000 Z
18
+ date: 2026-11-13 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: httparty
@@ -35,16 +35,22 @@ dependencies:
35
35
  name: jwt
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '2'
41
+ - - "<"
39
42
  - !ruby/object:Gem::Version
40
- version: '2.2'
43
+ version: '4'
41
44
  type: :runtime
42
45
  prerelease: false
43
46
  version_requirements: !ruby/object:Gem::Requirement
44
47
  requirements:
45
- - - "~>"
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '2'
51
+ - - "<"
46
52
  - !ruby/object:Gem::Version
47
- version: '2.2'
53
+ version: '4'
48
54
  - !ruby/object:Gem::Dependency
49
55
  name: link_header
50
56
  requirement: !ruby/object:Gem::Requirement