@byu-oit/canvas-sdk
Advanced tools
Comparing version 0.1.2 to 0.1.3
{ | ||
"name": "@byu-oit/canvas-sdk", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "A wrapper around Instructure's Canvas API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -81,7 +81,11 @@ 'use strict'; | ||
sections.getEnrollment = async function(sisSectionId, sisUserId) { | ||
sections.getEnrollment = async function(sisSectionId, sisUserId, type) { | ||
if(!sisSectionId) { | ||
logger.error("Must provide sisSectionId to sections.getEnrollment"); | ||
} | ||
const res = await canvas.request('GET', `users/sis_user_id:${sisUserId}/enrollments?sis_section_id=${sisSectionId}&state[]=active&state[]=invited&state[]=inactive&state[]=completed`); | ||
let url = `users/sis_user_id:${sisUserId}/enrollments?sis_section_id=${sisSectionId}&state[]=active&state[]=invited&state[]=inactive&state[]=completed`; | ||
if(type) { | ||
url = `${url}&type[]=${type}`; | ||
} | ||
const res = await canvas.request('GET', url.toString()); | ||
if(res) { | ||
@@ -88,0 +92,0 @@ if(res.length > 1) { |
@@ -116,2 +116,6 @@ 'use strict'; | ||
assert.strictEqual(enrollment.sis_user_id, SIS_USER_ID); | ||
enrollment = await canvas.sections.getEnrollment(SIS_SECTION_ID, SIS_USER_ID, 'StudentEnrollment'); | ||
assert.strictEqual(enrollment.sis_user_id, SIS_USER_ID); | ||
enrollment = await canvas.sections.getEnrollment(SIS_SECTION_ID, SIS_USER_ID, 'TeacherEnrollment'); | ||
assert.ok(! enrollment); | ||
await canvas.sections.changeEnrollment(SIS_SECTION_ID, SIS_USER_ID, 'deactivate'); | ||
@@ -118,0 +122,0 @@ enrollment = await canvas.sections.getEnrollment(SIS_SECTION_ID, SIS_USER_ID); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49191
800