d2l_sdk 0.1.9 → 0.1.10

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.
@@ -7,45 +7,169 @@ require 'json-schema'
7
7
  # REVIEW: Delete a specific grade object for a particular org unit.
8
8
  # Return: nil
9
9
  def delete_org_unit_grade_object(org_unit_id, grade_object_id)
10
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/#{grade_object_id}"
11
- _delete(path)
10
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/#{grade_object_id}"
11
+ _delete(path)
12
12
  end
13
13
 
14
14
  # REVIEW: Retrieve all the current grade objects for a particular org unit.
15
15
  # Return: This action returns a JSON array of GradeObject blocks.
16
16
  def get_org_unit_grades(org_unit_id)
17
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/"
18
- _get(path)
19
- # RETURN: This action returns a JSON array of GradeObject blocks.
17
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/"
18
+ _get(path)
19
+ # RETURN: This action returns a JSON array of GradeObject blocks.
20
20
  end
21
21
 
22
22
  # REVIEW: Retrieve a specific grade object for a particular org unit.
23
23
  # Return: This action returns a GradeObject JSON block.
24
24
  def get_org_unit_grade_object(org_unit_id, grade_object_id)
25
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/#{grade_object_id}"
26
- _get(path)
27
- # RETURN: This action returns a GradeObject JSON block.
28
- end
29
-
30
- # TODO: Create a new grade object for a particular org unit.
25
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/#{grade_object_id}"
26
+ _get(path)
27
+ # RETURN: This action returns a GradeObject JSON block.
28
+ end
29
+
30
+ def check_numeric_grade_object
31
+ {
32
+ 'MaxPoints' => 0.0, # <number:decimal>,
33
+ 'CanExceedMaxPoints' => true, # <boolean>,
34
+ 'IsBonus' => true, # <boolean>,
35
+ 'ExcludeFromFinalGradeCalculation' => true, # <boolean>,
36
+ 'GradeSchemeId' => nil, # <number:D2LID>|null,
37
+ 'Id' => 0, # <number:D2LID>, // not on input actions
38
+ 'Name' => '', # <string>,
39
+ 'ShortName' => '', # <string>,
40
+ 'GradeType' => 0, # "Numeric",
41
+ 'CategoryId' => nil, # <number:D2LID>|null,
42
+ 'Description' => # { <composite:RichTextInput> } on input actions
43
+ {
44
+ 'Content' => '',
45
+ 'Type' => 'Text|HTML'
46
+ },
47
+ 'GradeSchemeUrl' => '', # <string:APIURL>, // not on input actions
48
+ 'Weight' => 0.0, # <number:decimal>, // not on input actions
49
+ 'ActivityId' => nil, # <string:D2LID>|null, // not on input actions
50
+ 'AssociatedTool' => # { <composite:AssociatedTool> }|null
51
+ {
52
+ 'ToolId' => 0, # <string:D2LID>
53
+ 'ToolItemId' => 0 # <string:D2LID>
54
+ }
55
+ }
56
+ end
57
+
58
+ # TODO: Create validity functions for grade objects within this.
59
+ # Create a new grade object for a particular org unit.
31
60
  # Return: This action returns a GradeObject JSON block for the grade object
32
61
  # that the service just created, so you can quickly retrieve the grade object ID
