quiz_api_client 4.7.0 → 4.8.0

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: 75b8beea94a5e16f60fd8f37f34e952b6fe7964178561e1d6e93a0c0a8fa7f93
4
- data.tar.gz: 43eaa7a546489ceaa98c9765357f70bdadb64da7348dfc6bdc7599da42b7ab43
3
+ metadata.gz: 057d0dea94cbf0a0781d3c8144906a8ea7b29790f278f4d4a55891aaf6c3a12b
4
+ data.tar.gz: c5241135784c367e250fe0fb0a1e6012fc391c2a9d09c1225173f1acfbb3a595
5
5
  SHA512:
6
- metadata.gz: ffd1d5bb30fb3136429a3031aa847aa0fe9dd58c38a071f00c88e90ee37c8f56a0870cfc9cfb209fc8b1c24b6525cd38f57a891c922473b816305d62a64e3185
7
- data.tar.gz: 369fb4ddd2ebf9151d86637d6b2991e82e926fb0b9952854f86be2623c362361154e80e355c615717ab25e3b360a25442e3ada1253074f1e57f9eba8867567c7
6
+ metadata.gz: 89212f479d1081e38ad2005e5f7b84a4c3c5088b1620c6673cc2538fa719ed73f9eba1df31c5bca786c0efa4c3755d9e5bcd37e2508e7aaec73ee8ad41b1bdc4
7
+ data.tar.gz: b2be42851612a9fae066ff5dcfdd322e6d66d821ddd03fa53083e8713e90c8d4ad780de177c4f13752919897ffc0e720e8b8aa2db98f27e159c73e3f64e9cd2f
@@ -0,0 +1,16 @@
1
+ module QuizApiClient::Services
2
+ class ContentExportsService < BaseApiService
3
+ def create(params:, token: nil)
4
+ post_to_quiz_api(params: params, token: token)
5
+ end
6
+
7
+ private
8
+
9
+ def post_to_quiz_api(params:, token:)
10
+ client(token: token).post(
11
+ '/api/content_exports',
12
+ content_export: params
13
+ )
14
+ end
15
+ end
16
+ end
@@ -1,3 +1,3 @@
1
1
  module QuizApiClient
2
- VERSION = '4.7.0'.freeze
2
+ VERSION = '4.8.0'.freeze
3
3
  end
@@ -22,6 +22,10 @@ module QuizApiClient
22
22
  @_config ||= QuizApiClient::Config.new
23
23
  end
24
24
 
25
+ def content_exports_service
26
+ @_content_exports_service ||= Services::ContentExportsService.new(config)
27
+ end
28
+
25
29
  def courses_service
26
30
  @_courses_service ||= Services::CoursesService.new(config)
27
31
  end
@@ -118,6 +122,7 @@ require 'quiz_api_client/http_request/metrics'
118
122
  require 'quiz_api_client/services/jwt_service'
119
123
  require 'quiz_api_client/services/base_api_service'
120
124
 
125
+ require 'quiz_api_client/services/content_exports_service'
121
126
  require 'quiz_api_client/services/courses_service'
122
127
  require 'quiz_api_client/services/interaction_types_service'
123
128
  require 'quiz_api_client/services/item_analyses_service'
@@ -51,6 +51,13 @@ describe QuizApiClient do
51
51
  end
52
52
  end
53
53
 
54
+ describe '#content_exports_service' do
55
+ it 'creates the service' do
56
+ expect(QuizApiClient::Services::ContentExportsService).to receive(:new).with(subject.config)
57
+ subject.content_exports_service
58
+ end
59
+ end
60
+
54
61
  describe '#courses_service' do
55
62
  it 'creates the service' do
56
63
  expect(QuizApiClient::Services::CoursesService).to receive(:new).with(subject.config)
@@ -0,0 +1,50 @@
1
+ describe QuizApiClient::Services::ContentExportsService do
2
+ let(:host) { 'api.host' }
3
+ let(:config) { QuizApiClient::Config.new { |c| c.host = host } }
4
+ let(:subject) { described_class.new(config) }
5
+
6
+ describe '#create' do
7
+ let(:params) do
8
+ {
9
+ canvas_content_export_id: 1234,
10
+ export_settings: {
11
+ quizzes: [10, 11],
12
+ everything: false,
13
+ content_export_type: 'qti'
14
+ }
15
+ }
16
+ end
17
+
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
+ let(:expected_url) { "https://#{host}/api/content_exports" }
33
+
34
+ before do
35
+ stub_request(:post, expected_url)
36
+ .with(body: { content_export: params }.to_json)
37
+ .to_return(
38
+ status: 201,
39
+ body: response.to_json,
40
+ headers: { 'Content-Type' => 'application/json' }
41
+ )
42
+ end
43
+
44
+ it 'posts to the correct endpoint and returns the response' do
45
+ expect(
46
+ subject.create(params: params, token: 'token').parsed_response
47
+ ).to eq(response)
48
+ end
49
+ end
50
+ 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.7.0
4
+ version: 4.8.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: 2023-02-14 00:00:00.000000000 Z
18
+ date: 2023-02-24 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: httparty
@@ -180,6 +180,7 @@ files:
180
180
  - lib/quiz_api_client/http_request/metrics.rb
181
181
  - lib/quiz_api_client/json_formatter.rb
182
182
  - lib/quiz_api_client/services/base_api_service.rb
183
+ - lib/quiz_api_client/services/content_exports_service.rb
183
184
  - lib/quiz_api_client/services/courses_service.rb
184
185
  - lib/quiz_api_client/services/interaction_types_service.rb
185
186
  - lib/quiz_api_client/services/item_analyses_service.rb
@@ -209,6 +210,7 @@ files:
209
210
  - spec/quiz_api_client/http_request/metrics_spec.rb
210
211
  - spec/quiz_api_client_spec.rb
211
212
  - spec/services/base_api_service_spec.rb
213
+ - spec/services/content_exports_service_spec.rb
212
214
  - spec/services/courses_service_spec.rb
213
215
  - spec/services/interaction_types_service_spec.rb
214
216
  - spec/services/item_analyses_service_spec.rb
@@ -260,6 +262,7 @@ test_files:
260
262
  - spec/quiz_api_client/http_request/metrics_spec.rb
261
263
  - spec/quiz_api_client_spec.rb
262
264
  - spec/services/base_api_service_spec.rb
265
+ - spec/services/content_exports_service_spec.rb
263
266
  - spec/services/courses_service_spec.rb
264
267
  - spec/services/interaction_types_service_spec.rb
265
268
  - spec/services/item_analyses_service_spec.rb