bearcat 1.4.1 → 1.4.2

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
  SHA1:
3
- metadata.gz: d8335b97d52b689f88d596562c799a0c1d32778f
4
- data.tar.gz: bbb2808ce56037e354db83b95614b29752866346
3
+ metadata.gz: 8d7986f7cb9c9c46c9bf669ec4bad9e8eb4d7f33
4
+ data.tar.gz: cc54f03e7e146f71f24d0d80c2342ffa6e662ca2
5
5
  SHA512:
6
- metadata.gz: ed0de64c2074723079d62d7783e031694745a19e6511c97fb4d0c22bf7aa3e977750afe33f6c79be2366e6d19a52462d893eee54a808eeca54174c4bbc164381
7
- data.tar.gz: 68a0eb298163f1d93dbc6c486e3796f3d3ba5aea0a88dc9c590d351e2a265383ad30477fa2e474109df8a85c8fe4c929e3d4a3fc619aba8d560e2b69f3f3b0c8
6
+ metadata.gz: 44cacec26e61027f954ddeb3700a85a4241cf32738a12e628878a94bc9cf952f93a3f71b5f530cbc9ec38a62de9f8bcc8e13a12b667396ebe27e986709994f20
7
+ data.tar.gz: a93d140338dbca79e0e9af138c306d580044f3f62a9639ec8bfe2eb7a0605446e8a3c5b21be62a268066dedcb7a6f71e98a289202a34f077b13fb4c6a80aeed0
@@ -40,6 +40,7 @@ module Bearcat
40
40
  require 'bearcat/client/content_exports'
41
41
  require 'bearcat/client/custom_gradebook_columns'
42
42
  require 'bearcat/client/external_tools'
43
+ require 'bearcat/client/roles'
43
44
  require 'bearcat/client/rubric'
44
45
  require 'bearcat/client/rubric_assessment'
45
46
  require 'bearcat/client/rubric_association'
@@ -79,6 +80,7 @@ module Bearcat
79
80
  include ContentExports
80
81
  include CustomGradebookColumns
81
82
  include ExternalTools
83
+ include Roles
82
84
  include Rubric
83
85
  include RubricAssessment
84
86
  include RubricAssociation
@@ -0,0 +1,15 @@
1
+ module Bearcat
2
+ class Client < Footrest::Client
3
+ module Roles
4
+
5
+ def roles(account_id='self', params={})
6
+ get("/api/v1/accounts/#{account_id}/roles", params)
7
+ end
8
+
9
+ def role(role_id, account_id='self', params={})
10
+ get("/api/v1/accounts/#{account_id}/roles/#{role_id}", params)
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Bearcat
2
- VERSION = '1.4.1' unless defined?(Bearcat::VERSION)
2
+ VERSION = '1.4.2' unless defined?(Bearcat::VERSION)
3
3
  end
@@ -0,0 +1,24 @@
1
+ require 'helper'
2
+
3
+ describe Bearcat::Client::Roles do
4
+ before do
5
+ @client = Bearcat::Client.new(prefix: "http://canvas.instructure.com", token: "test_token")
6
+ end
7
+
8
+ it "returns all roles" do
9
+ stub_get(@client, "/api/v1/accounts/self/roles").to_return(json_response("account_roles.json"))
10
+ roles = @client.roles
11
+ roles.count.should == 1
12
+ roles.first["label"].should == 'Account Admin'
13
+ roles.first["id"].should == 1
14
+ roles.first["base_role_type"].should == 'AccountMembership'
15
+ end
16
+
17
+ it "returns an individual role" do
18
+ stub_get(@client, "/api/v1/accounts/self/roles/1").to_return(json_response("account_role.json"))
19
+ role = @client.role(1)
20
+ role["label"].should == 'Account Admin'
21
+ role["id"].should == 1
22
+ role["base_role_type"].should == 'AccountMembership'
23
+ end
24
+ end
@@ -0,0 +1,34 @@
1
+ {
2
+ "id": 1,
3
+ "role": "AccountAdmin",
4
+ "label": "Account Admin",
5
+ "base_role_type": "AccountMembership",
6
+ "workflow_state": "built_in",
7
+ "permissions": {
8
+ "read_forum": {
9
+ "enabled": true,
10
+ "locked": false,
11
+ "readonly": false,
12
+ "explicit": false
13
+ },
14
+ "post_to_forum": {
15
+ "enabled": true,
16
+ "locked": false,
17
+ "readonly": false,
18
+ "explicit": false
19
+ },
20
+ "moderate_forum": {
21
+ "enabled": true,
22
+ "locked": false,
23
+ "readonly": false,
24
+ "explicit": false
25
+ },
26
+ "manage_catalog": {
27
+ "enabled": true,
28
+ "locked": false,
29
+ "readonly": false,
30
+ "explicit": false
31
+ }
32
+ }
33
+ }
34
+
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.4.1
4
+ version: 1.4.2
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: 2020-04-15 00:00:00.000000000 Z
11
+ date: 2020-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -166,6 +166,7 @@ files:
166
166
  - lib/bearcat/client/pages.rb
167
167
  - lib/bearcat/client/quizzes.rb
168
168
  - lib/bearcat/client/reports.rb
169
+ - lib/bearcat/client/roles.rb
169
170
  - lib/bearcat/client/rubric.rb
170
171
  - lib/bearcat/client/rubric_assessment.rb
171
172
  - lib/bearcat/client/rubric_association.rb
@@ -206,6 +207,7 @@ files:
206
207
  - spec/bearcat/client/pages_spec.rb
207
208
  - spec/bearcat/client/quizzes_spec.rb
208
209
  - spec/bearcat/client/reports_spec.rb
210
+ - spec/bearcat/client/roles_spec.rb
209
211
  - spec/bearcat/client/rubric_assessment_spec.rb
210
212
  - spec/bearcat/client/rubric_association_spec.rb
211
213
  - spec/bearcat/client/rubric_spec.rb
@@ -227,6 +229,7 @@ files:
227
229
  - spec/fixtures/account_reports_index.json
228
230
  - spec/fixtures/account_reports_result_success.json
229
231
  - spec/fixtures/account_reports_start_result.json
232
+ - spec/fixtures/account_role.json
230
233
  - spec/fixtures/account_roles.json
231
234
  - spec/fixtures/account_sis_imports.json
232
235
  - spec/fixtures/account_sub_accounts.json
@@ -378,7 +381,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
378
381
  version: '0'
379
382
  requirements: []
380
383
  rubyforge_project:
381
- rubygems_version: 2.6.11
384
+ rubygems_version: 2.6.14.1
382
385
  signing_key:
383
386
  specification_version: 4
384
387
  summary: Canvas API
@@ -402,6 +405,7 @@ test_files:
402
405
  - spec/bearcat/client/modules_spec.rb
403
406
  - spec/bearcat/client/discussions_spec.rb
404
407
  - spec/bearcat/client/files_spec.rb
408
+ - spec/bearcat/client/roles_spec.rb
405
409
  - spec/bearcat/client/graph_ql_spec.rb
406
410
  - spec/bearcat/client/group_categories_spec.rb
407
411
  - spec/bearcat/client/rubric_assessment_spec.rb
@@ -493,6 +497,7 @@ test_files:
493
497
  - spec/fixtures/start_report.json
494
498
  - spec/fixtures/custom_data.json
495
499
  - spec/fixtures/rubric.json
500
+ - spec/fixtures/account_role.json
496
501
  - spec/fixtures/update_outcome_group.json
497
502
  - spec/fixtures/module_item.json
498
503
  - spec/fixtures/report_status.json