bearcat 1.3.24 → 1.3.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bearcat/client.rb +2 -0
- data/lib/bearcat/client/external_tools.rb +45 -0
- data/lib/bearcat/version.rb +1 -1
- data/spec/bearcat/client/external_tools_spec.rb +106 -0
- data/spec/fixtures/external_tool.json +55 -0
- data/spec/fixtures/external_tools.json +57 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e453d5b28b6a865d7c7e2767a52eb564087dee73
|
4
|
+
data.tar.gz: 1b426aa3e0362c42a66ec4320edf59ddb4bc5ab9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35643b83baec2ca929c840c15f9431f928d83bf6bbefa5002d7b60f1d2bde7dbacca6e9286a4d419fe2ef89f366e3b04e3022e49f2301411abc3d4e825543b8d
|
7
|
+
data.tar.gz: cdfbe163f6a2e2492177609a7badb7d8d82e490c08a67e1d82a409762324c7c37811e564ac6788fb2d9940b477e2a85c7b2f3457187fb1a76a1fd43d556cfb02
|
data/lib/bearcat/client.rb
CHANGED
@@ -34,6 +34,7 @@ module Bearcat
|
|
34
34
|
require 'bearcat/client/content_migrations'
|
35
35
|
require 'bearcat/client/content_exports'
|
36
36
|
require 'bearcat/client/custom_gradebook_columns'
|
37
|
+
require 'bearcat/client/external_tools'
|
37
38
|
|
38
39
|
include Assignments
|
39
40
|
include Accounts
|
@@ -67,6 +68,7 @@ module Bearcat
|
|
67
68
|
include ContentMigrations
|
68
69
|
include ContentExports
|
69
70
|
include CustomGradebookColumns
|
71
|
+
include ExternalTools
|
70
72
|
|
71
73
|
|
72
74
|
# Override Footrest request for ApiArray support
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Bearcat
|
2
|
+
class Client < Footrest::Client
|
3
|
+
module ExternalTools
|
4
|
+
def course_external_tools(course_id, params={})
|
5
|
+
get("/api/v1/courses/#{course_id}/external_tools", params)
|
6
|
+
end
|
7
|
+
|
8
|
+
def account_external_tools(account_id, params={})
|
9
|
+
get("/api/v1/accounts/#{account_id}/external_tools", params)
|
10
|
+
end
|
11
|
+
|
12
|
+
def course_external_tool(course_id, tool_id, params={})
|
13
|
+
get("/api/v1/courses/#{course_id}/external_tools/#{tool_id}", params)
|
14
|
+
end
|
15
|
+
|
16
|
+
def account_external_tool(account_id, tool_id, params={})
|
17
|
+
get("/api/v1/accounts/#{account_id}/external_tools/#{tool_id}", params)
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_course_external_tool(course_id, params={})
|
21
|
+
post("/api/v1/courses/#{course_id}/external_tools", params)
|
22
|
+
end
|
23
|
+
|
24
|
+
def create_account_external_tool(account_id, params={})
|
25
|
+
post("/api/v1/accounts/#{account_id}/external_tools", params)
|
26
|
+
end
|
27
|
+
|
28
|
+
def edit_course_external_tool(course_id, tool_id, params={})
|
29
|
+
put("/api/v1/courses/#{course_id}/external_tools/#{tool_id}", params)
|
30
|
+
end
|
31
|
+
|
32
|
+
def edit_account_external_tool(account_id, tool_id, params={})
|
33
|
+
put("/api/v1/accounts/#{account_id}/external_tools/#{tool_id}", params)
|
34
|
+
end
|
35
|
+
|
36
|
+
def delete_course_external_tool(course_id, tool_id, params={})
|
37
|
+
delete("/api/v1/courses/#{course_id}/external_tools/#{tool_id}", params)
|
38
|
+
end
|
39
|
+
|
40
|
+
def delete_account_external_tool(account_id, tool_id, params={})
|
41
|
+
delete("/api/v1/accounts/#{account_id}/external_tools/#{tool_id}", params)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/bearcat/version.rb
CHANGED
@@ -0,0 +1,106 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Bearcat::Client::ExternalTools do
|
4
|
+
before do
|
5
|
+
@client = Bearcat::Client.new(prefix: 'http://canvas.instructure.com', token: 'test_token')
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '.course_external_tools' do
|
9
|
+
it 'returns all external tools on a course' do
|
10
|
+
stub_get(@client, '/api/v1/courses/1/external_tools').to_return(json_response('external_tools.json'))
|
11
|
+
tools = @client.course_external_tools(1)
|
12
|
+
expect(tools.first['id']).to eq(1)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '.account_external_tools' do
|
17
|
+
it 'returns all external tools on an accounts' do
|
18
|
+
stub_get(@client, '/api/v1/accounts/1/external_tools').to_return(json_response('external_tools.json'))
|
19
|
+
tools = @client.account_external_tools(1)
|
20
|
+
expect(tools.first['id']).to eq(1)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'course_external_tool' do
|
25
|
+
it 'returns a course external tool' do
|
26
|
+
stub_get(@client, '/api/v1/courses/1/external_tools/1').to_return(json_response('external_tool.json'))
|
27
|
+
tool = @client.course_external_tool(1, 1)
|
28
|
+
expect(tool['id']).to eq(1)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'account_external_tool' do
|
33
|
+
it 'returns an account external tool' do
|
34
|
+
stub_get(@client, '/api/v1/accounts/1/external_tools/1').to_return(json_response('external_tool.json'))
|
35
|
+
tool = @client.account_external_tool(1, 1)
|
36
|
+
expect(tool['id']).to eq(1)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe 'create_course_external_tool' do
|
41
|
+
it 'creates an external tool for the course' do
|
42
|
+
stub_post(@client, '/api/v1/courses/1/external_tools')
|
43
|
+
.with(body: {})
|
44
|
+
.to_return(json_response('external_tool.json'))
|
45
|
+
|
46
|
+
tool = @client.create_course_external_tool(1, {})
|
47
|
+
expect(tool['id']).to eq(1)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe 'create_account_external_tool' do
|
52
|
+
it 'creates an external tool for the account' do
|
53
|
+
stub_post(@client, '/api/v1/accounts/1/external_tools')
|
54
|
+
.with(body: {})
|
55
|
+
.to_return(json_response('external_tool.json'))
|
56
|
+
|
57
|
+
tool = @client.create_account_external_tool(1, {})
|
58
|
+
expect(tool['id']).to eq(1)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe 'edit_course_external_tool' do
|
63
|
+
it 'edits the external tool' do
|
64
|
+
stub_put(@client, '/api/v1/courses/1/external_tools/1')
|
65
|
+
.with(body: {})
|
66
|
+
.to_return(json_response('external_tool.json'))
|
67
|
+
|
68
|
+
tool = @client.edit_course_external_tool(1, 1, {})
|
69
|
+
expect(tool['id']).to eq(1)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe 'edit_account_external_tool' do
|
74
|
+
it 'edits the external tool' do
|
75
|
+
stub_put(@client, '/api/v1/accounts/1/external_tools/1')
|
76
|
+
.with(body: {})
|
77
|
+
.to_return(json_response('external_tool.json'))
|
78
|
+
|
79
|
+
tool = @client.edit_account_external_tool(1, 1, {})
|
80
|
+
expect(tool['id']).to eq(1)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe 'delete_course_external_tool' do
|
85
|
+
it 'deletes the external tool' do
|
86
|
+
stub_delete(@client, '/api/v1/courses/1/external_tools/1')
|
87
|
+
.with(body: {})
|
88
|
+
.to_return(json_response('external_tool.json'))
|
89
|
+
|
90
|
+
tool = @client.delete_course_external_tool(1, 1, {})
|
91
|
+
expect(tool['id']).to eq(1)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
describe 'delete_account_external_tool' do
|
97
|
+
it 'deletes the external tool' do
|
98
|
+
stub_delete(@client, '/api/v1/accounts/1/external_tools/1')
|
99
|
+
.with(body: {})
|
100
|
+
.to_return(json_response('external_tool.json'))
|
101
|
+
|
102
|
+
tool = @client.delete_account_external_tool(1, 1, {})
|
103
|
+
expect(tool['id']).to eq(1)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
{
|
2
|
+
"id": 1,
|
3
|
+
"domain": "localhost",
|
4
|
+
"url": null,
|
5
|
+
"consumer_key": "key",
|
6
|
+
"name": "Accredidation",
|
7
|
+
"description": null,
|
8
|
+
"created_at": "2017-05-19T20:45:01Z",
|
9
|
+
"updated_at": "2017-05-19T20:45:01Z",
|
10
|
+
"privacy_level": "public",
|
11
|
+
"custom_fields": {
|
12
|
+
"custom_canvas_role": "$Canvas.membership.roles"
|
13
|
+
},
|
14
|
+
"workflow_state": "public",
|
15
|
+
"vendor_help_link": null,
|
16
|
+
"account_navigation": {
|
17
|
+
"enabled": "true",
|
18
|
+
"text": "Accreditation Tracking",
|
19
|
+
"url": "http://localhost:4000/lti/account",
|
20
|
+
"visibility": "admins",
|
21
|
+
"label": "Accreditation Tracking",
|
22
|
+
"selection_width": 800,
|
23
|
+
"selection_height": 400
|
24
|
+
},
|
25
|
+
"similarity_detection": null,
|
26
|
+
"assignment_menu": null,
|
27
|
+
"assignment_selection": null,
|
28
|
+
"collaboration": null,
|
29
|
+
"course_assignments_menu": null,
|
30
|
+
"course_home_sub_navigation": null,
|
31
|
+
"course_navigation": null,
|
32
|
+
"course_settings_sub_navigation": null,
|
33
|
+
"discussion_topic_menu": null,
|
34
|
+
"editor_button": null,
|
35
|
+
"file_menu": null,
|
36
|
+
"global_navigation": null,
|
37
|
+
"homework_submission": null,
|
38
|
+
"link_selection": null,
|
39
|
+
"migration_selection": null,
|
40
|
+
"module_menu": null,
|
41
|
+
"post_grades": null,
|
42
|
+
"quiz_menu": null,
|
43
|
+
"resource_selection": null,
|
44
|
+
"tool_configuration": null,
|
45
|
+
"user_navigation": {
|
46
|
+
"enabled": "true",
|
47
|
+
"text": "Accreditation Tracking",
|
48
|
+
"url": "http://localhost:4000/lti/user",
|
49
|
+
"label": "Accreditation Tracking",
|
50
|
+
"selection_width": 800,
|
51
|
+
"selection_height": 400
|
52
|
+
},
|
53
|
+
"wiki_page_menu": null,
|
54
|
+
"not_selectable": false
|
55
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": 1,
|
4
|
+
"domain": "localhost",
|
5
|
+
"url": null,
|
6
|
+
"consumer_key": "key",
|
7
|
+
"name": "Accredidation",
|
8
|
+
"description": null,
|
9
|
+
"created_at": "2017-05-19T20:45:01Z",
|
10
|
+
"updated_at": "2017-05-19T20:45:01Z",
|
11
|
+
"privacy_level": "public",
|
12
|
+
"custom_fields": {
|
13
|
+
"custom_canvas_role": "$Canvas.membership.roles"
|
14
|
+
},
|
15
|
+
"workflow_state": "public",
|
16
|
+
"vendor_help_link": null,
|
17
|
+
"account_navigation": {
|
18
|
+
"enabled": "true",
|
19
|
+
"text": "Accreditation Tracking",
|
20
|
+
"url": "http://localhost:4000/lti/account",
|
21
|
+
"visibility": "admins",
|
22
|
+
"label": "Accreditation Tracking",
|
23
|
+
"selection_width": 800,
|
24
|
+
"selection_height": 400
|
25
|
+
},
|
26
|
+
"similarity_detection": null,
|
27
|
+
"assignment_menu": null,
|
28
|
+
"assignment_selection": null,
|
29
|
+
"collaboration": null,
|
30
|
+
"course_assignments_menu": null,
|
31
|
+
"course_home_sub_navigation": null,
|
32
|
+
"course_navigation": null,
|
33
|
+
"course_settings_sub_navigation": null,
|
34
|
+
"discussion_topic_menu": null,
|
35
|
+
"editor_button": null,
|
36
|
+
"file_menu": null,
|
37
|
+
"global_navigation": null,
|
38
|
+
"homework_submission": null,
|
39
|
+
"link_selection": null,
|
40
|
+
"migration_selection": null,
|
41
|
+
"module_menu": null,
|
42
|
+
"post_grades": null,
|
43
|
+
"quiz_menu": null,
|
44
|
+
"resource_selection": null,
|
45
|
+
"tool_configuration": null,
|
46
|
+
"user_navigation": {
|
47
|
+
"enabled": "true",
|
48
|
+
"text": "Accreditation Tracking",
|
49
|
+
"url": "http://localhost:4000/lti/user",
|
50
|
+
"label": "Accreditation Tracking",
|
51
|
+
"selection_width": 800,
|
52
|
+
"selection_height": 400
|
53
|
+
},
|
54
|
+
"wiki_page_menu": null,
|
55
|
+
"not_selectable": false
|
56
|
+
}
|
57
|
+
]
|
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.
|
4
|
+
version: 1.3.25
|
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: 2018-
|
11
|
+
date: 2018-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- lib/bearcat/client/custom_gradebook_columns.rb
|
122
122
|
- lib/bearcat/client/discussions.rb
|
123
123
|
- lib/bearcat/client/enrollments.rb
|
124
|
+
- lib/bearcat/client/external_tools.rb
|
124
125
|
- lib/bearcat/client/file_helper.rb
|
125
126
|
- lib/bearcat/client/files.rb
|
126
127
|
- lib/bearcat/client/folders.rb
|
@@ -155,6 +156,7 @@ files:
|
|
155
156
|
- spec/bearcat/client/custom_gradebook_columns_spec.rb
|
156
157
|
- spec/bearcat/client/discussions_spec.rb
|
157
158
|
- spec/bearcat/client/enrollments_spec.rb
|
159
|
+
- spec/bearcat/client/external_tools_spec.rb
|
158
160
|
- spec/bearcat/client/files_spec.rb
|
159
161
|
- spec/bearcat/client/folders_spec.rb
|
160
162
|
- spec/bearcat/client/group_categories_spec.rb
|
@@ -253,6 +255,8 @@ files:
|
|
253
255
|
- spec/fixtures/edited_group_category.json
|
254
256
|
- spec/fixtures/enroll_student.json
|
255
257
|
- spec/fixtures/enrollment_terms.json
|
258
|
+
- spec/fixtures/external_tool.json
|
259
|
+
- spec/fixtures/external_tools.json
|
256
260
|
- spec/fixtures/file.csv
|
257
261
|
- spec/fixtures/gradebook_history.json
|
258
262
|
- spec/fixtures/group.json
|
@@ -343,6 +347,7 @@ test_files:
|
|
343
347
|
- spec/bearcat/client/custom_gradebook_columns_spec.rb
|
344
348
|
- spec/bearcat/client/discussions_spec.rb
|
345
349
|
- spec/bearcat/client/enrollments_spec.rb
|
350
|
+
- spec/bearcat/client/external_tools_spec.rb
|
346
351
|
- spec/bearcat/client/files_spec.rb
|
347
352
|
- spec/bearcat/client/folders_spec.rb
|
348
353
|
- spec/bearcat/client/group_categories_spec.rb
|
@@ -441,6 +446,8 @@ test_files:
|
|
441
446
|
- spec/fixtures/edited_group_category.json
|
442
447
|
- spec/fixtures/enroll_student.json
|
443
448
|
- spec/fixtures/enrollment_terms.json
|
449
|
+
- spec/fixtures/external_tool.json
|
450
|
+
- spec/fixtures/external_tools.json
|
444
451
|
- spec/fixtures/file.csv
|
445
452
|
- spec/fixtures/gradebook_history.json
|
446
453
|
- spec/fixtures/group.json
|