canvas_cc 0.0.19.1.1 → 0.0.20

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
  SHA1:
3
- metadata.gz: 5f7953df780dc1fe56d582cb323aa2f8e860f9bd
4
- data.tar.gz: 014089dd7204752413832a343f4cfbe58c997cf7
3
+ metadata.gz: 3ae0fdbba3c8cc93302fd0093d8b5701451b22e2
4
+ data.tar.gz: 736c4f57a04896ab6640c3cfa39c598ad1db8e28
5
5
  SHA512:
6
- metadata.gz: 5643afc8fc1b55315ea2e144b209374d2343d63b404b4c1d004687912fa82317d8e9ebeb3a8aa10b600c54271b03803f1ac748cd36a75217758f934501216c47
7
- data.tar.gz: c22acea077e3371efc9fb5e5688ee7aa000f9b41b284de90edb5399750392234fe6707b4dc56accf62af3d8d708b9dc92267951e745b1ea9807edcda5a40b597
6
+ metadata.gz: 2c06f0921e0b06f4556d016a25428221ad2b7753a8bfd6e6d8e2fb341a0d01ab65a6df81b097e7cc872489a8cfd3bee3bd2009d8b0f76624cb72d74e0aa06eea
7
+ data.tar.gz: b0feb14f2fa31ffccd1d6d73776e3cd78a86907627e21af079427bdbf8c3180fa7052f7f1b96960c12f0320b62b4c81ff393360d2b1ec6641bb1aab759d8bf50
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- canvas_cc (0.0.19.1.1)
4
+ canvas_cc (0.0.18)
5
5
  builder
6
6
  happymapper
7
7
  nokogiri
@@ -42,16 +42,16 @@ GEM
42
42
  rspec (>= 2.14, < 4.0)
43
43
  happymapper (0.4.1)
44
44
  libxml-ruby (~> 2.0)
45
- libxml-ruby (2.8.0)
45
+ libxml-ruby (2.7.0)
46
46
  listen (2.7.9)
47
47
  celluloid (>= 0.15.2)
48
48
  rb-fsevent (>= 0.9.3)
49
49
  rb-inotify (>= 0.9)
50
50
  lumberjack (1.0.9)
51
51
  method_source (0.8.2)
52
- mini_portile (0.6.2)
52
+ mini_portile (0.6.1)
53
53
  minitest (5.4.1)
54
- nokogiri (1.6.6.2)
54
+ nokogiri (1.6.4.1)
55
55
  mini_portile (~> 0.6.0)
56
56
  pry (0.10.1)
57
57
  coderay (~> 1.1.0)
@@ -61,7 +61,7 @@ GEM
61
61
  rb-fsevent (0.9.4)
62
62
  rb-inotify (0.9.5)
63
63
  ffi (>= 0.5.0)
64
- rdiscount (2.1.8)
64
+ rdiscount (2.1.7.1)
65
65
  rspec (2.99.0)
66
66
  rspec-core (~> 2.99.0)
67
67
  rspec-expectations (~> 2.99.0)
@@ -70,7 +70,7 @@ GEM
70
70
  rspec-expectations (2.99.2)
71
71
  diff-lcs (>= 1.1.3, < 2.0)
72
72
  rspec-mocks (2.99.2)
73
- rubyzip (1.1.7)
73
+ rubyzip (1.1.6)
74
74
  slop (3.6.0)
75
75
  thor (0.19.1)
76
76
  timers (1.1.0)
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # CanvasCc
2
2
 
3
- TODO: Write a gem description
3
+ 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](https://github.com/instructure/canvas-lms/blob/stable/lib/cc/xsd/cccv1p0.xsd). **NOTE: not all settings are currently supported by the gem, supported settings are documented**
4
+
4
5
 
5
6
  ## Installation
6
7
 
@@ -17,8 +18,292 @@ Or install it yourself as:
17
18
  $ gem install canvas_cc
18
19
 
19
20
  ## Usage
21
+ The Gem will convert content to a Canvas course, so a Course should be the first object created.
22
+
23
+ ###Course
24
+
25
+ course = CanvasCc::CanvasCC::Models::Course.new
26
+
27
+ Once a course is created it can be converted to an .imscc file as follows:
28
+
29
+ dir = Dir.mktmpdir
30
+ output_dir = CanvasCc::CanvasCC::CartridgeCreator.new(course).create(dir)
31
+
32
+ The output_dir will contain the .imscc file. This file can then be uploaded to Canvas.
33
+
34
+ The following are attributes available on the Course object.
35
+ * **identifier** - unique identifier for the course
36
+ * **title** - the title of the course
37
+ * **course_code** - the course_code for the course
38
+ * **start_at** - the start at date for the course
39
+ * **conclude_at** - the conclude at date for the course
40
+ * **is_public** - whether the course is public or no
41
+ * **allow_student_wiki_edits** - Allow students to edit wiki pages
42
+ * **allow_student_forum_attachments** -Allow the student to attach files to discussion topics
43
+ * **default_wiki_editing_roles** - default value for who can edit wiki pages one of the following('teachers', 'teachers,students', 'anyone')
44
+ * **allow_student_organized_groups** - Allow students to create their own groups
45
+ * **show_all_discussion_entries** -
46
+ * **open_enrollment** - allow open enrollment in this course
47
+ * **allow_wiki_comments** - allow comments on wiki posts
48
+ * **self_enrollment** - Allow self enrollments in the course
49
+ * **turnitin_comments** - Allow turnitin comments
50
+ * **locale** - the locale of the course
51
+ * **hide_final_grade** - hide final grade from students
52
+ * **storage_quota** - the storage quota of the course in MB, for example 5000 is 5GB
53
+
54
+ ###Assignments
55
+ assignment = CanvasCc::CanvasCC::Models::Assignment.new
56
+ #set attributes
57
+ course.assignments << assignment
58
+
59
+ The following are attributes available on the Assignment object.
60
+ * **identifier** - unique identifier for the Assignment
61
+ * **title** - title of assignment
62
+ * **body** - details of assignment
63
+ * **due_at** - due_date of assignment
64
+ * **lock_at** - lock at date of assignment
65
+ * **unlock_at** - unlock date of assignment
66
+ * **workflow_state** - initial workflow state of assignment('active', 'unpublished')
67
+ * **points_possible** - points possible for assignment
68
+ * **assignment_group_identifier_ref** - identifier from AssignmentGroup, that this assignment should be grouped in.
69
+ * **muted** - whether or not the assignment is muted
70
+ * **turnitin_enabled** - whether or not turn it in is enabled for this assignment
71
+ * **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')
72
+
73
+ assignment.submission_types << 'online_quiz'
74
+ * **grading_type** - the grading type for the assignment, one of the following: ('letter_grade', 'points', 'percentage', 'pass_fail')
75
+
76
+ ###Assessments
77
+ assessment = CanvasCc::CanvasCC::Models::Assessment.new
78
+ #set assessment attributes
79
+ course.assessments << assessment
80
+ The following are attributes associated with the Assessment object.
81
+ * **identifier** - unique identifier for the Assessment
82
+ * **title** - the title of the quiz
83
+ * **description** - the description of the quiz
84
+ * **workflow_state** - initial workflow state of the quiz ('active', 'unpublished')
85
+ * **assignment** - the assignment this quiz is associated with
86
+ * **lock_at** - lock at date of quiz
87
+ * **unlock_at** - unlock at date of quiz
88
+ * **due_at** - due at date for quiz
89
+ * **allowed_attempts** - allowed attempts on the quiz
90
+ * **access_code** - access code to unlock quiz
91
+ * **ip_filter** - ip filter to restrict quiz access
92
+ * **quiz_type** - the type of the quiz, one of the following('practice_quiz', 'assignment', 'survey', 'graded_survey')
93
+ * **shuffle_answers** - true to shuffle quiz answers
94
+ * **items** - items associated with the quiz such as questions or question banks. See Questions below
95
+ * **time_limit** - The time limit for the quiz in minutes
96
+ * **anonymous_submissions** - allow anonymous submissions for the quiz
97
+ * **one_question_at_a_time** - show one question at a time for the quiz
98
+ * **cant_go_back** - allow the user to go back to previous questions on the quiz
99
+ * **hide_results** - hide quiz results
100
+ * **show_correct_answers** - show correct answers to quiz
101
+ * **show_correct_answers_at** - show correct answers on the following date
102
+ * **points_possible** - points possible on the quiz
103
+
104
+ ###Questions
105
+ question = CanvasCc::CanvasCC::Models::Question.create('<QUESTION_TYPE>')
106
+ assessment.items << question
107
+
108
+ The following are attributes associated with the Question object.
109
+ * **question_type** - the type of question, passed into constructor when creating question. One of the following('text_only_question', 'true_false_question', 'numerical_question', 'multiple_choice_question', 'multiple_answers_question', 'matching_question', 'fill_in_multiple_blanks_question, 'file_upload_question', 'essay_question')
110
+ * **identifier** - unique identifier for question
111
+ * **original_identifier** - foreign id for question
112
+ * **points_possible** - points possible for question
113
+ * **title** - the title of the question
114
+ * **material** - the question material
115
+ * **general_feedback** - the general feedback to be shown on the question
116
+ * **general_correct_feedback** - the feedback to show when answer is correct
117
+ * **general_incorrect_feedback** - the feedback to show when the answer is incorrect
118
+ * **answers** - array of answers for question. See Answers section below
119
+
120
+ Some question types have additional attributes as noted below
121
+ * **matching_question**
122
+ * **matches** - the matches for the question, this is a hash as follows:
123
+
124
+ question.matches << {
125
+ :id => unique_id,
126
+ :question_text => the text for the question,
127
+ :question_text_format => '1',
128
+ :answer_text => the text for the answer,
129
+ :answer_feedback => feedback for the question
130
+ }
131
+ * **distractors** - the distractors for the question, this is an array of answers to use as distractors
132
+ * **numerical_question**
133
+ * **ranges** - the range of acceptable answers for this question. Ranges are set as follows:
134
+ range = CanvasCc::CanvasCC::Models::Range.new
135
+ range.low_range = 5
136
+ range.high_range = 10
137
+ question.ranges[answer.id] = range
138
+
139
+ ###Answers
140
+ answer = CanvasCc::CanvasCC::Models::Answer.new(<ANSWER>)
141
+ question.answers << answer
142
+
143
+ The following are attributes associated with Answer object.
144
+ * **id** - unique id for answer
145
+ * **answer_text** - the text for the answer
146
+ * **resp_ident** - used as a response identifier on some question types.
147
+ * **fraction** - the fraction this answer contributes to question points(0.0 - 1.0)
148
+ * **feedback** - feedback or answer
149
+
150
+ Depending on the type of question the answer_text will be formatted as follows:
151
+ * **true_false_question** - 'True' or 'False'
152
+ * **fill_in_multiple_blanks_question**
153
+ * **answer_text** - the answer text for this blank
154
+ * **resp_ident** - this attribute should be set to a unique_id for this answer. In addition the material or the question should have blanks setup with the value of resp_ident in brackets. For example 'the dog was [answer_1]', and the value of the answer resp_ident would be 'answer_1' and the answer text could be 'brown'.
155
+ * **multiple_choice_question**
156
+ * **fraction** - this is set to 1.0 if it is the correct answer, 0.0 if incorrect answer.
157
+
158
+ ###Question Banks
159
+ Question bank allow for creating a pool of questions that can be pulled from for a quiz. They can be created as follows.
160
+
161
+ question_bank = CanvasCc::CanvasCC::Models::QuestionBank.new
162
+ question_bank.identifier = identifier # unique identifier for the bank
163
+ question_bank.title = title # title of the question bank
164
+ question_bank.questions = questions # array of questions in the question bank
165
+ course.question_banks << question_bank
166
+
167
+ 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
168
+ * **selection_number** - the number fo questions to select from the pool.
169
+ * **points_per_item** - the number of points to give each question selected.
170
+ * **identifier** - unique identifier for the Question Group
171
+ * **sourcebank_ref** - the identifier for the QuestionBank to associate with this group
172
+
173
+
174
+ question_group = CanvasCc::CanvasCC::Models::QuestionGroup.new
175
+ question_bank.question_groups << question_group # associate this group with the bank
176
+ assessment.items << question_group # add gropu to assesment items
177
+
178
+ ###Canvas Modules
179
+ A Canvas Module can be created as follows
180
+ module = CanvasCc::CanvasCC::Models::CanvasModule.new
181
+ course.canvas_modules << module
182
+
183
+ The following attributes are associated with the Module object.
184
+ * **identifier** - the unique identifier for the module object
185
+ * **title** - the title for the module
186
+ * **unlock_at** - the unlock at date for the module
187
+ * **workflow_state** - the initial workflow state for the module, either 'active' or 'unpublished'
188
+ * **module_items** - array of ModuleItems for the module.
189
+
190
+ ###Module Item
191
+ 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
192
+
193
+ module_item = CanvasCc::CanvasCC::Models::ModuleItem.new
194
+ module.items << module_item
195
+
196
+ The following attributes are associated with a ModuleItem
197
+ * **title** - the title of the ModuleItem
198
+ * **identifier** - unique identifier for the ModuleItem
199
+ * **workflow_state** - the initial workflow state for the module, either 'active' or 'unpublished'
200
+ * **content_type** - one of the following based on the content this ModuleItem contains
201
+ * **WikiPage** - when using a page
202
+ * **Attachment** - when referencing a file
203
+ * **ContextModuleSubHeader** - when referencing a submodule
204
+ * **DiscussionTopic** - when referencing a Discussion
205
+ * **Assignment** - when referencing an Assignment
206
+ * **Quizzes::Quiz** - when referencing an Assessment
207
+ * **ExternalUrl** - when referencing an external url
208
+
209
+ ###Module Completion Requirements
210
+ In Canvas modules can have completion req. associated with them, these can be setup in the content package as follows
211
+
212
+ completion_requirement = CanvasCc::CanvasCC::Models::ModuleCompletionRequirement.new
213
+ module.completion_requirements << completion_requirment
214
+
215
+ The following attributes are associated with the ModuleCompletionRequirement object.
216
+ * **identifierref** - the identifier for the module item that this completion req. is associated with
217
+ * **type** - the type of completion requirement, can be one of the following
218
+ * **must_view** - user must view the content
219
+ * **must_submit** - user must submit the content
220
+ * **min_score** - user must achieve a minimum score on the content **note the following attribute must also be set when using min_score 'min_score', with a value of the minimum score**
221
+ * **must_contribute** - user must contribute to the content
222
+
223
+ ###Module Prerequisites
224
+ In Canvas modules can have prerequisites as requirements, these can be setup in the content package as follows
225
+
226
+ module_pre_requisite = CanvasCc::CanvasCC::Models::ModulePrerequisite.new
227
+ module.prerequisites << module_pre_requisite
228
+
229
+ The following attributes are associated with the ModulePrerequisite object
230
+ * **identifierref** - the identifier of the prerequisite object(currently should be set to another module)
231
+ * **title** - the title of the prerequisite
232
+ * **type** - should be set to 'context_module'
233
+
234
+ ###Folders
235
+ A folders used to group files under the files section in Canvas, a folder can be created as follows
236
+
237
+ folder = CanvasCc::CanvasCC::Models::CanvasFolder.new
238
+ course.folders << folder
239
+
240
+ A Folder can have the following attributes
241
+ * **folder_location** - The location of the folder, this is a path to the folder such as '/assignments/files'
242
+ * **hidden** - whether or not the folder should be hidden. true or false
243
+ * **locked** - whether or not the folder should be locked. true or false
244
+
245
+ ###Files
246
+ A file is a resource that is placed in the Canvas files section. A File can be created as follows
247
+
248
+ file = CanvasCc::CanvasCC::Models::CanvasFile.new
249
+ course.files << file
250
+
251
+ A File can have the following attributes
252
+ * **identifier** - a unique identifier for this file
253
+ * **file_path** - the path of the file including the file name, for example '/assignments/files/test.png'
254
+ * **file_location** - the location on the filesystem for the file, for example '/tmp/files/assignments/files/test.png'
255
+ * **hidden** - whether or not this file is hidden. true or false
256
+
257
+ 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.
258
+
259
+ <a href="$IMS_CC_FILEBASE$/files/test.png">Cool Image</a>
260
+
261
+ **NOTE: to place a file in a folder, make sure the file_path is the same as the folder_location**
262
+
263
+ ###Pages
264
+ A Page can be created in Canvas as follows
265
+ page = CanvasCc::CanvasCC::Models::Page.new
266
+ course.pages << page
267
+
268
+ A Page can have the following attributes
269
+ * **identifier** - a unique identifier for the page
270
+ * **workflow_state** - the initial workflow state for the page, either 'active' or 'unpublished'
271
+ * **page_name** - the name of the page
272
+ * **body** - the content of the page
273
+
274
+
275
+
276
+ ###Discussions
277
+ A Discussion can be created in Canvas as follows
278
+
279
+ discussion = CanvasCc::CanvasCC::Models::Discussion.new
280
+ course.discussions << discussion
281
+
282
+ A Discussion can have the following attributes
283
+ * **identifier** - a unique identifier for the discussion
284
+ * **title** - the title of the discussion
285
+ * **text** - the text of the discussion
286
+ * **require_initial_post** - whether an initial post is required on this discussion
287
+ * **discussion_type** - the type of discussion 'threaded' or 'side_comment'
288
+ * **position** - used to control the ordering of discussions
289
+
290
+ ###Assignment_groups
291
+ An AssignmentGroup can be created in Canvas as follows
292
+
293
+ assignment_group = CanvasCc::CanvasCC::Models::AssignmentGroup.new
294
+ course.assignment_groups << assignment_group
295
+
296
+ An AssignmentGroup can have the following attributes
297
+ * **identifier** - unique identifier for the AssignmentGroup
298
+ * **title** - the title of the AssignmentGroup
299
+ * **position** - the position of the AssignmentGroup in relation to other AssignmentGroups, used for ordering
300
+ * **group_weight** - the weight of this AssignmentGroup if weighting is desired
301
+ * **rules** - This is a hash of rules that can be applied to the AssignmentGroup. The following rules are available
302
+ * **drop_type** - this can be 'drop_highest', or 'drop_lowest'
303
+ * **drop_count** - the number to drop.
304
+
305
+ assignment_group.rules << {drop_type: 'drop_lowest', drop_count: 2}
20
306
 
21
- TODO: Write usage instructions here
22
307
 
23
308
  ## Contributing
24
309
 
@@ -5,6 +5,10 @@ module CanvasCc::CanvasCC
5
5
 
6
6
  COURSE_SETTINGS_DIR = 'course_settings'
7
7
 
8
+ class << self
9
+ Zip.write_zip64_support = true
10
+ end
11
+
8
12
  def initialize(course)
9
13
  @course = course
10
14
  end
@@ -25,7 +25,6 @@ module CanvasCc::CanvasCC
25
25
  head.title page.title
26
26
  }
27
27
  html.body { |body|
28
- puts "PAGE BODY #{page.body}"
29
28
  body << Nokogiri::HTML::fragment(page.body)
30
29
  }
31
30
  }
@@ -36,4 +35,4 @@ module CanvasCc::CanvasCC
36
35
  end
37
36
 
38
37
  end
39
- end
38
+ end
@@ -1,3 +1,3 @@
1
1
  module CanvasCc
2
- VERSION = "0.0.19.1.1"
2
+ VERSION = "0.0.20"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canvas_cc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19.1.1
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Instructure
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-20 00:00:00.000000000 Z
11
+ date: 2015-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip