quiz_api_client 4.11.0 → 4.11.1

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: 7b281ace3f326513105636560b94d9af165baf24dd5ad98bd1ed82f6f1345962
4
- data.tar.gz: d321bc94f8190d043fe54fda0a7f3b18b2493e3f1658a5b363a5d93294254889
3
+ metadata.gz: 296ae98e95e4fff6555495c5ae214e08fe3c54d5ed7ad0dcc5b6438097e4229e
4
+ data.tar.gz: f9b544b10bf67683f216e0f357fd6ce3862cfc8cc526b9f9eb62506a89f30745
5
5
  SHA512:
6
- metadata.gz: 32934db0eba2063233187faaa52f02d9294631a1606cb715402cf24da97709b3c82d0fd0bea24eabfad7eea9b0f9be434f9f6820ecd7b481e065ea0623025058
7
- data.tar.gz: 1d9d7936b213458c62f4b0b0a23e390e642b9d2de686c1b3d28c814882c0d9d1d02515f8a3d08a6e1cd1837edbb748b8e2ac0a31129bfb3dc92e5ae302b03595
6
+ metadata.gz: b00e342816f726c8f06bde41615b4e474866d99c3f63bc216e2a4bb3803c7c2e879ef1c82a08c4e08b571aed5af5091a91559b291214fe07f060bc6cf6c16bc5
7
+ data.tar.gz: f6f0e3ddd4197ae8dc2567a58c3e6b67ca6835cbf6ac7c21144e2bd3d021ba111f922794a1d499fd6b1110ccdb5b3fa7c13ebae52d179dbaf68ff61bd0e3ca1d
@@ -4,6 +4,12 @@ module QuizApiClient::Services
4
4
  post_to_quiz_api(params: params, token: token)
5
5
  end
6
6
 
7
+ def show(params:, token: nil)
8
+ raise 'Content Export Id Required' unless params && params[:id]
9
+
10
+ get_from_quiz_api(params: params, token: token)
11
+ end
12
+
7
13
  private
8
14
 
9
15
  def post_to_quiz_api(params:, token:)
@@ -12,5 +18,11 @@ module QuizApiClient::Services
12
18
  content_export: params
13
19
  )
14
20
  end
21
+
22
+ def get_from_quiz_api(params:, token:)
23
+ client(token: token).get(
24
+ "/api/content_exports/#{params[:id]}"
25
+ )
26
+ end
15
27
  end
16
28
  end
@@ -1,3 +1,3 @@
1
1
  module QuizApiClient
2
- VERSION = '4.11.0'.freeze
2
+ VERSION = '4.11.1'.freeze
3
3
  end
@@ -3,6 +3,20 @@ describe QuizApiClient::Services::ContentExportsService do
3
3
  let(:config) { QuizApiClient::Config.new { |c| c.host = host } }
4
4
  let(:subject) { described_class.new(config) }
5
5
 
6
+ let(:stubbed_response) do
7
+ {
8
+ 'id' => '1',
9
+ 'canvas_content_export_id' => '1234',
10
+ 'export_settings' => {
11
+ 'quizzes' => [10, 11],
12
+ 'everything' => false,
13
+ 'content_export_type' => 'qti'
14
+ },
15
+ 'created_at' => '2023-02-17T01:00:00.000Z',
16
+ 'updated_at' => '2023-02-17T01:00:00.000Z'
17
+ }
18
+ end
19
+
6
20
  describe '#create' do
7
21
  let(:params) do
8
22
  {
@@ -15,20 +29,6 @@ describe QuizApiClient::Services::ContentExportsService do
15
29
  }
16
30
  end
17
31
 
18
- let(:response) do
19
- {
20
- 'id' => '1',
21
- 'canvas_content_export_id' => '1234',
22
- 'export_settings' => {
23
- 'quizzes' => [10, 11],
24
- 'everything' => false,
25
- 'content_export_type' => 'qti'
26
- },
27
- 'created_at' => '2023-02-17T01:00:00.000Z',
28
- 'updated_at' => '2023-02-17T01:00:00.000Z'
29
- }
30
- end
31
-
32
32
  let(:expected_url) { "https://#{host}/api/content_exports" }
33
33
 
34
34
  before do
@@ -36,7 +36,7 @@ describe QuizApiClient::Services::ContentExportsService do
36
36
  .with(body: { content_export: params }.to_json)
37
37
  .to_return(
38
38
  status: 201,
39
- body: response.to_json,
39
+ body: stubbed_response.to_json,
40
40
  headers: { 'Content-Type' => 'application/json' }
41
41
  )
42
42
  end
@@ -44,7 +44,27 @@ describe QuizApiClient::Services::ContentExportsService do
44
44
  it 'posts to the correct endpoint and returns the response' do
45
45
  expect(
46
46
  subject.create(params: params, token: 'token').parsed_response
47
- ).to eq(response)
47
+ ).to eq(stubbed_response)
48
+ end
49
+ end
50
+
51
+ describe '#show' do
52
+ let(:params) { { id: 1 } }
53
+ let(:expected_url) { "https://#{host}/api/content_exports/#{params[:id]}" }
54
+ let(:status_code) { 200 }
55
+
56
+ before do
57
+ stub_request(:get, expected_url)
58
+ .to_return(
59
+ status: status_code,
60
+ body: stubbed_response.to_json,
61
+ headers: { 'Content-Type' => 'application/json' }
62
+ )
63
+ end
64
+
65
+ it 'gets from quiz_api/api/content_exports and returns the response' do
66
+ response = subject.show(params: params, token: 'token')
67
+ expect(response.parsed_response).to eql(stubbed_response)
48
68
  end
49
69
  end
50
70
  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.11.0
4
+ version: 4.11.1
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: 2023-03-31 00:00:00.000000000 Z
18
+ date: 2023-04-18 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: httparty