33
- def create_org_unit_grade_object(org_unit_id, grade_object)
34
- # POST /d2l/api/le/(version)/(orgUnitId)/grades/
35
- # NOTE: must be grade object of type numeric, passfail, selectbox, or text
36
- # NOTE: the name must be unique!
37
- # Return: This action returns a GradeObject JSON block for the grade object
38
- # that the service just created, so you can quickly retrieve the grade object
39
- # ID
62
+ def create_org_unit_grade_object(org_unit_id, grade_object, type)
63
+ # POST /d2l/api/le/(version)/(orgUnitId)/grades/
64
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/"
65
+ payload = {}
66
+ # NOTE: must be grade object of type numeric, passfail, selectbox, or text
67
+ # NOTE: the name must be unique!
68
+ if type == 'Numeric' || type == 'numeric'
69
+ payload =
70
+ {
71
+ 'MaxPoints' => 0.0, # <number:decimal>,
72
+ 'CanExceedMaxPoints' => true, # <boolean>,
73
+ 'IsBonus' => true, # <boolean>,
74
+ 'ExcludeFromFinalGradeCalculation' => true, # <boolean>,
75
+ 'GradeSchemeId' => nil, # <number:D2LID>|null,
76
+ 'Name' => '', # <string>,
77
+ 'ShortName' => '', # <string>,
78
+ 'GradeType' => 'Numeric', #
79
+ 'CategoryId' => nil, # <number:D2LID>|null,
80
+ 'Description' => # { <composite:RichTextInput> } on input actions
81
+ {
82
+ 'Content' => '',
83
+ 'Type' => 'Text|HTML'
84
+ },
85
+ 'AssociatedTool' => # { <composite:AssociatedTool> }|null
86
+ {
87
+ 'ToolId' => 0, # <string:D2LID>
88
+ 'ToolItemId' => 0 # <string:D2LID>
89
+ }
90
+ }.merge!(grade_object)
91
+ # TODO: check numeric grade object validity
92
+ elsif type == 'PassFail' || type == 'passfail'
93
+ payload =
94
+ {
95
+ 'MaxPoints' => 0.0, # <number:decimal>,
96
+ 'IsBonus' => true, # <boolean>,
97
+ 'ExcludeFromFinalGradeCalculation' => true, # <boolean>,
98
+ 'GradeSchemeId' => nil, # <number:D2LID>|null
99
+ 'Name' => '', # <string>,
100
+ 'ShortName' => '', # <string>,
101
+ 'GradeType' => 'PassFail', #
102
+ 'CategoryId' => nil, # <number:D2LID>|null,
103
+ 'Description' => # { <composite:RichTextInput> } on input actions
104
+ {
105
+ 'Content' => '',
106
+ 'Type' => 'Text|HTML'
107
+ },
108
+ 'AssociatedTool' => # { <composite:AssociatedTool> }|null
109
+ {
110
+ 'ToolId' => 0, # <string:D2LID>
111
+ 'ToolItemId' => 0 # <string:D2LID>
112
+ }
113
+ }.merge!(grade_object)
114
+ # TODO: check PassFail grade object validity
115
+ elsif type == 'SelectBox' || type == 'selectbox'
116
+ payload =
117
+ {
118
+ 'MaxPoints' => 0.0, # <number:decimal>,
119
+ 'IsBonus' => true, # <boolean>,
120
+ 'ExcludeFromFinalGradeCalculation' => true, # <boolean>,
121
+ 'GradeSchemeId' => nil, # nil/null on input
122
+ 'Name' => '', # <string>,
123
+ 'ShortName' => '', # <string>,
124
+ 'GradeType' => 'SelectBox', #
125
+ 'CategoryId' => nil, # <number:D2LID>|null,
126
+ 'Description' => # { <composite:RichTextInput> } on input actions
127
+ {
128
+ 'Content' => '',
129
+ 'Type' => 'Text|HTML'
130
+ },
131
+ 'AssociatedTool' => # { <composite:AssociatedTool> }|null
132
+ {
133
+ 'ToolId' => 0, # <string:D2LID>
134
+ 'ToolItemId' => 0 # <string:D2LID>
135
+ }
136
+ }.merge!(grade_object)
137
+ # TODO: check SelectBox grade object validity
138
+ elsif type == 'Text' || type == 'text'
139
+ payload =
140
+ {
141
+ 'Name' => '', # <string>,
142
+ 'ShortName' => '', # <string>,
143
+ 'GradeType' => 'Text',
144
+ 'CategoryId' => nil, # <number:D2LID>|null,
145
+ 'Description' => # { <composite:RichTextInput> } on input actions
146
+ {
147
+ 'Content' => '',
148
+ 'Type' => 'Text|HTML'
149
+ },
150
+ 'AssociatedTool' => # { <composite:AssociatedTool> }|null
151
+ {
152
+ 'ToolId' => 0, # <string:D2LID>
153
+ 'ToolItemId' => 0 # <string:D2LID>
154
+ }
155
+ }.merge!(grade_object)
156
+ # TODO: check Text grade object validity
157
+ else
158
+ raise ArgumentError, 'Grade Object Type not a valid type'
159
+ end
160
+ _post(path, payload)
161
+ # Return: This action returns a GradeObject JSON block for the grade object
162
+ # that the service just created, so you can quickly retrieve the grade object
163
+ # ID
40
164
  end
