bearcat 1.3.4 → 1.3.5
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 +4 -4
- data/lib/bearcat/client.rb +2 -0
- data/lib/bearcat/client/content_exports.rb +39 -0
- data/lib/bearcat/client/content_migrations.rb +40 -0
- data/lib/bearcat/version.rb +1 -1
- data/spec/bearcat/client/content_exports_spec.rb +68 -0
- data/spec/bearcat/client/content_migrations_spec.rb +72 -0
- data/spec/fixtures/content_export.json +9 -0
- data/spec/fixtures/content_migration_files/content_migration.json +13 -0
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33acb91dffeaac66dddee65d11ae3adf74fae5a5
|
4
|
+
data.tar.gz: ed319de8739a90563f130a35d51c102ea2bbdb8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f82bab13382211c00f34cab2262d1492ec731b807eb76f86bceea3ee65819d247a9508edf73878142524400eaf888fefce7e1406f698dae98d25b14148d9b949
|
7
|
+
data.tar.gz: 5d3ba85086d8473021007a7eb3993b0d6d3e4eb28f40c6e1886b3c479433a11422066df8e2ce33b3bb8cfadde7a22962696f6156e9bbd89d76b8c0fe4d4a6116
|
data/lib/bearcat/client.rb
CHANGED
@@ -32,6 +32,7 @@ module Bearcat
|
|
32
32
|
require 'bearcat/client/analytics'
|
33
33
|
require 'bearcat/client/module_items'
|
34
34
|
require 'bearcat/client/content_migrations'
|
35
|
+
require 'bearcat/client/content_exports'
|
35
36
|
|
36
37
|
include Assignments
|
37
38
|
include Accounts
|
@@ -63,6 +64,7 @@ module Bearcat
|
|
63
64
|
include Folders
|
64
65
|
include ModuleItems
|
65
66
|
include ContentMigrations
|
67
|
+
include ContentExports
|
66
68
|
|
67
69
|
|
68
70
|
# Override Footrest request for ApiArray support
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Bearcat
|
2
|
+
class Client < Footrest::Client
|
3
|
+
module ContentExports
|
4
|
+
|
5
|
+
def create_content_export(id, type, params = {})
|
6
|
+
post("/api/v1/#{type}/#{id}/content_exports", params)
|
7
|
+
end
|
8
|
+
|
9
|
+
def create_course_export(id, params = {})
|
10
|
+
create_content_export(id, 'courses', params)
|
11
|
+
end
|
12
|
+
|
13
|
+
def create_group_export(id, params = {})
|
14
|
+
create_content_export(id, 'groups', params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_user_export(id, params = {})
|
18
|
+
create_content_export(id, 'users', params)
|
19
|
+
end
|
20
|
+
|
21
|
+
def get_content_export(id, export_id, type, params = {})
|
22
|
+
get("/api/v1/#{type}/#{id}/content_exports/#{export_id}", params)
|
23
|
+
end
|
24
|
+
|
25
|
+
def get_course_export(course_id, export_id, params = {})
|
26
|
+
get_content_export(course_id, export_id, 'courses', params)
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_group_export(group_id, export_id, params = {})
|
30
|
+
get_content_export(group_id, export_id, 'groups', params)
|
31
|
+
end
|
32
|
+
|
33
|
+
def get_user_export(user_id, export_id, params = {})
|
34
|
+
get_content_export(user_id, export_id, 'users', params)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -9,6 +9,46 @@ module Bearcat
|
|
9
9
|
confirm_file_upload(confirmation_url)
|
10
10
|
end
|
11
11
|
|
12
|
+
def get_content_migration(id, migration_id, type, params = {})
|
13
|
+
get("/api/v1/#{type}/#{id}/content_migrations/#{migration_id}", params)
|
14
|
+
end
|
15
|
+
|
16
|
+
def get_account_content_migration(account_id, migration_id, params = {})
|
17
|
+
get_content_migration(account_id, migration_id, 'accounts', params = {})
|
18
|
+
end
|
19
|
+
|
20
|
+
def get_course_content_migration(course_id, migration_id, params = {})
|
21
|
+
get_content_migration(course_id, migration_id, 'courses', params = {})
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_group_content_migration(group_id, migration_id, params = {})
|
25
|
+
get_content_migration(group_id, migration_id, 'groups', params = {})
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_user_content_migration(user_id, migration_id, params = {})
|
29
|
+
get_content_migration(user_id, migration_id, 'users', params = {})
|
30
|
+
end
|
31
|
+
|
32
|
+
def create_content_migration(id, type, params = {})
|
33
|
+
post("/api/v1/#{type}/#{id}/content_migrations", params)
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_account_content_migration(account_id, params = {})
|
37
|
+
create_content_migration(account_id, 'accounts', params)
|
38
|
+
end
|
39
|
+
|
40
|
+
def create_course_content_migration(course_id, params = {})
|
41
|
+
create_content_migration(course_id, 'courses', params)
|
42
|
+
end
|
43
|
+
|
44
|
+
def create_group_content_migration(group_id, params = {})
|
45
|
+
create_content_migration(group_id, 'groups', params)
|
46
|
+
end
|
47
|
+
|
48
|
+
def create_user_content_migration(user_id, params = {})
|
49
|
+
create_content_migration(user_id, 'users', params)
|
50
|
+
end
|
51
|
+
|
12
52
|
end
|
13
53
|
end
|
14
54
|
end
|
data/lib/bearcat/version.rb
CHANGED
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Bearcat::Client::ContentExports do
|
4
|
+
before do
|
5
|
+
@client = Bearcat::Client.new(prefix: "http://canvas.instructure.com", token: "test_token")
|
6
|
+
end
|
7
|
+
|
8
|
+
describe 'create_course_export' do
|
9
|
+
it "creates a course export" do
|
10
|
+
stub_post(@client, "/api/v1/courses/3/content_exports").to_return(json_response("content_export.json"))
|
11
|
+
course = @client.create_course_export(3)
|
12
|
+
course['export_type'].should == 'common_cartridge'
|
13
|
+
course['attachment'].should == {"url" => "https://example.com/api/v1/attachments/789?download_frd=1&verifier=bG9sY2F0cyEh"}
|
14
|
+
course['progress_url'].should == "https://example.com/api/v1/progress/4"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'create_group_export' do
|
19
|
+
it "creates a group export" do
|
20
|
+
stub_post(@client, "/api/v1/groups/3/content_exports").to_return(json_response("content_export.json"))
|
21
|
+
group = @client.create_group_export(3)
|
22
|
+
group['export_type'].should == 'common_cartridge'
|
23
|
+
group['attachment'].should == {"url" => "https://example.com/api/v1/attachments/789?download_frd=1&verifier=bG9sY2F0cyEh"}
|
24
|
+
group['progress_url'].should == "https://example.com/api/v1/progress/4"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe 'create_user_export' do
|
29
|
+
it "creates a user export" do
|
30
|
+
stub_post(@client, "/api/v1/users/3/content_exports").to_return(json_response("content_export.json"))
|
31
|
+
user = @client.create_user_export(3)
|
32
|
+
user['export_type'].should == 'common_cartridge'
|
33
|
+
user['attachment'].should == {"url" => "https://example.com/api/v1/attachments/789?download_frd=1&verifier=bG9sY2F0cyEh"}
|
34
|
+
user['progress_url'].should == "https://example.com/api/v1/progress/4"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe 'get_course_export' do
|
39
|
+
it "gets a course export" do
|
40
|
+
stub_get(@client, "/api/v1/courses/3/content_exports/1").to_return(json_response("content_export.json"))
|
41
|
+
course = @client.get_course_export(3, 1)
|
42
|
+
course['export_type'].should == 'common_cartridge'
|
43
|
+
course['attachment'].should == {"url" => "https://example.com/api/v1/attachments/789?download_frd=1&verifier=bG9sY2F0cyEh"}
|
44
|
+
course['progress_url'].should == "https://example.com/api/v1/progress/4"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe 'get_group_export' do
|
49
|
+
it "gets a group export" do
|
50
|
+
stub_get(@client, "/api/v1/groups/3/content_exports/1").to_return(json_response("content_export.json"))
|
51
|
+
group = @client.get_group_export(3, 1)
|
52
|
+
group['export_type'].should == 'common_cartridge'
|
53
|
+
group['attachment'].should == {"url" => "https://example.com/api/v1/attachments/789?download_frd=1&verifier=bG9sY2F0cyEh"}
|
54
|
+
group['progress_url'].should == "https://example.com/api/v1/progress/4"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe 'get_user_export' do
|
59
|
+
it "gets a user export" do
|
60
|
+
stub_get(@client, "/api/v1/users/3/content_exports/1").to_return(json_response("content_export.json"))
|
61
|
+
user = @client.get_user_export(3, 1)
|
62
|
+
user['export_type'].should == 'common_cartridge'
|
63
|
+
user['attachment'].should == {"url" => "https://example.com/api/v1/attachments/789?download_frd=1&verifier=bG9sY2F0cyEh"}
|
64
|
+
user['progress_url'].should == "https://example.com/api/v1/progress/4"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
@@ -19,4 +19,76 @@ describe Bearcat::Client::ContentMigrations do
|
|
19
19
|
expect(response['id']).to eq 293
|
20
20
|
end
|
21
21
|
|
22
|
+
describe 'get_group_content_migration' do
|
23
|
+
it "gets a content_migration" do
|
24
|
+
stub_get(@client, "/api/v1/accounts/3/content_migrations/1").to_return(json_response("content_migration_files/content_migration.json"))
|
25
|
+
account = @client.get_account_content_migration(3, 1)
|
26
|
+
account['migration_type'].should == 'common_cartridge_importer'
|
27
|
+
account['migration_type_title'].should == "Canvas Cartridge Importer"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe 'get_course_content_migration' do
|
32
|
+
it "gets a content_migration" do
|
33
|
+
stub_get(@client, "/api/v1/courses/3/content_migrations/1").to_return(json_response("content_migration_files/content_migration.json"))
|
34
|
+
course = @client.get_course_content_migration(3, 1)
|
35
|
+
course['migration_type'].should == 'common_cartridge_importer'
|
36
|
+
course['migration_type_title'].should == "Canvas Cartridge Importer"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe 'get_group_content_migration' do
|
41
|
+
it "gets a content_migration" do
|
42
|
+
stub_get(@client, "/api/v1/groups/3/content_migrations/1").to_return(json_response("content_migration_files/content_migration.json"))
|
43
|
+
group = @client.get_group_content_migration(3, 1)
|
44
|
+
group['migration_type'].should == 'common_cartridge_importer'
|
45
|
+
group['migration_type_title'].should == "Canvas Cartridge Importer"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe 'get_user_content_migration' do
|
50
|
+
it "gets a content_migration" do
|
51
|
+
stub_get(@client, "/api/v1/users/3/content_migrations/1").to_return(json_response("content_migration_files/content_migration.json"))
|
52
|
+
user = @client.get_user_content_migration(3, 1)
|
53
|
+
user['migration_type'].should == 'common_cartridge_importer'
|
54
|
+
user['migration_type_title'].should == "Canvas Cartridge Importer"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe 'create_account_content_migration' do
|
59
|
+
it "creates a account migration" do
|
60
|
+
stub_post(@client, "/api/v1/accounts/3/content_migrations").to_return(json_response('content_migration_files/content_migration.json'))
|
61
|
+
account = @client.create_account_content_migration(3)
|
62
|
+
account['migration_type'].should == 'common_cartridge_importer'
|
63
|
+
account['migration_type_title'].should == "Canvas Cartridge Importer"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe 'create_course_content_migration' do
|
68
|
+
it "creates a course migration" do
|
69
|
+
stub_post(@client, "/api/v1/courses/3/content_migrations").to_return(json_response('content_migration_files/content_migration.json'))
|
70
|
+
course = @client.create_course_content_migration(3)
|
71
|
+
course['migration_type'].should == 'common_cartridge_importer'
|
72
|
+
course['migration_type_title'].should == "Canvas Cartridge Importer"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe 'create_group_content_migration' do
|
77
|
+
it "creates a group migration" do
|
78
|
+
stub_post(@client, "/api/v1/groups/3/content_migrations").to_return(json_response('content_migration_files/content_migration.json'))
|
79
|
+
group = @client.create_group_content_migration(3)
|
80
|
+
group['migration_type'].should == 'common_cartridge_importer'
|
81
|
+
group['migration_type_title'].should == "Canvas Cartridge Importer"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe 'create_user_content_migration' do
|
86
|
+
it "creates a user migration" do
|
87
|
+
stub_post(@client, "/api/v1/users/3/content_migrations").to_return(json_response('content_migration_files/content_migration.json'))
|
88
|
+
user = @client.create_user_content_migration(3)
|
89
|
+
user['migration_type'].should == 'common_cartridge_importer'
|
90
|
+
user['migration_type_title'].should == "Canvas Cartridge Importer"
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
22
94
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
{
|
2
|
+
"id": 101,
|
3
|
+
"created_at": "2014-01-01T00:00:00Z",
|
4
|
+
"export_type": "common_cartridge",
|
5
|
+
"attachment": {"url":"https://example.com/api/v1/attachments/789?download_frd=1&verifier=bG9sY2F0cyEh"},
|
6
|
+
"progress_url": "https://example.com/api/v1/progress/4",
|
7
|
+
"user_id": 4,
|
8
|
+
"workflow_state": "exported"
|
9
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"id": 370663,
|
3
|
+
"migration_type": "common_cartridge_importer",
|
4
|
+
"migration_type_title": "Canvas Cartridge Importer",
|
5
|
+
"migration_issues_url": "https://example.com/api/v1/courses/1/content_migrations/1/migration_issues",
|
6
|
+
"attachment": {"url": "https://example.com/api/v1/courses/1/content_migrations/1/download_archive"},
|
7
|
+
"progress_url": "https://example.com/api/v1/progress/4",
|
8
|
+
"user_id": 4,
|
9
|
+
"workflow_state": "running",
|
10
|
+
"started_at": "2012-06-01T00:00:00-06:00",
|
11
|
+
"finished_at": "2012-06-01T00:00:00-06:00",
|
12
|
+
"pre_attachment": {"upload_url": "", "message": "file exceeded quota", "upload_params": {}}
|
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.
|
4
|
+
version: 1.3.5
|
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:
|
11
|
+
date: 2017-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -114,6 +114,7 @@ files:
|
|
114
114
|
- lib/bearcat/client/calendar_events.rb
|
115
115
|
- lib/bearcat/client/canvas_files.rb
|
116
116
|
- lib/bearcat/client/conferences.rb
|
117
|
+
- lib/bearcat/client/content_exports.rb
|
117
118
|
- lib/bearcat/client/content_migrations.rb
|
118
119
|
- lib/bearcat/client/conversations.rb
|
119
120
|
- lib/bearcat/client/courses.rb
|
@@ -145,6 +146,7 @@ files:
|
|
145
146
|
- spec/bearcat/client/calendar_events_spec.rb
|
146
147
|
- spec/bearcat/client/canvas_files_spec.rb
|
147
148
|
- spec/bearcat/client/conferences_spec.rb
|
149
|
+
- spec/bearcat/client/content_exports_spec.rb
|
148
150
|
- spec/bearcat/client/content_migrations_spec.rb
|
149
151
|
- spec/bearcat/client/conversations_spec.rb
|
150
152
|
- spec/bearcat/client/courses_spec.rb
|
@@ -197,6 +199,8 @@ files:
|
|
197
199
|
- spec/fixtures/cc.imscc
|
198
200
|
- spec/fixtures/communication_channels.json
|
199
201
|
- spec/fixtures/conclude_enrollment.json
|
202
|
+
- spec/fixtures/content_export.json
|
203
|
+
- spec/fixtures/content_migration_files/content_migration.json
|
200
204
|
- spec/fixtures/content_migration_files/response.json
|
201
205
|
- spec/fixtures/content_migration_files/upload_success.json
|
202
206
|
- spec/fixtures/conversation.json
|
@@ -301,7 +305,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
301
305
|
version: '0'
|
302
306
|
requirements: []
|
303
307
|
rubyforge_project:
|
304
|
-
rubygems_version: 2.
|
308
|
+
rubygems_version: 2.5.1
|
305
309
|
signing_key:
|
306
310
|
specification_version: 4
|
307
311
|
summary: Canvas API
|
@@ -313,6 +317,7 @@ test_files:
|
|
313
317
|
- spec/bearcat/client/calendar_events_spec.rb
|
314
318
|
- spec/bearcat/client/canvas_files_spec.rb
|
315
319
|
- spec/bearcat/client/conferences_spec.rb
|
320
|
+
- spec/bearcat/client/content_exports_spec.rb
|
316
321
|
- spec/bearcat/client/content_migrations_spec.rb
|
317
322
|
- spec/bearcat/client/conversations_spec.rb
|
318
323
|
- spec/bearcat/client/courses_spec.rb
|
@@ -365,6 +370,8 @@ test_files:
|
|
365
370
|
- spec/fixtures/cc.imscc
|
366
371
|
- spec/fixtures/communication_channels.json
|
367
372
|
- spec/fixtures/conclude_enrollment.json
|
373
|
+
- spec/fixtures/content_export.json
|
374
|
+
- spec/fixtures/content_migration_files/content_migration.json
|
368
375
|
- spec/fixtures/content_migration_files/response.json
|
369
376
|
- spec/fixtures/content_migration_files/upload_success.json
|
370
377
|
- spec/fixtures/conversation.json
|