bearcat 1.3.8 → 1.3.9

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: 18e8a9967ca55563f34d7e643f9e53dcf8082fec
4
- data.tar.gz: 9bd770609f95f745ba639caab6a72e32f419e6c6
3
+ metadata.gz: 329077f76e530259167ccd2b4d0fe2712e7cc367
4
+ data.tar.gz: 01a84fa97a856e67420b7588cc1f18e85668f073
5
5
  SHA512:
6
- metadata.gz: 2ef3aeed1f5bb6094fbf3f4fec911d7207d8d1f5a2c9a0ccdd16ebb1e762b61bfbe556c1fb0aed9231e23568bc79c626c8f2b26f23ae43364813c71c064209d1
7
- data.tar.gz: 6b1645ccc91fd47090aab33ecf2064e1d703db6c749806fec8e24e0717848dae13ce3db76abe6308e4332f1061faf49e448bba570fc13ad46a6421d2502b6c30
6
+ metadata.gz: b55a03261cffc6e0f8edb26ffec7d8f9259736bbf0aedb55087af39f58dc61dcfd088f1d1286fb7f436d5c5f91db19bd6ca3cd7a82fcb39c72d907ecfc0c6221
7
+ data.tar.gz: 4cb164a1adf92c9485ee7eea057cb770e510b9c762993d5451281bd68f39e03991aa7379b8f7942701ac638ff492b5883cba03c49564295f6c55fb23d5244ff7
@@ -33,6 +33,7 @@ module Bearcat
33
33
  require 'bearcat/client/module_items'
34
34
  require 'bearcat/client/content_migrations'
35
35
  require 'bearcat/client/content_exports'
36
+ require 'bearcat/client/custom_gradebook_columns'
36
37
 
37
38
  include Assignments
38
39
  include Accounts
@@ -65,6 +66,7 @@ module Bearcat
65
66
  include ModuleItems
66
67
  include ContentMigrations
67
68
  include ContentExports
69
+ include CustomGradebookColumns
68
70
 
69
71
 
70
72
  # Override Footrest request for ApiArray support
@@ -0,0 +1,31 @@
1
+ module Bearcat
2
+ class Client < Footrest::Client
3
+ module CustomGradebookColumns
4
+
5
+ def custom_gradebook_columns(course, params={})
6
+ get("/api/v1/courses/#{course.to_s}/custom_gradebook_columns", params)
7
+ end
8
+
9
+ def create_gradebook_columns(course, params={})
10
+ post("/api/v1/courses/#{course.to_s}/custom_gradebook_columns", params)
11
+ end
12
+
13
+ def update_gradebook_columns(course, gradebook_column, params={})
14
+ put("/api/v1/courses/#{course.to_s}/custom_gradebook_columns/#{gradebook_column}", params)
15
+ end
16
+
17
+ def delete_gradebook_columns(course, gradebook_column, params={})
18
+ delete("/api/v1/courses/#{course.to_s}/custom_gradebook_columns/#{gradebook_column}", params)
19
+ end
20
+
21
+ def gradebook_columns_data(course, gradebook_column, params={})
22
+ get("/api/v1/courses/#{course.to_s}/custom_gradebook_columns/#{gradebook_column}/data", params)
23
+ end
24
+
25
+ def update_gradebook_columns_data(course, gradebook_column, student, params={})
26
+ put("/api/v1/courses/#{course.to_s}/custom_gradebook_columns/#{gradebook_column}/data/#{student}", params)
27
+ end
28
+
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,3 @@
1
1
  module Bearcat
2
- VERSION = '1.3.8' unless defined?(Bearcat::VERSION)
2
+ VERSION = '1.3.9' unless defined?(Bearcat::VERSION)
3
3
  end
