Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
This Gem allows for converting content to Canvas Common Cartridge format. The Gem allows building up Canvas objects(Courses, Assignments, Quizzes, Terms, etc.), without having to think about the xml format, and then will correctly build the .imscc file. The xsd for the CanvasCC format can be found here. NOTE: not all settings are currently supported by the gem, supported settings are documented
Add this line to your application's Gemfile:
gem 'canvas_cc'
And then execute:
$ bundle
Or install it yourself as:
$ gem install canvas_cc
The Gem will convert content to a Canvas course, so a Course should be the first object created.
###Course
course = CanvasCc::CanvasCC::Models::Course.new
Once a course is created it can be converted to an .imscc file as follows:
dir = Dir.mktmpdir
output_dir = CanvasCc::CanvasCC::CartridgeCreator.new(course).create(dir)
The output_dir will contain the .imscc file. This file can then be uploaded to Canvas.
The following are attributes available on the Course object.
###Assignments assignment = CanvasCc::CanvasCC::Models::Assignment.new #set attributes course.assignments << assignment
The following are attributes available on the Assignment object.
identifier - unique identifier for the Assignment
title - title of assignment
body - details of assignment
due_at - due_date of assignment
lock_at - lock at date of assignment
unlock_at - unlock date of assignment
workflow_state - initial workflow state of assignment('active', 'unpublished')
points_possible - points possible for assignment
assignment_group_identifier_ref - identifier from AssignmentGroup, that this assignment should be grouped in.
muted - whether or not the assignment is muted
turnitin_enabled - whether or not turn it in is enabled for this assignment
submission_types - valid submissions types for this assignment, this is an array of the following values('online_text_entry', 'online_upload', 'on_paper', 'discussion_topic', 'online_quiz')
assignment.submission_types << 'online_quiz'
grading_type - the grading type for the assignment, one of the following: ('letter_grade', 'points', 'percentage', 'pass_fail')
###Assessments assessment = CanvasCc::CanvasCC::Models::Assessment.new #set assessment attributes course.assessments << assessment The following are attributes associated with the Assessment object.
###Questions question = CanvasCc::CanvasCC::Models::Question.create('<QUESTION_TYPE>') assessment.items << question
The following are attributes associated with the Question object.
Some question types have additional attributes as noted below
matches - the matches for the question, this is a hash as follows:
question.matches << {
:id => unique_id,
:question_text => the text for the question,
:question_text_format => '1',
:answer_text => the text for the answer,
:answer_feedback => feedback for the question
}
distractors - the distractors for the question, this is an array of answers to use as distractors
###Answers answer = CanvasCc::CanvasCC::Models::Answer.new() question.answers << answer
The following are attributes associated with Answer object.
Depending on the type of question the answer_text will be formatted as follows:
###Question Banks Question bank allow for creating a pool of questions that can be pulled from for a quiz. They can be created as follows.
question_bank = CanvasCc::CanvasCC::Models::QuestionBank.new
question_bank.identifier = identifier # unique identifier for the bank
question_bank.title = title # title of the question bank
question_bank.questions = questions # array of questions in the question bank
course.question_banks << question_bank
Once a question bank is setup a quiz can be set to pull questions from the bank by using QuestionGroups. Question groups have the following attributes and can be created as follows
selection_number - the number fo questions to select from the pool.
points_per_item - the number of points to give each question selected.
identifier - unique identifier for the Question Group
sourcebank_ref - the identifier for the QuestionBank to associate with this group
question_group = CanvasCc::CanvasCC::Models::QuestionGroup.new question_bank.question_groups << question_group # associate this group with the bank assessment.items << question_group # add gropu to assesment items
###Canvas Modules A Canvas Module can be created as follows module = CanvasCc::CanvasCC::Models::CanvasModule.new course.canvas_modules << module
The following attributes are associated with the Module object.
###Module Item A Module Item represents an item within a module, this can be one of serveral types as described below. A ModuleItem can be crated as follows
module_item = CanvasCc::CanvasCC::Models::ModuleItem.new
module.items << module_item
The following attributes are associated with a ModuleItem
###Module Completion Requirements In Canvas modules can have completion req. associated with them, these can be setup in the content package as follows
completion_requirement = CanvasCc::CanvasCC::Models::ModuleCompletionRequirement.new
module.completion_requirements << completion_requirment
The following attributes are associated with the ModuleCompletionRequirement object.
###Module Prerequisites In Canvas modules can have prerequisites as requirements, these can be setup in the content package as follows
module_pre_requisite = CanvasCc::CanvasCC::Models::ModulePrerequisite.new
module.prerequisites << module_pre_requisite
The following attributes are associated with the ModulePrerequisite object
###Folders A folders used to group files under the files section in Canvas, a folder can be created as follows
folder = CanvasCc::CanvasCC::Models::CanvasFolder.new
course.folders << folder
A Folder can have the following attributes
###Files A file is a resource that is placed in the Canvas files section. A File can be created as follows
file = CanvasCc::CanvasCC::Models::CanvasFile.new
course.files << file
A File can have the following attributes
To reference a file inside of html content within pages, quizzes, assignments, discussions or other html content, the link can be written in the following format. When imported the references will be correctly updated to the file path of the content within Canvas.
<a href="$IMS_CC_FILEBASE$/files/test.png">Cool Image</a>
NOTE: to place a file in a folder, make sure the file_path is the same as the folder_location
###Pages A Page can be created in Canvas as follows page = CanvasCc::CanvasCC::Models::Page.new course.pages << page
A Page can have the following attributes
###Discussions A Discussion can be created in Canvas as follows
discussion = CanvasCc::CanvasCC::Models::Discussion.new
course.discussions << discussion
A Discussion can have the following attributes
###Assignment_groups An AssignmentGroup can be created in Canvas as follows
assignment_group = CanvasCc::CanvasCC::Models::AssignmentGroup.new
course.assignment_groups << assignment_group
An AssignmentGroup can have the following attributes
drop_type - this can be 'drop_highest', or 'drop_lowest'
drop_count - the number to drop.
assignment_group.rules << {drop_type: 'drop_lowest', drop_count: 2}
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that canvas_cc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.