41
165
 
42
166
  # TODO: Update a specific grade object.
43
167
  def update_org_unit_grade_object(org_unit_id, grade_object)
44
- # NOTE: if new name, it must be Unique
45
- # NOTE: must be grade object of type numeric, passfail, selectbox, or text
46
- # PUT /d2l/api/le/(version)/(orgUnitId)/grades/(gradeObjectId)
47
- # Return: This action returns a GradeObject JSON block for the grade object
48
- # that the service just updated.
168
+ # NOTE: if new name, it must be Unique
169
+ # NOTE: must be grade object of type numeric, passfail, selectbox, or text
170
+ # PUT /d2l/api/le/(version)/(orgUnitId)/grades/(gradeObjectId)
171
+ # Return: This action returns a GradeObject JSON block for the grade object
172
+ # that the service just updated.
49
173
  end
50
174
 
51
175
  ########################
@@ -54,35 +178,53 @@ end
54
178
 
55
179
  # REVIEW: Delete a specific grade category for a provided org unit.
56
180
  def delete_org_unit_grade_category(org_unit_id, category_id)
57
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/categories/#{category_id}"
58
- _delete(path)
181
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/categories/#{category_id}"
182
+ _delete(path)
59
183
  end
60
184
 
61
185
  # REVIEW: Retrieve a list of all grade categories for a provided org unit.
62
186
  # Return: This action retrieves a JSON array of GradeObjectCategory blocks.
63
187
  def get_org_unit_grade_categories(org_unit_id)
64
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/categories/"
65
- _get(path)
66
- # Return: This action retrieves a JSON array of GradeObjectCategory blocks.
188
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/categories/"
189
+ _get(path)
190
+ # Return: This action retrieves a JSON array of GradeObjectCategory blocks.
67
191
  end
68
192
 
69
193
  # REVIEW: Retrieve a specific grade category for a provided org unit.
70
194
  # Return: This action retrieves a GradeObjectCategory JSON block.
71
195
  def get_org_unit_grade_category(org_unit_id, category_id)
72
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/categories/#{category_id}"
73
- _get(path)
74
- # Return: This action retrieves a GradeObjectCategory JSON block.
196
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/categories/#{category_id}"
197
+ _get(path)
198
+ # Return: This action retrieves a GradeObjectCategory JSON block.
75
199
  end
76
200
 
77
- # TODO: Create a new grade category for a provided org unit.
201
+ # REVIEW: Create a new grade category for a provided org unit.
78
202
  # Return. This action returns the newly created grade object category in a
79
203
  # GradeObjectCategory JSON block, so that you can quickly gather its grade
80
204
  # category ID.
81
205
  def create_org_unit_grade_category(org_unit_id, grade_category_data)
82
- # POST /d2l/api/le/(version)/(orgUnitId)/grades/
83
- # Return. This action returns the newly created grade object category in a
84
- # GradeObjectCategory JSON block, so that you can quickly gather its grade
85
- # category ID.
206
+ # POST /d2l/api/le/(version)/(orgUnitId)/grades/
207
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/"
208
+ payload =
209
+ {
210
+ 'Name' => '', # <string>,
211
+ 'ShortName'=> '', # <string>,
212
+ 'CanExceedMax'=> false, # <boolean>,
213
+ 'ExcludeFromFinalGrade'=> false, # <boolean>,
214
+ 'StartDate' => nil, # <string:UTCDateTime>|null,
215
+ 'EndDate' => nil, # <string:UTCDateTime>|null,
216
+ 'Weight' => nil, # <number:decimal>|null,
217
+ 'MaxPoints' => nil, # <number:decimal>|null,
218
+ 'AutoPoints' => nil, # <boolean>|null,
219
+ 'WeightDistributionType' => nil, # <number>|null,
220
+ 'NumberOfHighestToDrop' => nil, # <number>|null,
221
+ 'NumberOfLowestToDrop' => nil, # <number>|null
222
+ }.merge!(grade_category_data)
223
+ # TODO: Validity check of 'create_org_unit_grade_category'!
224
+ _post(path, payload)
225
+ # Return. This action returns the newly created grade object category in a
226
+ # GradeObjectCategory JSON block, so that you can quickly gather its grade
227
+ # category ID.
86
228
  end