@@ -0,0 +1,47 @@
1
+ require 'helper'
2
+
3
+ describe Bearcat::Client::CustomGradebookColumns do
4
+ before do
5
+ @client = Bearcat::Client.new(prefix:"http://canvas.instructure.com", token: "test_token")
6
+ end
7
+
8
+ context 'custom_gradebook_columns' do
9
+ it "lists custom gradebook columns" do
10
+ stub_get(@client, '/api/v1/courses/1/custom_gradebook_columns').to_return(json_response('custom_gradebook_columns', 'custom_gradebook_columns.json'))
11
+ response = @client.custom_gradebook_columns(1)
12
+ response.first['id'].should == 1
13
+ response.last['id'].should == 2
14
+ end
15
+
16
+ it "creates custom gradebook column" do
17
+ params = {"title": "Third", "position": 3, "hidden": false}
18
+ stub_post(@client, '/api/v1/courses/1/custom_gradebook_columns').to_return(json_response('custom_gradebook_columns', 'custom_gradebook_column.json'))
19
+ response = @client.create_gradebook_columns(1, params)
20
+ expect(response['id']).to eq 3
21
+ expect(response['title']).to eq 'Third'
22
+ end
23
+
24
+ it "deletes custom gradebook column" do
25
+ stub_delete(@client, '/api/v1/courses/1/custom_gradebook_columns/3').to_return(json_response('custom_gradebook_columns', 'custom_gradebook_column.json'))
26
+ response = @client.delete_gradebook_columns(1, 3)
27
+ expect(response['id']).to eq 3
28
+ expect(response['title']).to eq 'Third'
29
+ end
30
+ end
31
+ context 'custom_gradebook_column_data' do
32
+ it "lists data for custom gradebook column" do
33
+ stub_get(@client, '/api/v1/courses/1/custom_gradebook_columns/1/data').to_return(json_response('custom_gradebook_columns', 'column_data.json'))
34
+ response = @client.gradebook_columns_data(1, 1)
35
+ response['content'].should == 'Nut allergy'
36
+ response['user_id'].should == 1
37
+ end
38
+
39
+ it "lists data for custom gradebook column" do
40
+ params = {"content": "Nut allergy", "user_id": 1}
41
+ stub_put(@client, '/api/v1/courses/1/custom_gradebook_columns/1/data/1').to_return(json_response('custom_gradebook_columns', 'column_data.json'))
42
+ response = @client.update_gradebook_columns_data(1, 1, 1, params)
43
+ response['content'].should == 'Nut allergy'
44
+ response['user_id'].should == 1
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,4 @@
1
+ {
2
+ "content": "Nut allergy",
3
+ "user_id": 1
4
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "id": 3,
3
+ "title": "Third",
4
+ "position": 3,
5
+ "teacher_notes": false,
6
+ "hidden": false
7
+ }
@@ -0,0 +1,16 @@
1
+ [
2
+ {
3
+ "id": 1,
4
+ "title": "First",
5
+ "position": 1,
6
+ "teacher_notes": false,
7
+ "hidden": false
8
+ },
9
+ {
10
+ "id": 2,
11
+ "title": "Second",
12
+ "position": 2,
13
+ "teacher_notes": false,
14
+ "hidden": false
15
+ }
16
+ ]
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.8
4
+ version: 1.3.9
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: 2017-02-06 00:00:00.000000000 Z
11
+ date: 2017-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -118,6 +118,7 @@ files:
118
118
  - lib/bearcat/client/content_migrations.rb
119
119
  - lib/bearcat/client/conversations.rb
120
120
  - lib/bearcat/client/courses.rb
121
+ - lib/bearcat/client/custom_gradebook_columns.rb
121
122
  - lib/bearcat/client/discussions.rb
122
123
  - lib/bearcat/client/enrollments.rb
123
124
  - lib/bearcat/client/file_helper.rb
@@ -150,6 +151,7 @@ files:
150
151
  - spec/bearcat/client/content_migrations_spec.rb
151
152
  - spec/bearcat/client/conversations_spec.rb
152
153
  - spec/bearcat/client/courses_spec.rb
154
+ - spec/bearcat/client/custom_gradebook_columns_spec.rb
153
155
  - spec/bearcat/client/discussions_spec.rb
154
156
  - spec/bearcat/client/enrollments_spec.rb
155
157
  - spec/bearcat/client/files_spec.rb
@@ -227,6 +229,9 @@ files:
227
229
  - spec/fixtures/created_group_membership.json
228
230
  - spec/fixtures/custom_data.json
229
231
  - spec/fixtures/custom_food_data.json
232
+ - spec/fixtures/custom_gradebook_columns/column_data.json
233
+ - spec/fixtures/custom_gradebook_columns/custom_gradebook_column.json
234
+ - spec/fixtures/custom_gradebook_columns/custom_gradebook_columns.json
230
235
  - spec/fixtures/delete_course.json
231
236
  - spec/fixtures/delete_custom_data_scope.json
232
237
  - spec/fixtures/delete_group_category.json
@@ -308,7 +313,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
308
313
  version: '0'
309
314
  requirements: []
310
315
  rubyforge_project:
311
- rubygems_version: 2.4.8
316
+ rubygems_version: 2.4.5
312
317
  signing_key:
313
318
  specification_version: 4
314
319
  summary: Canvas API
@@ -324,6 +329,7 @@ test_files:
324
329
  - spec/bearcat/client/content_migrations_spec.rb
325
330
  - spec/bearcat/client/conversations_spec.rb
326
331
  - spec/bearcat/client/courses_spec.rb
332
+ - spec/bearcat/client/custom_gradebook_columns_spec.rb
327
333
  - spec/bearcat/client/discussions_spec.rb
328
334
  - spec/bearcat/client/enrollments_spec.rb
329
335
  - spec/bearcat/client/files_spec.rb
@@ -401,6 +407,9 @@ test_files:
401
407
  - spec/fixtures/created_group_membership.json
402
408
  - spec/fixtures/custom_data.json
403
409
  - spec/fixtures/custom_food_data.json
410
+ - spec/fixtures/custom_gradebook_columns/column_data.json
411
+ - spec/fixtures/custom_gradebook_columns/custom_gradebook_column.json
412
+ - spec/fixtures/custom_gradebook_columns/custom_gradebook_columns.json
404
413
  - spec/fixtures/delete_course.json
405
414
  - spec/fixtures/delete_custom_data_scope.json
406
415
  - spec/fixtures/delete_group_category.json
@@ -463,3 +472,4 @@ test_files:
463
472
  - spec/fixtures/user_page_views.json
464
473
  - spec/fixtures/user_profile.json
465
474
  - spec/helper.rb
475
+ has_rdoc: