d2l_sdk 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/change_lastname.rb +65 -0
- data/lib/d2l_sdk/calendar.rb +264 -0
- data/lib/d2l_sdk/config_variables.rb +117 -1
- data/lib/d2l_sdk/course_content.rb +47 -2
- data/lib/d2l_sdk/demographics.rb +85 -3
- data/lib/d2l_sdk/discussions.rb +199 -0
- data/lib/d2l_sdk/dropbox.rb +120 -0
- data/lib/d2l_sdk/grades.rb +303 -136
- data/lib/d2l_sdk/lockers.rb +40 -0
- data/lib/d2l_sdk/lti.rb +34 -0
- data/lib/d2l_sdk/news.rb +20 -0
- data/lib/d2l_sdk/permissions.rb +27 -0
- data/lib/d2l_sdk/requests.rb +228 -18
- data/lib/d2l_sdk/setup_versions.rb +14 -6
- data/lib/d2l_sdk/user.rb +15 -5
- data/lib/d2l_sdk/version.rb +1 -1
- data/lol.txt +1 -0
- data/test.rb +19 -0
- metadata +11 -2
data/lib/d2l_sdk/grades.rb
CHANGED
@@ -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
|
-
|
11
|
-
|
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
|
-
|
18
|
-
|
19
|
-
|
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
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
|
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
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
-
|
58
|
-
|
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
|
-
|
65
|
-
|
66
|
-
|
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
|
-
|
73
|
-
|
74
|
-
|
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
|
-
#
|
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
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
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
|
-
|
96
|
-
|
97
|
-
|
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
|
-
|
104
|
-
|
105
|
-
|
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
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
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
|
-
|
131
|
-
|
132
|
-
|
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
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
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
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
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
|
-
|
170
|
-
|
171
|
-
|
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
|
-
|
178
|
-
|
179
|
-
|
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
|
-
|
185
|
-
|
186
|
-
|
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
|
-
|
197
|
-
|
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
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
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(
|
364
|
+
def get_user_completion_records(_user_id, start_expiry = '', end_expiry = '',
|
223
365
|
bookmark = '')
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
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
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
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
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
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
|
-
|
262
|
-
|
263
|
-
|
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
|
-
|
274
|
-
|
275
|
-
|
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
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
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
|
-
|
298
|
-
|
299
|
-
|
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
|
-
|
306
|
-
|
307
|
-
|
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
|
-
|
314
|
-
|
315
|
-
|
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
|
-
|
322
|
-
|
323
|
-
|
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
|
-
|
334
|
-
|
335
|
-
|
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
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
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
|
-
|
351
|
-
|
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
|