bearcat 1.3.53 → 1.3.55

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
  SHA256:
3
- metadata.gz: f0cf8e258d39569d2594318b7ab932d6330a6c431457209296ef15a2a0e2ce1c
4
- data.tar.gz: 0271b96f8803739253365ab53c65246927a94f81a762f2ab935f1f5ecb47cb6e
3
+ metadata.gz: 2168e1b83a6cea7ae22cd280352d3c5865aae3811800c789cd122b6240e05ebe
4
+ data.tar.gz: bbd67cb26a64ba4d80f5b69a1d51514a7497b28b5cce86fe58a9a49ad4595857
5
5
  SHA512:
6
- metadata.gz: f786b3e10b6c69e1de4d98221167099ea626abca6769394eff4d72eb53c99eb0fa4594070c08e259302e401dfca44b314c89246aead3e39afd1b038250e27e87
7
- data.tar.gz: adb1e066f78c93c80e7ce0f326ddb9bfee40a93493fe5c184dd2f873111db53c44fe9bbd00d72ca2aef658177885e6b6acb959eee9f3fc7e9b5f57e5bd78c115
6
+ metadata.gz: e2f98fb58293a2151fc7920ec482f2527080c0f36e36ddb18e12b828cfbc09e002899d4cc341f55b4fdf323485b89a07988229c52bcde7f0257694a2bbaf7a30
7
+ data.tar.gz: ee7d9d0fd7cc50ae7d8ca073e2f201cb867c72b077db922ef3607d6e1b90b541c4dda1894f3acae31ac8a1bedbdd36cf0c8cdfeb457a22bdf21a280cb74b9368
@@ -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
@@ -63,9 +63,6 @@ module Bearcat
63
63
  get("api/v1/courses/#{course}/gradebook_history/feed", params)
64
64
  end
65
65
 
66
- def blueprint_subscriptions(course)
67
- get("/api/v1/courses/#{course}/blueprint_subscriptions")
68
- end
69
66
  end
70
67
  end
71
68
  end
@@ -32,12 +32,9 @@ module Bearcat::SpecHelpers
32
32
  bits << between if between.present?
33
33
 
34
34
  bits.map do |bit|
35
- case bit
36
- when Regexp
37
- bit.source
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)
@@ -1,3 +1,3 @@
1
1
  module Bearcat
2
- VERSION = '1.3.53' unless defined?(Bearcat::VERSION)
2
+ VERSION = '1.3.55' unless defined?(Bearcat::VERSION)
3
3
  end
@@ -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
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "id": 101,
3
+ "template_id": 1,
4
+ "blueprint_course": {"id":2,"name":"Biology 100 Blueprint","course_code":"BIOL 100 BP","term_name":"Default term"}
5
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "id": 1,
3
+ "course_id": 2,
4
+ "last_export_completed_at": "2013-08-28T23:59:00-06:00",
5
+ "associated_course_count": 3,
6
+ "latest_migration": null
7
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "success": true
3
+ }
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.53
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-02-21 00:00:00.000000000 Z
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