bearcat 1.3.53 → 1.3.55
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/blueprint_courses.rb +31 -0
- data/lib/bearcat/client/courses.rb +0 -3
- data/lib/bearcat/spec_helpers.rb +3 -6
- data/lib/bearcat/version.rb +1 -1
- data/spec/bearcat/client/blueprint_courses_spec.rb +43 -0
- data/spec/fixtures/blueprint_migration.json +12 -0
- data/spec/fixtures/blueprint_subscriptions.json +5 -0
- data/spec/fixtures/blueprint_template.json +7 -0
- data/spec/fixtures/blueprint_update_assocations_success.json +3 -0
- metadata +13 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2168e1b83a6cea7ae22cd280352d3c5865aae3811800c789cd122b6240e05ebe
|
4
|
+
data.tar.gz: bbd67cb26a64ba4d80f5b69a1d51514a7497b28b5cce86fe58a9a49ad4595857
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2f98fb58293a2151fc7920ec482f2527080c0f36e36ddb18e12b828cfbc09e002899d4cc341f55b4fdf323485b89a07988229c52bcde7f0257694a2bbaf7a30
|
7
|
+
data.tar.gz: ee7d9d0fd7cc50ae7d8ca073e2f201cb867c72b077db922ef3607d6e1b90b541c4dda1894f3acae31ac8a1bedbdd36cf0c8cdfeb457a22bdf21a280cb74b9368
|
data/lib/bearcat/client.rb
CHANGED
@@ -7,6 +7,7 @@ module Bearcat
|
|
7
7
|
require 'bearcat/api_array'
|
8
8
|
require 'bearcat/client/file_helper'
|
9
9
|
require 'bearcat/client/assignments'
|
10
|
+
require 'bearcat/client/blueprint_courses'
|
10
11
|
require 'bearcat/client/courses'
|
11
12
|
require 'bearcat/client/enrollments'
|
12
13
|
require 'bearcat/client/outcome_groups'
|
@@ -46,6 +47,7 @@ module Bearcat
|
|
46
47
|
include Assignments
|
47
48
|
include Accounts
|
48
49
|
include Analytics
|
50
|
+
include BlueprintCourses
|
49
51
|
include Courses
|
50
52
|
include Enrollments
|
51
53
|
include OutcomeGroups
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Bearcat
|
2
|
+
class Client < Footrest::Client
|
3
|
+
module BlueprintCourses
|
4
|
+
|
5
|
+
# Get blueprint information
|
6
|
+
# https://canvas.instructure.com/doc/api/blueprint_courses.html#method.master_courses/master_templates.show
|
7
|
+
def blueprint_template(course, template_id='default')
|
8
|
+
get("/api/v1/courses/#{course}/blueprint_templates/#{template_id}")
|
9
|
+
end
|
10
|
+
|
11
|
+
# List blueprint subscriptions
|
12
|
+
# https://canvas.instructure.com/doc/api/blueprint_courses.html#method.master_courses/master_templates.subscriptions_index
|
13
|
+
def blueprint_subscriptions(course)
|
14
|
+
get("/api/v1/courses/#{course}/blueprint_subscriptions")
|
15
|
+
end
|
16
|
+
|
17
|
+
# Update associated courses
|
18
|
+
# https://canvas.instructure.com/doc/api/blueprint_courses.html#method.master_courses/master_templates.update_associations
|
19
|
+
def blueprint_update_associations(course, template_id='default', params={})
|
20
|
+
put("/api/v1/courses/#{course}/blueprint_templates/#{template_id}/update_associations", params)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Begin a migration to push to associated courses
|
24
|
+
# https://canvas.instructure.com/doc/api/blueprint_courses.html#method.master_courses/master_templates.queue_migration
|
25
|
+
def start_blueprint_migration(course, template_id='default', params={})
|
26
|
+
post("/api/v1/courses/#{course}/blueprint_templates/#{template_id}/migrations", params)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/bearcat/spec_helpers.rb
CHANGED
@@ -32,12 +32,9 @@ module Bearcat::SpecHelpers
|
|
32
32
|
bits << between if between.present?
|
33
33
|
|
34
34
|
bits.map do |bit|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
when String
|
39
|
-
Regexp.escape(bit)
|
40
|
-
end
|
35
|
+
next bit.source if bit.is_a?(Regexp)
|
36
|
+
bit = bit.canvas_id if bit.respond_to?(:canvas_id)
|
37
|
+
Regexp.escape(bit.to_s)
|
41
38
|
end.join
|
42
39
|
when String
|
43
40
|
Regexp.escape(endpoint)
|
data/lib/bearcat/version.rb
CHANGED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Bearcat::Client::BlueprintCourses do
|
4
|
+
before do
|
5
|
+
@client = Bearcat::Client.new(prefix: "http://canvas.instructure.com", token: "test_token")
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'returns a list of blueprint subscriptions for the given course' do
|
9
|
+
stub_get(@client, "/api/v1/courses/1/blueprint_subscriptions").to_return(json_response("blueprint_subscriptions.json"))
|
10
|
+
subs = @client.blueprint_subscriptions(1)
|
11
|
+
expect(subs['id']).to eq 101
|
12
|
+
expect(subs['template_id']).to eq 1
|
13
|
+
expect(subs['blueprint_course']).to be_present
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'returns a blueprint template for the given course' do
|
17
|
+
stub_get(@client, "/api/v1/courses/2/blueprint_templates/default").to_return(json_response("blueprint_template.json"))
|
18
|
+
template = @client.blueprint_template(2)
|
19
|
+
expect(template['id']).to eq 1
|
20
|
+
expect(template['course_id']).to eq 2
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'updates assocations for a blueprint course' do
|
24
|
+
stub_put(@client, "/api/v1/courses/2/blueprint_templates/default/update_associations").to_return(json_response("blueprint_update_assocations_success.json"))
|
25
|
+
result = @client.blueprint_update_associations(2, 'default', course_ids_to_add: [123])
|
26
|
+
expect(result['success']).to eq true
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'starts a migration for a blueprint course' do
|
30
|
+
stub_post(@client, "/api/v1/courses/2/blueprint_templates/default/migrations").to_return(json_response("blueprint_migration.json"))
|
31
|
+
migration = @client.start_blueprint_migration(2, 'default', {
|
32
|
+
comment: 'An optional comment to be included in the sync history.',
|
33
|
+
send_notification: false,
|
34
|
+
copy_settings: true
|
35
|
+
})
|
36
|
+
expect(migration['id']).to eq 1
|
37
|
+
expect(migration['template_id']).to eq 2
|
38
|
+
expect(migration['subscription_id']).to eq 101
|
39
|
+
expect(migration['user_id']).to eq 3
|
40
|
+
expect(migration['workflow_state']).to eq 'running'
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
{
|
2
|
+
"id": 1,
|
3
|
+
"template_id": 2,
|
4
|
+
"subscription_id": 101,
|
5
|
+
"user_id": 3,
|
6
|
+
"workflow_state": "running",
|
7
|
+
"created_at": "2013-08-28T23:59:00-06:00",
|
8
|
+
"exports_started_at": "2013-08-28T23:59:00-06:00",
|
9
|
+
"imports_queued_at": "2013-08-28T23:59:00-06:00",
|
10
|
+
"imports_completed_at": "2013-08-28T23:59:00-06:00",
|
11
|
+
"comment": "Fixed spelling in question 3 of midterm exam"
|
12
|
+
}
|
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.55
|
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-
|
11
|
+
date: 2020-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- lib/bearcat/client/analytics.rb
|
140
140
|
- lib/bearcat/client/assignment_groups.rb
|
141
141
|
- lib/bearcat/client/assignments.rb
|
142
|
+
- lib/bearcat/client/blueprint_courses.rb
|
142
143
|
- lib/bearcat/client/calendar_events.rb
|
143
144
|
- lib/bearcat/client/canvas_files.rb
|
144
145
|
- lib/bearcat/client/conferences.rb
|
@@ -179,6 +180,7 @@ files:
|
|
179
180
|
- spec/bearcat/client/analytics_spec.rb
|
180
181
|
- spec/bearcat/client/assignment_groups_spec.rb
|
181
182
|
- spec/bearcat/client/assignments_spec.rb
|
183
|
+
- spec/bearcat/client/blueprint_courses_spec.rb
|
182
184
|
- spec/bearcat/client/calendar_events_spec.rb
|
183
185
|
- spec/bearcat/client/canvas_files_spec.rb
|
184
186
|
- spec/bearcat/client/conferences_spec.rb
|
@@ -239,6 +241,10 @@ files:
|
|
239
241
|
- spec/fixtures/assignment_section_override.json
|
240
242
|
- spec/fixtures/assignments.json
|
241
243
|
- spec/fixtures/bearcat.jpg
|
244
|
+
- spec/fixtures/blueprint_migration.json
|
245
|
+
- spec/fixtures/blueprint_subscriptions.json
|
246
|
+
- spec/fixtures/blueprint_template.json
|
247
|
+
- spec/fixtures/blueprint_update_assocations_success.json
|
242
248
|
- spec/fixtures/calendar_event.json
|
243
249
|
- spec/fixtures/calendar_events.json
|
244
250
|
- spec/fixtures/canvas_files/declare_file.json
|
@@ -398,6 +404,7 @@ test_files:
|
|
398
404
|
- spec/bearcat/client/graph_ql_spec.rb
|
399
405
|
- spec/bearcat/client/group_categories_spec.rb
|
400
406
|
- spec/bearcat/client/rubric_assessment_spec.rb
|
407
|
+
- spec/bearcat/client/blueprint_courses_spec.rb
|
401
408
|
- spec/bearcat/client/submissions_spec.rb
|
402
409
|
- spec/bearcat/client/module_items_spec.rb
|
403
410
|
- spec/bearcat/client/content_migrations_spec.rb
|
@@ -463,6 +470,8 @@ test_files:
|
|
463
470
|
- spec/fixtures/account_admin_create.json
|
464
471
|
- spec/fixtures/assignment.json
|
465
472
|
- spec/fixtures/calendar_event.json
|
473
|
+
- spec/fixtures/blueprint_subscriptions.json
|
474
|
+
- spec/fixtures/blueprint_update_assocations_success.json
|
466
475
|
- spec/fixtures/course.json
|
467
476
|
- spec/fixtures/rubric_association.json
|
468
477
|
- spec/fixtures/external_tools.json
|
@@ -498,6 +507,7 @@ test_files:
|
|
498
507
|
- spec/fixtures/user_logins.json
|
499
508
|
- spec/fixtures/module_item_sequence.json
|
500
509
|
- spec/fixtures/enrollment_terms.json
|
510
|
+
- spec/fixtures/blueprint_migration.json
|
501
511
|
- spec/fixtures/cc.imscc
|
502
512
|
- spec/fixtures/user_profile.json
|
503
513
|
- spec/fixtures/create_course_discussion.json
|
@@ -505,6 +515,7 @@ test_files:
|
|
505
515
|
- spec/fixtures/created_module.json
|
506
516
|
- spec/fixtures/course_groups.json
|
507
517
|
- spec/fixtures/reactivate_enrollment.json
|
518
|
+
- spec/fixtures/blueprint_template.json
|
508
519
|
- spec/fixtures/account_courses.json
|
509
520
|
- spec/fixtures/calendar_events.json
|
510
521
|
- spec/fixtures/submissions/submission.json
|