87
229
 
88
230
  ########################
@@ -92,17 +234,17 @@ end
92
234
  # REVIEW: Retrieve all the grade schemes for a provided org unit.
93
235
  # Return: This action returns a JSON array of GradeScheme blocks.
94
236
  def get_org_unit_grade_schemes(org_unit_id)
95
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/schemes/"
96
- _get(path)
97
- # Return: This action returns a JSON array of GradeScheme blocks.
237
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/schemes/"
238
+ _get(path)
239
+ # Return: This action returns a JSON array of GradeScheme blocks.
98
240
  end
99
241
 
100
242
  # REVIEW: Retrieve a particular grade scheme.
101
243
  # Return: This action returns a GradeScheme JSON block.
102
244
  def get_org_unit_grade_scheme(org_unit_id, grade_scheme_id)
103
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/schemes/#{grade_scheme_id}"
104
- _get(path)
105
- # Return: This action returns a GradeScheme JSON block.
245
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/schemes/#{grade_scheme_id}"
246
+ _get(path)
247
+ # Return: This action returns a GradeScheme JSON block.
106
248
  end
107
249
 
108
250
  ########################
@@ -113,10 +255,10 @@ end
113
255
  # Return: This action returns a GradeValue JSON block containing the final
114
256
  # calculated grade value for the current user context.
115
257
  def get_current_user_final_grade(org_unit_id)
116
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/final/values/myGradeValue"
117
- _get(path)
118
- # Return: This action returns a GradeValue JSON block containing the final
119
- # calculated grade value for the current user context.
258
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/final/values/myGradeValue"
259
+ _get(path)
260
+ # Return: This action returns a GradeValue JSON block containing the final
261
+ # calculated grade value for the current user context.
120
262
  end
121
263
 
122
264
  # TODO: Retrieve a list of final grade values for the current user
@@ -127,9 +269,9 @@ end
127
269
  # final calculated grade values sorted by the OrgUnitIds that match the provided
128
270
  # query parameter filters.
129
271
  def get_current_user_final_grades(org_unit_ids_csv)
130
- # RETURN: This action returns an ObjectListPage JSON block containing a list
131
- # of final calculated grade values sorted by the OrgUnitIds that match the
132
- # provided query parameter filters.
272
+ # RETURN: This action returns an ObjectListPage JSON block containing a list
273
+ # of final calculated grade values sorted by the OrgUnitIds that match the
274
+ # provided query parameter filters.
133
275
  end
134
276
 
135
277
  # REVIEW: Retrieve the final grade value for a particular user.
@@ -138,11 +280,11 @@ end
138
280
  # Return: This action returns a GradeValue JSON block containing the final
139
281
  # calculated grade value for the provided user.
140
282
  def get_user_final_grade(org_unit_id, user_id, grade_type = '')
141
- path = "/d2l/api/le/#{le_ver}/#{org_unit_id}/grades/final/values/#{user_id}"
142
- path += "?gradeType=#{grade_type}" if grade_type != ''
143
- _get(path)
144
- # Return: This action returns a GradeValue JSON block containing the final
145
- # calculated grade value for the provided user.
283
+ path = "/d2l/api/le/#{le_ver}/#{org_unit_id}/grades/final/values/#{user_id}"
284
+ path += "?gradeType=#{grade_type}" if grade_type != ''
285
+ _get(path)
286
+ # Return: This action returns a GradeValue JSON block containing the final
287
+ # calculated grade value for the provided user.
146
288
  end
147
289
 
148
290
  # REVIEW: Retrieve each user’s grade value for a particular grade object.
@@ -151,39 +293,39 @@ end
151
293
  # of user grade values for your provided grade object.
152
294
  def get_all_grade_object_grades(org_unit_id, grade_object_id, sort = '',
153
295
  page_size = 0, is_graded = nil, search_text = '')
154
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/#{grade_object_id}/values/"
155
- path += "?"
156
- path += "sort=#{sort}&" if sort != ''
157
- path += "pageSize=#{page_size}&" if page_size != 0
158
- path += "isGraded=#{is_graded}&" if is_graded != nil
159
- path += "searchText=#{search_text}" if search_text != ''
160
- _get(path)
161
- # RETURN: This action returns an ObjectListPage JSON block containing a list
162
- # of user grade values for your provided grade object.
296
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/#{grade_object_id}/values/"
297
+ path += '?'
298
+ path += "sort=#{sort}&" if sort != ''
299
+ path += "pageSize=#{page_size}&" if page_size != 0
300
+ path += "isGraded=#{is_graded}&" unless is_graded.nil?
301
+ path += "searchText=#{search_text}" if search_text != ''
302
+ _get(path)
303
+ # RETURN: This action returns an ObjectListPage JSON block containing a list
304
+ # of user grade values for your provided grade object.
163
305
  end
164
306
 
165
307
  # REVIEW: Retrieve a specific grade value for the current user context assigned
166
308
  # in a particular org unit.
167
309
  # RETURN: This action returns a GradeValue JSON block.
168
310
  def get_user_grade_object_grade(org_unit_id, grade_object_id, user_id)
169
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/#{grade_object_id}/values/#{user_id}"
170
- _get(path)
171
- # RETURN: This action returns a GradeValue JSON block.
311
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/#{grade_object_id}/values/#{user_id}"
312
+ _get(path)
313
+ # RETURN: This action returns a GradeValue JSON block.
172
314
  end
173
315
 
174
316
  # REVIEW: Retrieve all the grade objects for the current user context assigned
175
317
  # in a particular org unit.
176
318
  def get_current_user_org_unit_grades(org_unit_id)
177
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/values/myGradeValues/"
178
- _get(path)
179
- # RETURN: This action returns a JSON array of GradeValue blocks.
319
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/values/myGradeValues/"
320
+ _get(path)
321
+ # RETURN: This action returns a JSON array of GradeValue blocks.
180
322
  end
181
323
 
182
324
  # REVIEW: Retrieve all the grade objects for a particular user assigned in an org unit.
183
325
  def get_user_org_unit_grades(org_unit_id, user_id)
184
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/values/#{user_id}/"
185
- _get(path)
186
- # RETURN: This action returns a JSON array of GradeValue blocks.
326
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/values/#{user_id}/"
327
+ _get(path)
328
+ # RETURN: This action returns a JSON array of GradeValue blocks.
187
329
  end
188
330
 
189
331
  ########################
@@ -193,8 +335,8 @@ end
193
335
  # REVIEW: Delete a course completion.
194
336
  # RETURNS: nil
195
337
  def delete_course_completion(org_unit_id, completion_id)
196
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/courseCompletion/#{completion_id}"
197
- _delete(path)
338
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/courseCompletion/#{completion_id}"
339
+ _delete(path)
198
340
  end
199
341
 
200
342
  # REVIEW: Retrieve all the course completion records for an org unit.
@@ -203,52 +345,52 @@ end
203
345
  # parameter (or the first segment if the parameter is empty or missing).
204
346
  def get_org_unit_completion_records(org_unit_id, user_id = 0, start_expiry = '',
205
347
  end_expiry = '', bookmark = '')
206
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/courseCompletion/"
207
- path += "?"
208
- path += "userId=#{user_id}&" if user_id != 0
209
- path += "startExpiry=#{start_expiry}&" if startExpiry != ''
210
- path += "endExpiry=#{end_expiry}&" if endExpiry != ''
211
- path += "bookmark=#{bookmark}" if bookmark != ''
212
- _get(path)
213
- # RETURNS: This action returns a paged result set containing the resulting
214
- # CourseCompletion data blocks for the segment following your bookmark
215
- # parameter (or the first segment if the parameter is empty or missing).
348
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/courseCompletion/"
349
+ path += '?'
350
+ path += "userId=#{user_id}&" if user_id != 0
351
+ path += "startExpiry=#{start_expiry}&" if startExpiry != ''
352
+ path += "endExpiry=#{end_expiry}&" if endExpiry != ''
353
+ path += "bookmark=#{bookmark}" if bookmark != ''
354
+ _get(path)
355
+ # RETURNS: This action returns a paged result set containing the resulting
356
+ # CourseCompletion data blocks for the segment following your bookmark
357
+ # parameter (or the first segment if the parameter is empty or missing).
216
358
  end
217
359
 
218
360
  # REVIEW: Retrieve all the course completion records for a user.
219
361
  # RETURNS: This action returns a paged result set containing the resulting
220
362
  # CourseCompletion data blocks for the segment following your bookmark
221
363
  # parameter (or the first segment if the parameter is empty or missing).
222
- def get_user_completion_records(user_id, start_expiry = '', end_expiry = '',
364
+ def get_user_completion_records(_user_id, start_expiry = '', end_expiry = '',
223
365
  bookmark = '')
224
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/courseCompletion/"
225
- path += "?"
226
- path += "startExpiry=#{start_expiry}&" if startExpiry != ''
227
- path += "endExpiry=#{end_expiry}&" if endExpiry != ''
228
- path += "bookmark=#{bookmark}" if bookmark != ''
229
- _get(path)
230
- # RETURNS: This action returns a paged result set containing the resulting
231
- # CourseCompletion data blocks for the segment following your bookmark
232
- # parameter (or the first segment if the parameter is empty or missing).
366
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/courseCompletion/"
367
+ path += '?'
368
+ path += "startExpiry=#{start_expiry}&" if startExpiry != ''
369
+ path += "endExpiry=#{end_expiry}&" if endExpiry != ''
370
+ path += "bookmark=#{bookmark}" if bookmark != ''
371
+ _get(path)
372
+ # RETURNS: This action returns a paged result set containing the resulting
373
+ # CourseCompletion data blocks for the segment following your bookmark
374
+ # parameter (or the first segment if the parameter is empty or missing).
233
375
  end
234
376
 
235
377
  # TODO: Create a new course completion for an org unit.
236
378
  # RETURNS: a CourseCompletion JSON block with the newly created course completion record.
237
379
  def create_course_completion(org_unit_id, course_completion_data)
238
- #CourseCompletionCreationData JSON data block example:
239
- # {"UserId" => 0,
240
- # "CompletedDate" => "UTCDateTime",
241
- # "ExpiryDate" => "UTCDateTime" || nil}
242
- # POST /d2l/api/le/(version)/(orgUnitId)/grades/courseCompletion/
380
+ # CourseCompletionCreationData JSON data block example:
381
+ # {"UserId" => 0,
382
+ # "CompletedDate" => "UTCDateTime",
383
+ # "ExpiryDate" => "UTCDateTime" || nil}
384
+ # POST /d2l/api/le/(version)/(orgUnitId)/grades/courseCompletion/
243
385
  end
244
386
 
245
387
  # TODO: Update an existing course completion.
246
388
  # RETURNS: a CourseCompletion JSON block with the newly created course completion record.
247
389
  def update_course_completion(org_unit_id, completion_id, course_completion_data)
248
- # CourseCompletionUpdateData JSON data block example:
249
- # {"CompletedDate" => "UTCDateTime",
250
- # "ExpiryDate" => "UTCDateTime" || nil}
251
- # PUT /d2l/api/le/(version)/(orgUnitId)/grades/courseCompletion/(completionId)
390
+ # CourseCompletionUpdateData JSON data block example:
391
+ # {"CompletedDate" => "UTCDateTime",
392
+ # "ExpiryDate" => "UTCDateTime" || nil}
393
+ # PUT /d2l/api/le/(version)/(orgUnitId)/grades/courseCompletion/(completionId)
252
394
  end
253
395
 
254
396
  ########################
@@ -258,9 +400,9 @@ end
258
400
  # REVIEW: Get statistics for a specified grade item.
259
401
  # RETURNS: a GradeStatisticsInfo JSON block.
260
402
  def get_grade_item_statistics(org_unit_id, grade_object_id)
261
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/#{grade_object_id}/statistics"
262
- _get(path)
263
- # RETURNS: a GradeStatisticsInfo JSON block.
403
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/#{grade_object_id}/statistics"
404
+ _get(path)
405
+ # RETURNS: a GradeStatisticsInfo JSON block.
264
406
  end
265
407
 
266
408
  ########################
@@ -270,21 +412,21 @@ end
270
412
  # REVIEW: Retrieve the grades configuration for the org unit.
271
413
  # RETURNS: a GradeSetupInfo JSON block.
272
414
  def get_org_unit_grade_config(org_unit_id)
273
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/setup/"
274
- _get(path)
275
- # RETURNS: a GradeSetupInfo JSON block.
415
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/setup/"
416
+ _get(path)
417
+ # RETURNS: a GradeSetupInfo JSON block.
276
418
  end
277
419
 
278
420
  # TODO: Update the grades configuration for the org unit.
279
421
  # INPUT: a GradeSetupInfo JSON block. (grade_setup_info)
280
422
  # RETURNS: a GradeSetupInfo JSON block.
281
423
  def update_org_unit_grade_config(org_unit_id, grade_setup_info)
282
- # Grade.GradeSetupInfo JSON data block example:
283
- # {"GradingSystem" => "Points", # Other types: "Weighted", "Formula"
284
- # "IsNullGradeZero" => false,
285
- # "DefaultGradeSchemeId" => 0}
286
- # PUT /d2l/api/le/(version)/(orgUnitId)/grades/setup/
287
- # RETURNS: a GradeSetupInfo JSON block.
424
+ # Grade.GradeSetupInfo JSON data block example:
425
+ # {"GradingSystem" => "Points", # Other types: "Weighted", "Formula"
426
+ # "IsNullGradeZero" => false,
427
+ # "DefaultGradeSchemeId" => 0}
428
+ # PUT /d2l/api/le/(version)/(orgUnitId)/grades/setup/
429
+ # RETURNS: a GradeSetupInfo JSON block.
288
430
  end
289
431
 
290
432
  ########################
@@ -294,33 +436,33 @@ end
294
436
  # REVIEW: Retrieve all the exempt users for a provided grade.
295
437
  # RETURNS: a JSON array of User blocks.
296
438
  def get_grade_exempt_users(org_unit_id, grade_object_id)
297
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/#{grade_object_id}/exemptions/"
298
- _get(path)
299
- # RETURNS: a JSON array of User blocks.
439
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/#{grade_object_id}/exemptions/"
440
+ _get(path)
441
+ # RETURNS: a JSON array of User blocks.
300
442
  end
301
443
 
302
444
  # REVIEW: Determine if a user is exempt from a grade.
303
445
  # RETURNS: a User JSON block.
304
446
  def get_is_user_exempt(org_unit_id, grade_object_id, user_id)
305
- path = "GET /d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/#{grade_object_id}/exemptions/#{user_id}"
306
- _get(path)
307
- # RETURNS: a User JSON block.
447
+ path = "GET /d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/#{grade_object_id}/exemptions/#{user_id}"
448
+ _get(path)
449
+ # RETURNS: a User JSON block.
308
450
  end
309
451
 
310
452
  # REVIEW: Exempt a user from a grade.
311
453
  # RETURNS: a User JSON block.
312
454
  def exempt_user_from_grade(org_unit_id, grade_object_id, user_id)
313
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/#{grade_object_id}/exemptions/#{user_id}"
314
- _post(path, {})
315
- # RETURNS: a User JSON block.
455
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/#{grade_object_id}/exemptions/#{user_id}"
456
+ _post(path, {})
457
+ # RETURNS: a User JSON block.
316
458
  end
317
459
 
318
460
  # REVIEW: Remove a user’s exemption from a grade.
319
461
  # RETURNS: nil
320
462
  def remove_user_grade_exemption(org_unit_id, grade_object_id, user_id)
321
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/#{grade_object_id}/exemptions/#{user_id}"
322
- _delete(path)
323
- # RETURNS: nil
463
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/#{grade_object_id}/exemptions/#{user_id}"
464
+ _delete(path)
465
+ # RETURNS: nil
324
466
  end
325
467
 
326
468
  #############################
@@ -330,9 +472,9 @@ end
330
472
  # REVIEW: Retrieve all the grade objects for a provided user in a provided org unit with exemption status included.
331
473
  # RETURNS: BulkGradeObjectExemptionResult JSON block.
332
474
  def get_user_grade_exemptions(org_unit_id, user_id)
333
- path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/exemptions/#{user_id}"
334
- _get(path)
335
- # RETURNS: BulkGradeObjectExemptionResult JSON block.
475
+ path = "/d2l/api/le/#{$le_ver}/#{org_unit_id}/grades/exemptions/#{user_id}"
476
+ _get(path)
477
+ # RETURNS: BulkGradeObjectExemptionResult JSON block.
336
478
  end
337
479
 
338
480
  # TODO: Attempt to exempt or unexempt a set of grades for a user.
@@ -342,11 +484,36 @@ end
342
484
  # be exempted or unexempted.
343
485
  # RETURNS: a JSON array of BulkGradeObjectExemptionConflict blocks.
344
486
  def bulk_grade_exemption_update(org_unit_id, user_id, bulk_grade_exmption_update_block)
345
- # Grade.BulkGradeObjectExemptionUpdate JSON data block example:
346
- # {"ExemptedIds" => [0,1,2,3], # D2LIDs
347
- # "UnexemptedIds" => [0,1,2,3], # D2LIDs
348
- # "ExemptionAccessDate" => 'UTCDateTime'}
487
+ # Grade.BulkGradeObjectExemptionUpdate JSON data block example:
488
+ # {"ExemptedIds" => [0,1,2,3], # D2LIDs
489
+ # "UnexemptedIds" => [0,1,2,3], # D2LIDs
490
+ # "ExemptionAccessDate" => 'UTCDateTime'}
491
+
492
+ # POST /d2l/api/le/(version)/(orgUnitId)/grades/exemptions/(userId)
493
+ # RETURNS: a JSON array of BulkGradeObjectExemptionConflict blocks.
494
+ end
495
+
496
+ ###################
497
+ # ASSESSMENTS:#####
498
+ ###################
499
+
500
+ # TODO: --UNSTABLE-- Retrieve rubrics for an object in an org unit.
501
+ # RETURNS: a JSON array of Rubric blocks.
502
+ def get_org_unit_rubrics(org_unit_id, object_type, object_id)
503
+ # GET /d2l/api/le/(version)/(orgUnitId)/rubrics
504
+ # RETURNS: a JSON array of Rubric blocks.
505
+ end
506
+
507
+ # TODO: --UNSTABLE-- Retrieve an assessment in an org unit.
508
+ # RETURNS: a RubricAssessment JSON structure.
509
+ def get_org_unit_assessment(org_unit_id, assessment_type, object_type, object_id, user_id)
510
+ # GET /d2l/api/le/(version)/(orgUnitId)/assessment
511
+ # RETURNS: a RubricAssessment JSON structure.
512
+ end
349
513
 
350
- # POST /d2l/api/le/(version)/(orgUnitId)/grades/exemptions/(userId)
351
- # RETURNS: a JSON array of BulkGradeObjectExemptionConflict blocks.
514
+ # TODO: --UNSTABLE-- Update an assessment in an org unit.
515
+ # RETURNS: value of the assessment in a RubricAssessment JSON structure.
516
+ def update_org_unit_assessment(org_unit_id, assessment_type, object_type, object_id, user_id)
517
+ # PUT /d2l/api/le/(version)/(orgUnitId)/assessment
518
+ # RETURNS: value of the assessment in a RubricAssessment JSON structure.
352
519
  end