bearcat 1.3.30 → 1.3.32

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
  SHA1:
3
- metadata.gz: 5c8d7f5a1481dd58f3e09d2f0be117afb259ab7a
4
- data.tar.gz: f1ee6a16c5616fe354a5f0ec7654166531d64663
3
+ metadata.gz: 705d3efa90423cf35311ad8c77ce438ff4d88ea5
4
+ data.tar.gz: 42521f3b5cd101176d9aa54e0b49161fc977d871
5
5
  SHA512:
6
- metadata.gz: 1c5567c4f30375c5ab1db0a9f1f36d48e81beffcf28caccfb267344ee2ccd0376fe4643dc0341cf7b9d46f1e8ef005b92c88961b614139321194e102d68d5eef
7
- data.tar.gz: 02abd72f687e7ac98b4b3fd1c6e8544fdbd16a0aec704cfa0816e185c3902bc5b8e733153bbc95971d4f64d800c178926ff88e5631cae52df578c4a80045de02
6
+ metadata.gz: a960b009043806c01594652c5d02ef073bc48e7a6b5060ac8cff768805ca05241bafe94351374e501357825d9a599c109db01aa4114503b83b164194881fc471
7
+ data.tar.gz: 5eefd2baa6bdbac5dfc3b887266c2d667249a37e3e66ee200bca7bcef96018eeff442bf701351460eeab5f5017f90a21a7709712ae95e35b14910134bf6d0e3a
@@ -38,6 +38,9 @@ module Bearcat
38
38
  require 'bearcat/client/content_exports'
39
39
  require 'bearcat/client/custom_gradebook_columns'
40
40
  require 'bearcat/client/external_tools'
41
+ require 'bearcat/client/rubric'
42
+ require 'bearcat/client/rubric_assessment'
43
+ require 'bearcat/client/rubric_association'
41
44
 
42
45
  include Assignments
43
46
  include Accounts
@@ -72,6 +75,9 @@ module Bearcat
72
75
  include ContentExports
73
76
  include CustomGradebookColumns
74
77
  include ExternalTools
78
+ include Rubric
79
+ include RubricAssessment
80
+ include RubricAssociation
75
81
 
76
82
  # Override Footrest request for ApiArray support
77
83
  def request(method, &block)
@@ -14,6 +14,14 @@ module Bearcat
14
14
  post("/api/v1/courses/#{course}/assignment_groups", params)
15
15
  end
16
16
 
17
+ def update_assignment_group(course, assignment_group_id, params={})
18
+ put("/api/v1/courses/#{course}/assignment_groups/#{assignment_group_id}", params)
19
+ end
20
+
21
+ def delete_assignment_group(course, assignment_group_id, params={})
22
+ delete("/api/v1/courses/#{course}/assignment_groups/#{assignment_group_id}")
23
+ end
24
+
17
25
  end
18
26
  end
19
27
  end
@@ -0,0 +1,23 @@
1
+ module Bearcat
2
+ class Client < Footrest::Client
3
+ module Rubric
4
+
5
+ def course_rubric(course, rubric)
6
+ get("api/v1/courses/#{course}/rubrics/#{rubric}")
7
+ end
8
+
9
+ def create_course_rubric(course, params={})
10
+ post("api/v1/courses/#{course}/rubrics/", params)
11
+ end
12
+
13
+ def update_course_rubric(course, rubric, params={})
14
+ put("api/v1/courses/#{course}/rubrics/#{rubric}", params)
15
+ end
16
+
17
+ def delete_course_rubric(course, rubric)
18
+ delete("api/v1/courses/#{course}/rubrics/#{rubric}")
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,19 @@
1
+ module Bearcat
2
+ class Client < Footrest::Client
3
+ module RubricAssessment
4
+
5
+ def create_course_rubric_assessment(course, rubric_association, params={})
6
+ post("api/v1/courses/#{course}/rubric_associations/#{rubric_association}/rubric_assessments", params)
7
+ end
8
+
9
+ def update_course_rubric_assessment(course, rubric_association, rubric_assessment, params={})
10
+ put("api/v1/courses/#{course}/rubric_associations/#{rubric_association}/rubric_assessments/#{rubric_assessment}", params)
11
+ end
12
+
13
+ def delete_course_rubric_assessment(course, rubric_association, rubric_assessment)
14
+ delete("api/v1/courses/#{course}/rubric_associations/#{rubric_association}/rubric_assessments/#{rubric_assessment}")
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Bearcat
2
+ class Client < Footrest::Client
3
+ module RubricAssociation
4
+
5
+ def create_course_rubric_association(course, params={})
6
+ post("api/v1/courses/#{course}/rubric_associations/", params)
7
+ end
8
+
9
+ def update_course_rubric_association(course, rubric_association, params={})
10
+ put("api/v1/courses/#{course}/rubric_associations/#{rubric_association}", params)
11
+ end
12
+
13
+ def delete_course_rubric_association(course, rubric_association)
14
+ delete("api/v1/courses/#{course}/rubric_associations/#{rubric_association}")
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module Bearcat
2
- VERSION = '1.3.30' unless defined?(Bearcat::VERSION)
2
+ VERSION = '1.3.32' unless defined?(Bearcat::VERSION)
3
3
  end
@@ -29,4 +29,19 @@ describe Bearcat::Client::AssignmentGroups do
29
29
  expect(new_assignment_group['name']).to eq('Quizzes')
30
30
  end
31
31
 
32
+ it 'updates an assignment_group' do
33
+ params = {'name' => 'Quizzes'}
34
+ stub_put(@client, "/api/v1/courses/2/assignment_groups/1").with(body: params)
35
+ .to_return(json_response("assignment_group.json"))
36
+ updated_assignment_group = @client.update_assignment_group(2, 1, params)
37
+ expect(updated_assignment_group['name']).to eq('Quizzes')
38
+ end
39
+
40
+ it 'deletes an assignment_group' do
41
+ params = {'id' => '1'}
42
+ stub_delete(@client, "/api/v1/courses/2/assignment_groups/2").to_return(json_response("assignment_group.json"))
43
+ deleted_assignment_group = @client.delete_assignment_group(2, 2)
44
+ deleted_assignment_group["id"].should == 2
45
+ end
46
+
32
47
  end
@@ -0,0 +1,47 @@
1
+ require 'helper'
2
+
3
+ describe Bearcat::Client::RubricAssessment do
4
+ before do
5
+ @client = Bearcat::Client.new(prefix:"http://canvas.instructure.com", token: "test_token")
6
+ end
7
+
8
+ it "creates a rubric assessment" do
9
+ stub_post(@client, "/api/v1/courses/72/rubric_associations/4/rubric_assessments")
10
+ .with(:body => {
11
+ "rubric_assessment"=>{
12
+ "user_id"=>"22",
13
+ "assessor_id"=>"1"
14
+ }
15
+ }).to_return(json_response("rubric_assessment.json"))
16
+ rubric = @client.create_course_rubric_assessment(72, 4,
17
+ {"rubric_assessment[user_id]" => "22", "rubric_assessment[assessor_id]" => "1"})
18
+ rubric['id'].should == 5
19
+ rubric['assessor_id'].should == 1
20
+ rubric['user_id'].should == 22
21
+ end
22
+
23
+ it "updates a rubric assessment" do
24
+ stub_put(@client, "/api/v1/courses/72/rubric_associations/4/rubric_assessments/5")
25
+ .with(:body => {
26
+ "rubric_assessment"=>{
27
+ "user_id"=>"22",
28
+ "assessor_id"=>"1"
29
+ }
30
+ }).to_return(json_response("rubric_assessment.json"))
31
+ rubric = @client.update_course_rubric_assessment(72, 4, 5,
32
+ {"rubric_assessment[user_id]" => "22", "rubric_assessment[assessor_id]" => "1"})
33
+ rubric['id'].should == 5
34
+ rubric['assessor_id'].should == 1
35
+ rubric['user_id'].should == 22
36
+ end
37
+
38
+ it "deletes a rubric assessment" do
39
+ stub_delete(@client, "/api/v1/courses/72/rubric_associations/4/rubric_assessments/5")
40
+ .to_return(json_response("rubric_assessment.json"))
41
+ rubric_assessment = @client.delete_course_rubric_assessment(72, 4, 5)
42
+ rubric_assessment['id'].should == 5
43
+ rubric_assessment['assessor_id'].should == 1
44
+ rubric_assessment['user_id'].should == 22
45
+ end
46
+
47
+ end
@@ -0,0 +1,39 @@
1
+ require 'helper'
2
+
3
+ describe Bearcat::Client::RubricAssessment do
4
+ before do
5
+ @client = Bearcat::Client.new(prefix:"http://canvas.instructure.com", token: "test_token")
6
+ end
7
+
8
+ it "creates a rubric association" do
9
+ stub_post(@client, "/api/v1/courses/72/rubric_associations")
10
+ .with(:body => {"rubric_id" => "1", "score" => "5"})
11
+ .to_return(json_response("rubric_association.json"))
12
+ rubric_association = @client.create_course_rubric_association(72,
13
+ {"rubric_id" => "1", "score" => "5"})
14
+ rubric_association['id'].should == 1
15
+ rubric_association['rubric_id'].should == 1
16
+ rubric_association['score'].should == 5
17
+ end
18
+
19
+ it "updates a rubric association" do
20
+ stub_put(@client, "/api/v1/courses/72/rubric_associations/4")
21
+ .with(:body => {"rubric_id" => "1", "score" => "5"})
22
+ .to_return(json_response("rubric_association.json"))
23
+ rubric_association = @client.update_course_rubric_association(72, 4,
24
+ {"rubric_id" => "1", "score" => "5"})
25
+ rubric_association['id'].should == 1
26
+ rubric_association['rubric_id'].should == 1
27
+ rubric_association['score'].should == 5
28
+ end
29
+
30
+ it "deletes a rubric association" do
31
+ stub_delete(@client, "/api/v1/courses/72/rubric_associations/4")
32
+ .to_return(json_response("rubric_association.json"))
33
+ rubric_association = @client.delete_course_rubric_association(72, 4)
34
+ rubric_association['id'].should == 1
35
+ rubric_association['rubric_id'].should == 1
36
+ rubric_association['score'].should == 5
37
+ end
38
+
39
+ end
@@ -0,0 +1,45 @@
1
+ require 'helper'
2
+
3
+ describe Bearcat::Client::Rubric do
4
+ before do
5
+ @client = Bearcat::Client.new(prefix:"http://canvas.instructure.com", token: "test_token")
6
+ end
7
+
8
+ it "returns a rubric for a course" do
9
+ stub_get(@client, "/api/v1/courses/72/rubrics/1").to_return(json_response("rubric.json"))
10
+ rubric = @client.course_rubric(72, 1)
11
+ rubric['id'].should == 1
12
+ rubric['title'].should == 'Rubric title'
13
+ rubric['context_type'].should == 'Course'
14
+ rubric['points_possible'].should == 10
15
+ end
16
+
17
+ it "creates a rubric" do
18
+ stub_post(@client, "/api/v1/courses/72/rubrics").
19
+ with(:body => {"rubric_assessment"=>{"user_id"=>"22"}}).to_return(json_response("rubric.json"))
20
+ rubric = @client.create_course_rubric(72, {"rubric_assessment[user_id]" => "22"})
21
+ rubric['id'].should == 1
22
+ rubric['title'].should == 'Rubric title'
23
+ rubric['context_type'].should == 'Course'
24
+ rubric['points_possible'].should == 10
25
+ end
26
+
27
+ it "updates a rubric" do
28
+ stub_put(@client, "/api/v1/courses/72/rubrics/1")
29
+ .with(:body => {"rubric_assessment"=>{"user_id"=>"22"}}).to_return(json_response("rubric.json"))
30
+ rubric = @client.update_course_rubric(72, 1, {"rubric_assessment[user_id]" => "22"})
31
+ rubric['id'].should == 1
32
+ rubric['title'].should == 'Rubric title'
33
+ rubric['context_type'].should == 'Course'
34
+ rubric['points_possible'].should == 10
35
+ end
36
+
37
+ it "deletes a rubric" do
38
+ stub_delete(@client, "/api/v1/courses/72/rubrics/1").to_return(json_response("rubric.json"))
39
+ rubric = @client.delete_course_rubric(72, 1)
40
+ rubric['title'].should == 'Rubric title'
41
+ rubric['context_type'].should == 'Course'
42
+ rubric['points_possible'].should == 10
43
+ end
44
+
45
+ end
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": 1,
3
+ "title": "Rubric title",
4
+ "context_id": 1,
5
+ "context_type": "Course",
6
+ "points_possible": 10.0,
7
+ "reusable": false,
8
+ "read_only": true,
9
+ "free_form_criterion_comments": true,
10
+ "hide_score_total": true,
11
+ "assessments": null,
12
+ "associations": null
13
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "rubric_association_id": 4,
3
+ "id": 5,
4
+ "assessor_id": 1,
5
+ "score": 0,
6
+ "data": [
7
+ {
8
+ "id": "blank_2",
9
+ "points": 0,
10
+ "criterion_id": "_7226",
11
+ "learning_outcome_id": null,
12
+ "description": "No Marks",
13
+ "comments_enabled": true,
14
+ "comments": ""
15
+ }
16
+ ],
17
+ "hide_points": false,
18
+ "artifact_type": "Submission",
19
+ "assessment_type": "grading",
20
+ "rubric_id": 4,
21
+ "artifact_id": 10,
22
+ "user_id": 22,
23
+ "comments": null,
24
+ "created_at": "2019-02-07T19:44:03Z",
25
+ "updated_at": "2019-02-07T19:52:11Z",
26
+ "artifact_attempt": 1,
27
+ "ratings": [],
28
+ "assessor_name": "dsolano@instructure.com",
29
+ "related_group_submissions_and_assessments": [],
30
+ "artifact": {},
31
+ "rubric_association": {}
32
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "id": 1,
3
+ "rubric_id": 1,
4
+ "rubric_association_id": 2,
5
+ "score": 5.0,
6
+ "artifact_type": "Submission",
7
+ "artifact_id": 3,
8
+ "artifact_attempt": 2,
9
+ "assessment_type": "grading",
10
+ "assessor_id": 6,
11
+ "data": null,
12
+ "comments": null
13
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bearcat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.30
4
+ version: 1.3.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Mills, Jake Sorce
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-14 00:00:00.000000000 Z
11
+ date: 2019-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -178,6 +178,9 @@ files:
178
178
  - lib/bearcat/client/pages.rb
179
179
  - lib/bearcat/client/quizzes.rb
180
180
  - lib/bearcat/client/reports.rb
181
+ - lib/bearcat/client/rubric.rb
182
+ - lib/bearcat/client/rubric_assessment.rb
183
+ - lib/bearcat/client/rubric_association.rb
181
184
  - lib/bearcat/client/search.rb
182
185
  - lib/bearcat/client/sections.rb
183
186
  - lib/bearcat/client/submissions.rb
@@ -212,6 +215,9 @@ files:
212
215
  - spec/bearcat/client/pages_spec.rb
213
216
  - spec/bearcat/client/quizzes_spec.rb
214
217
  - spec/bearcat/client/reports_spec.rb
218
+ - spec/bearcat/client/rubric_assessment_spec.rb
219
+ - spec/bearcat/client/rubric_association_spec.rb
220
+ - spec/bearcat/client/rubric_spec.rb
215
221
  - spec/bearcat/client/search_spec.rb
216
222
  - spec/bearcat/client/sections_spec.rb
217
223
  - spec/bearcat/client/submissions_spec.rb
@@ -334,6 +340,9 @@ files:
334
340
  - spec/fixtures/report_history.json
335
341
  - spec/fixtures/report_list.json
336
342
  - spec/fixtures/report_status.json
343
+ - spec/fixtures/rubric.json
344
+ - spec/fixtures/rubric_assessment.json
345
+ - spec/fixtures/rubric_association.json
337
346
  - spec/fixtures/search_find_recipients.json
338
347
  - spec/fixtures/section.json
339
348
  - spec/fixtures/section_enrollments.json
@@ -370,7 +379,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
370
379
  version: '0'
371
380
  requirements: []
372
381
  rubyforge_project:
373
- rubygems_version: 2.4.5.1
382
+ rubygems_version: 2.6.12
374
383
  signing_key:
375
384
  specification_version: 4
376
385
  summary: Canvas API
@@ -386,6 +395,7 @@ test_files:
386
395
  - spec/bearcat/client/outcome_groups_spec.rb
387
396
  - spec/bearcat/client/assignment_groups_spec.rb
388
397
  - spec/bearcat/client/assignments_spec.rb
398
+ - spec/bearcat/client/rubric_association_spec.rb
389
399
  - spec/bearcat/client/o_auth2_spec.rb
390
400
  - spec/bearcat/client/search_spec.rb
391
401
  - spec/bearcat/client/calendar_events_spec.rb
@@ -394,6 +404,7 @@ test_files:
394
404
  - spec/bearcat/client/discussions_spec.rb
395
405
  - spec/bearcat/client/files_spec.rb
396
406
  - spec/bearcat/client/group_categories_spec.rb
407
+ - spec/bearcat/client/rubric_assessment_spec.rb
397
408
  - spec/bearcat/client/submissions_spec.rb
398
409
  - spec/bearcat/client/module_items_spec.rb
399
410
  - spec/bearcat/client/content_migrations_spec.rb
@@ -402,6 +413,7 @@ test_files:
402
413
  - spec/bearcat/client/analytics_spec.rb
403
414
  - spec/bearcat/client/content_exports_spec.rb
404
415
  - spec/bearcat/client/external_tools_spec.rb
416
+ - spec/bearcat/client/rubric_spec.rb
405
417
  - spec/bearcat/client/accounts_spec.rb
406
418
  - spec/bearcat/client/outcomes_spec.rb
407
419
  - spec/bearcat/client/courses_spec.rb
@@ -435,6 +447,7 @@ test_files:
435
447
  - spec/fixtures/no_custom_data.json
436
448
  - spec/fixtures/communication_channels.json
437
449
  - spec/fixtures/edited_group_category.json
450
+ - spec/fixtures/rubric_assessment.json
438
451
  - spec/fixtures/paged_body.json
439
452
  - spec/fixtures/canvas_files/upload_success.json
440
453
  - spec/fixtures/canvas_files/declare_file.json
@@ -458,6 +471,7 @@ test_files:
458
471
  - spec/fixtures/assignment.json
459
472
  - spec/fixtures/calendar_event.json
460
473
  - spec/fixtures/course.json
474
+ - spec/fixtures/rubric_association.json
461
475
  - spec/fixtures/external_tools.json
462
476
  - spec/fixtures/conversation.json
463
477
  - spec/fixtures/external_tool.json
@@ -475,6 +489,7 @@ test_files:
475
489
  - spec/fixtures/conclude_enrollment.json
476
490
  - spec/fixtures/start_report.json
477
491
  - spec/fixtures/custom_data.json
492
+ - spec/fixtures/rubric.json
478
493
  - spec/fixtures/update_outcome_group.json
479
494
  - spec/fixtures/module_item.json
480
495
  - spec/fixtures/report_status.json