ims_caliper 0.1.3 → 0.9.0
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.
- checksums.yaml +5 -13
- data/.gitignore +3 -0
- data/LICENSE +156 -58
- data/NOTICE +42 -8
- data/README.md +2 -2
- data/lib/caliper/defaults.rb +21 -1
- data/lib/caliper/entities/agent/organization.rb +37 -0
- data/lib/caliper/entities/agent/person.rb +38 -0
- data/lib/caliper/entities/agent/software_application.rb +39 -0
- data/lib/caliper/entities/annotation/annotation.rb +21 -11
- data/lib/caliper/entities/annotation/bookmark_annotation.rb +19 -9
- data/lib/caliper/entities/annotation/highlight_annotation.rb +19 -8
- data/lib/caliper/entities/annotation/shared_annotation.rb +19 -9
- data/lib/caliper/entities/annotation/tag_annotation.rb +19 -9
- data/lib/caliper/entities/assessment/assessment.rb +19 -9
- data/lib/caliper/entities/assessment/assessment_item.rb +19 -8
- data/lib/caliper/entities/assignable/assignable_digital_resource.rb +19 -11
- data/lib/caliper/entities/assignable/attempt.rb +21 -8
- data/lib/caliper/entities/digital_resource.rb +29 -18
- data/lib/caliper/entities/entity.rb +27 -13
- data/lib/caliper/entities/foaf/agent.rb +22 -3
- data/lib/caliper/entities/generatable.rb +21 -2
- data/lib/caliper/entities/jsonable.rb +17 -5
- data/lib/caliper/entities/learning_context.rb +30 -9
- data/lib/caliper/entities/learning_objective.rb +19 -12
- data/lib/caliper/entities/lis/course_offering.rb +23 -13
- data/lib/caliper/entities/lis/course_section.rb +20 -13
- data/lib/caliper/entities/lis/group.rb +23 -13
- data/lib/caliper/entities/lis/membership.rb +22 -16
- data/lib/caliper/entities/lis/roles.rb +18 -6
- data/lib/caliper/entities/lis/status.rb +18 -6
- data/lib/caliper/entities/media/audio_object.rb +21 -7
- data/lib/caliper/entities/media/image_object.rb +21 -7
- data/lib/caliper/entities/media/media_location.rb +19 -4
- data/lib/caliper/entities/media/media_object.rb +19 -8
- data/lib/caliper/entities/media/video_object.rb +21 -7
- data/lib/caliper/entities/outcome/result.rb +23 -2
- data/lib/caliper/entities/reading/epub_chapter.rb +23 -7
- data/lib/caliper/entities/reading/epub_part.rb +24 -8
- data/lib/caliper/entities/reading/epub_sub_chapter.rb +22 -5
- data/lib/caliper/entities/reading/epub_volume.rb +20 -12
- data/lib/caliper/entities/reading/frame.rb +22 -6
- data/lib/caliper/entities/reading/web_page.rb +37 -0
- data/lib/caliper/entities/response/fillin_blank_response.rb +21 -3
- data/lib/caliper/entities/response/multiple_choice_response.rb +20 -3
- data/lib/caliper/entities/response/multiple_response_response.rb +20 -3
- data/lib/caliper/entities/response/response.rb +24 -3
- data/lib/caliper/entities/response/response_type.rb +20 -0
- data/lib/caliper/entities/response/select_type_response.rb +23 -5
- data/lib/caliper/entities/response/true_false_response.rb +20 -3
- data/lib/caliper/entities/schemadotorg/creative_work.rb +22 -2
- data/lib/caliper/entities/schemadotorg/software_application.rb +22 -2
- data/lib/caliper/entities/schemadotorg/thing.rb +19 -0
- data/lib/caliper/entities/schemadotorg/web_page.rb +22 -2
- data/lib/caliper/entities/session/session.rb +44 -0
- data/lib/caliper/entities/targetable.rb +19 -3
- data/lib/caliper/entities/w3c/membership.rb +32 -0
- data/lib/caliper/entities/w3c/organization.rb +30 -0
- data/lib/caliper/entity_envelope.rb +20 -7
- data/lib/caliper/event/annotation_event.rb +21 -6
- data/lib/caliper/event/assessment_event.rb +22 -2
- data/lib/caliper/event/assessment_item_event.rb +22 -2
- data/lib/caliper/event/assignable_event.rb +22 -2
- data/lib/caliper/event/event.rb +23 -1
- data/lib/caliper/event/jsonable.rb +18 -6
- data/lib/caliper/event/media_event.rb +22 -2
- data/lib/caliper/event/navigation_event.rb +22 -3
- data/lib/caliper/event/outcome_event.rb +22 -3
- data/lib/caliper/event/session_event.rb +21 -7
- data/lib/caliper/event/view_event.rb +22 -8
- data/lib/caliper/event_envelope.rb +20 -8
- data/lib/caliper/jsonable.rb +24 -7
- data/lib/caliper/options.rb +21 -2
- data/lib/caliper/profiles/annotation_profile.rb +21 -3
- data/lib/caliper/profiles/assessment_item_profile.rb +48 -0
- data/lib/caliper/profiles/assessment_profile.rb +22 -23
- data/lib/caliper/profiles/assignable_profile.rb +21 -4
- data/lib/caliper/profiles/media_profile.rb +20 -3
- data/lib/caliper/profiles/profile.rb +20 -24
- data/lib/caliper/profiles/reading_profile.rb +21 -4
- data/lib/caliper/profiles/session_profile.rb +20 -2
- data/lib/caliper/request/event_store_envelope.rb +20 -2
- data/lib/caliper/request/event_store_requestor.rb +21 -2
- data/lib/caliper/request/http_requestor.rb +28 -9
- data/lib/caliper/sensor.rb +21 -11
- data/lib/caliper/stats/atomic_wrapper.rb +21 -4
- data/lib/caliper/stats/statistic.rb +21 -1
- data/lib/caliper/stats/statistics.rb +20 -2
- data/lib/caliper/stats/statistics_map.rb +20 -0
- data/lib/caliper/validators/error_message.rb +20 -0
- data/lib/caliper/validators/event_validator.rb +20 -0
- data/lib/caliper/validators/event_validator_context.rb +21 -1
- data/lib/caliper/validators/property_type_check.rb +23 -4
- data/lib/caliper/validators/session_login_event_validator.rb +39 -21
- data/lib/caliper/validators/session_logout_event_validator.rb +31 -13
- data/lib/caliper/validators/time_check.rb +20 -0
- data/lib/caliper/version.rb +22 -3
- data/lib/caliper.rb +18 -1
- data/spec/lib/entities/{lis → agent}/person_spec.rb +26 -6
- data/spec/lib/entities/{lis → agent}/student.json +0 -0
- data/spec/lib/entities/entity_spec.rb +19 -4
- data/spec/lib/event/annotation_event_bookmark_spec.rb +23 -8
- data/spec/lib/event/annotation_event_highlight_spec.rb +23 -8
- data/spec/lib/event/annotation_event_shared_spec.rb +25 -10
- data/spec/lib/event/annotation_event_tag_spec.rb +23 -8
- data/spec/lib/event/assessment_event_spec.rb +22 -8
- data/spec/lib/event/assessment_item_completed_event_spec.rb +24 -10
- data/spec/lib/event/assessment_item_started_event_spec.rb +24 -10
- data/spec/lib/event/assignable_event_spec.rb +225 -0
- data/spec/lib/event/media_event_spec.rb +22 -7
- data/spec/lib/event/navigated_event_spec.rb +26 -11
- data/spec/lib/event/session_event_login_spec.rb +26 -12
- data/spec/lib/event/session_event_logout_spec.rb +25 -12
- data/spec/lib/event/session_event_timeout_spec.rb +25 -12
- data/spec/lib/event/viewed_event_spec.rb +23 -8
- data/spec/lib/event_helper.rb +25 -9
- data/spec/lib/sensor_spec.rb +43 -13
- data/spec/spec_helper.rb +18 -3
- metadata +19 -22
- data/.idea/caliper-ruby.iml +0 -156
- data/.idea/encodings.xml +0 -5
- data/.idea/misc.xml +0 -5
- data/.idea/modules.xml +0 -9
- data/.idea/scopes/scope_settings.xml +0 -5
- data/.idea/vcs.xml +0 -7
- data/lib/caliper/entities/lis/organization.rb +0 -25
- data/lib/caliper/entities/lis/person.rb +0 -25
- data/lib/caliper/entities/session.rb +0 -34
- data/lib/caliper/entities/software_application.rb +0 -28
- data/lib/caliper/entities/web_page.rb +0 -15
- data/spec/lib/request/http_request_spec.rb +0 -216
@@ -1,7 +1,24 @@
|
|
1
|
+
##
|
2
|
+
# This file is part of IMS Caliper Analytics™ and is licensed to
|
3
|
+
# IMS Global Learning Consortium, Inc. (http://www.imsglobal.org)
|
4
|
+
# under one or more contributor license agreements. See the NOTICE
|
5
|
+
# file distributed with this work for additional information.
|
6
|
+
#
|
7
|
+
# IMS Caliper is free software: you can redistribute it and/or modify it under
|
8
|
+
# the terms of the GNU Lesser General Public License as published by the Free
|
9
|
+
# Software Foundation, version 3 of the License.
|
10
|
+
#
|
11
|
+
# IMS Caliper is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
13
|
+
# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public License along
|
16
|
+
# with this program. If not, see http://www.gnu.org/licenses/.
|
17
|
+
|
1
18
|
require 'require_all'
|
2
19
|
require_all 'lib/caliper/entities/entity.rb'
|
3
|
-
require_all 'lib/caliper/entities/software_application.rb'
|
4
|
-
require_all 'lib/caliper/entities/
|
20
|
+
require_all 'lib/caliper/entities/agent/software_application.rb'
|
21
|
+
require_all 'lib/caliper/entities/agent/person.rb'
|
5
22
|
require_all 'lib/caliper/entities/lis/membership.rb'
|
6
23
|
require_all 'lib/caliper/entities/lis/roles.rb'
|
7
24
|
require_all 'lib/caliper/entities/lis/status.rb'
|
@@ -19,10 +36,10 @@ module Caliper
|
|
19
36
|
|
20
37
|
describe AnnotationEvent do
|
21
38
|
|
22
|
-
it 'should ensure that a AnnotationEvent
|
39
|
+
it 'should ensure that a Tagged AnnotationEvent is correctly created and serialized' do
|
23
40
|
|
24
41
|
# The Actor (Person/Student))
|
25
|
-
student = Caliper::Entities::
|
42
|
+
student = Caliper::Entities::Agent::Person.new
|
26
43
|
student.id = 'https://some-university.edu/user/554433'
|
27
44
|
membership1 = Caliper::Entities::LIS::Membership.new
|
28
45
|
membership1.id = "https://some-university.edu/membership/001"
|
@@ -84,7 +101,7 @@ module Caliper
|
|
84
101
|
tag.tags = ["to-read", "1765", "shared-with-project-team"]
|
85
102
|
|
86
103
|
# The course that is part of the Learning Context (edApp)
|
87
|
-
edApp = Caliper::Entities::SoftwareApplication.new
|
104
|
+
edApp = Caliper::Entities::Agent::SoftwareApplication.new
|
88
105
|
edApp.id = 'https://github.com/readium/readium-js-viewer'
|
89
106
|
edApp.name = 'Readium'
|
90
107
|
edApp.hasMembership = []
|
@@ -151,9 +168,7 @@ module Caliper
|
|
151
168
|
|
152
169
|
# Ensure that the deserialized tag event object conforms
|
153
170
|
expect(annotation_event).to eql(deser_annotation_event)
|
154
|
-
|
155
171
|
end
|
156
|
-
|
157
172
|
end
|
158
173
|
end
|
159
|
-
end
|
174
|
+
end
|
@@ -1,14 +1,30 @@
|
|
1
|
+
##
|
2
|
+
# This file is part of IMS Caliper Analytics™ and is licensed to
|
3
|
+
# IMS Global Learning Consortium, Inc. (http://www.imsglobal.org)
|
4
|
+
# under one or more contributor license agreements. See the NOTICE
|
5
|
+
# file distributed with this work for additional information.
|
6
|
+
#
|
7
|
+
# IMS Caliper is free software: you can redistribute it and/or modify it under
|
8
|
+
# the terms of the GNU Lesser General Public License as published by the Free
|
9
|
+
# Software Foundation, version 3 of the License.
|
10
|
+
#
|
11
|
+
# IMS Caliper is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
13
|
+
# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public License along
|
16
|
+
# with this program. If not, see http://www.gnu.org/licenses/.
|
17
|
+
|
1
18
|
require 'require_all'
|
2
19
|
require_all 'lib/caliper/entities/entity.rb'
|
3
|
-
require_all 'lib/caliper/entities/software_application.rb'
|
4
|
-
require_all 'lib/caliper/entities/
|
20
|
+
require_all 'lib/caliper/entities/agent/software_application.rb'
|
21
|
+
require_all 'lib/caliper/entities/agent/person.rb'
|
5
22
|
require_all 'lib/caliper/entities/lis/membership.rb'
|
6
23
|
require_all 'lib/caliper/entities/lis/roles.rb'
|
7
24
|
require_all 'lib/caliper/entities/lis/status.rb'
|
8
25
|
require_all 'lib/caliper/entities/lis/course_section.rb'
|
9
26
|
require_all 'lib/caliper/entities/lis/course_offering.rb'
|
10
27
|
require_all 'lib/caliper/entities/lis/group.rb'
|
11
|
-
require_all 'lib/caliper/entities/reading/epub_volume.rb'
|
12
28
|
require_all 'lib/caliper/entities/assessment/assessment.rb'
|
13
29
|
require_all 'lib/caliper/entities/assessment/assessment_item.rb'
|
14
30
|
require_all 'lib/caliper/entities/assignable/attempt.rb'
|
@@ -25,7 +41,7 @@ module Caliper
|
|
25
41
|
it 'should ensure that a AssessmentEvent is correctly created and serialized' do
|
26
42
|
|
27
43
|
# The Actor = Person/Student))
|
28
|
-
student = Caliper::Entities::
|
44
|
+
student = Caliper::Entities::Agent::Person.new
|
29
45
|
student.id = 'https://some-university.edu/user/554433'
|
30
46
|
membership1 = Caliper::Entities::LIS::Membership.new
|
31
47
|
membership1.id = "https://some-university.edu/membership/001"
|
@@ -132,7 +148,7 @@ module Caliper
|
|
132
148
|
attempt.name = nil
|
133
149
|
|
134
150
|
# The Object (edApp)
|
135
|
-
edApp = Caliper::Entities::SoftwareApplication.new
|
151
|
+
edApp = Caliper::Entities::Agent::SoftwareApplication.new
|
136
152
|
edApp.id = 'https://com.sat/super-assessment-tool'
|
137
153
|
edApp.name = 'Super Assessment Tool'
|
138
154
|
edApp.hasMembership = []
|
@@ -199,9 +215,7 @@ module Caliper
|
|
199
215
|
|
200
216
|
# Ensure that the deserialized bookmark event object conforms
|
201
217
|
expect(assessment_event).to eql(deser_assessment_event)
|
202
|
-
|
203
218
|
end
|
204
|
-
|
205
219
|
end
|
206
220
|
end
|
207
|
-
end
|
221
|
+
end
|
@@ -1,14 +1,30 @@
|
|
1
|
+
##
|
2
|
+
# This file is part of IMS Caliper Analytics™ and is licensed to
|
3
|
+
# IMS Global Learning Consortium, Inc. (http://www.imsglobal.org)
|
4
|
+
# under one or more contributor license agreements. See the NOTICE
|
5
|
+
# file distributed with this work for additional information.
|
6
|
+
#
|
7
|
+
# IMS Caliper is free software: you can redistribute it and/or modify it under
|
8
|
+
# the terms of the GNU Lesser General Public License as published by the Free
|
9
|
+
# Software Foundation, version 3 of the License.
|
10
|
+
#
|
11
|
+
# IMS Caliper is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
13
|
+
# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public License along
|
16
|
+
# with this program. If not, see http://www.gnu.org/licenses/.
|
17
|
+
|
1
18
|
require 'require_all'
|
2
19
|
require_all 'lib/caliper/entities/entity.rb'
|
3
|
-
require_all 'lib/caliper/entities/software_application.rb'
|
4
|
-
require_all 'lib/caliper/entities/
|
20
|
+
require_all 'lib/caliper/entities/agent/software_application.rb'
|
21
|
+
require_all 'lib/caliper/entities/agent/person.rb'
|
5
22
|
require_all 'lib/caliper/entities/lis/membership.rb'
|
6
23
|
require_all 'lib/caliper/entities/lis/roles.rb'
|
7
24
|
require_all 'lib/caliper/entities/lis/status.rb'
|
8
25
|
require_all 'lib/caliper/entities/lis/course_section.rb'
|
9
26
|
require_all 'lib/caliper/entities/lis/course_offering.rb'
|
10
27
|
require_all 'lib/caliper/entities/lis/group.rb'
|
11
|
-
require_all 'lib/caliper/entities/reading/epub_volume.rb'
|
12
28
|
require_all 'lib/caliper/entities/assessment/assessment.rb'
|
13
29
|
require_all 'lib/caliper/entities/assessment/assessment_item.rb'
|
14
30
|
require_all 'lib/caliper/entities/assignable/attempt.rb'
|
@@ -16,7 +32,7 @@ require_all 'lib/caliper/entities/assignable/assignable_digital_resource.rb'
|
|
16
32
|
require_all 'lib/caliper/entities/response/Response.rb'
|
17
33
|
require_all 'lib/caliper/entities/response/fillin_blank_response.rb'
|
18
34
|
require_all 'lib/caliper/event/assessment_item_event.rb'
|
19
|
-
require_all 'lib/caliper/profiles/
|
35
|
+
require_all 'lib/caliper/profiles/assessment_item_profile.rb'
|
20
36
|
require 'json_spec'
|
21
37
|
|
22
38
|
module Caliper
|
@@ -24,10 +40,10 @@ module Caliper
|
|
24
40
|
|
25
41
|
describe AssessmentItemEvent do
|
26
42
|
|
27
|
-
it 'should ensure that a AssessmentItemEvent
|
43
|
+
it 'should ensure that a Completed AssessmentItemEvent is correctly created and serialized' do
|
28
44
|
|
29
45
|
# The Actor = Person/Student))
|
30
|
-
student = Caliper::Entities::
|
46
|
+
student = Caliper::Entities::Agent::Person.new
|
31
47
|
student.id = 'https://some-university.edu/user/554433'
|
32
48
|
membership1 = Caliper::Entities::LIS::Membership.new
|
33
49
|
membership1.id = "https://some-university.edu/membership/001"
|
@@ -148,7 +164,7 @@ module Caliper
|
|
148
164
|
response.values = ["2 July 1776"]
|
149
165
|
|
150
166
|
# The Object (edApp)
|
151
|
-
edApp = Caliper::Entities::SoftwareApplication.new
|
167
|
+
edApp = Caliper::Entities::Agent::SoftwareApplication.new
|
152
168
|
edApp.id = 'https://com.sat/super-assessment-tool'
|
153
169
|
edApp.name = 'Super Assessment Tool'
|
154
170
|
edApp.hasMembership = []
|
@@ -215,9 +231,7 @@ module Caliper
|
|
215
231
|
|
216
232
|
# Ensure that the deserialized bookmark event object conforms
|
217
233
|
expect(assessment_event).to eql(deser_assessment_event)
|
218
|
-
|
219
234
|
end
|
220
|
-
|
221
235
|
end
|
222
236
|
end
|
223
|
-
end
|
237
|
+
end
|
@@ -1,20 +1,36 @@
|
|
1
|
+
##
|
2
|
+
# This file is part of IMS Caliper Analytics™ and is licensed to
|
3
|
+
# IMS Global Learning Consortium, Inc. (http://www.imsglobal.org)
|
4
|
+
# under one or more contributor license agreements. See the NOTICE
|
5
|
+
# file distributed with this work for additional information.
|
6
|
+
#
|
7
|
+
# IMS Caliper is free software: you can redistribute it and/or modify it under
|
8
|
+
# the terms of the GNU Lesser General Public License as published by the Free
|
9
|
+
# Software Foundation, version 3 of the License.
|
10
|
+
#
|
11
|
+
# IMS Caliper is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
13
|
+
# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public License along
|
16
|
+
# with this program. If not, see http://www.gnu.org/licenses/.
|
17
|
+
|
1
18
|
require 'require_all'
|
2
19
|
require_all 'lib/caliper/entities/entity.rb'
|
3
|
-
require_all 'lib/caliper/entities/software_application.rb'
|
4
|
-
require_all 'lib/caliper/entities/
|
20
|
+
require_all 'lib/caliper/entities/agent/software_application.rb'
|
21
|
+
require_all 'lib/caliper/entities/agent/person.rb'
|
5
22
|
require_all 'lib/caliper/entities/lis/membership.rb'
|
6
23
|
require_all 'lib/caliper/entities/lis/roles.rb'
|
7
24
|
require_all 'lib/caliper/entities/lis/status.rb'
|
8
25
|
require_all 'lib/caliper/entities/lis/course_section.rb'
|
9
26
|
require_all 'lib/caliper/entities/lis/course_offering.rb'
|
10
27
|
require_all 'lib/caliper/entities/lis/group.rb'
|
11
|
-
require_all 'lib/caliper/entities/reading/epub_volume.rb'
|
12
28
|
require_all 'lib/caliper/entities/assessment/assessment.rb'
|
13
29
|
require_all 'lib/caliper/entities/assessment/assessment_item.rb'
|
14
30
|
require_all 'lib/caliper/entities/assignable/attempt.rb'
|
15
31
|
require_all 'lib/caliper/entities/assignable/assignable_digital_resource.rb'
|
16
32
|
require_all 'lib/caliper/event/assessment_item_event.rb'
|
17
|
-
require_all 'lib/caliper/profiles/
|
33
|
+
require_all 'lib/caliper/profiles/assessment_item_profile.rb'
|
18
34
|
require 'json_spec'
|
19
35
|
|
20
36
|
module Caliper
|
@@ -22,10 +38,10 @@ module Caliper
|
|
22
38
|
|
23
39
|
describe AssessmentItemEvent do
|
24
40
|
|
25
|
-
it 'should ensure that a AssessmentItemEvent
|
41
|
+
it 'should ensure that a Started AssessmentItemEvent is correctly created and serialized' do
|
26
42
|
|
27
43
|
# The Actor = Person/Student))
|
28
|
-
student = Caliper::Entities::
|
44
|
+
student = Caliper::Entities::Agent::Person.new
|
29
45
|
student.id = 'https://some-university.edu/user/554433'
|
30
46
|
membership1 = Caliper::Entities::LIS::Membership.new
|
31
47
|
membership1.id = "https://some-university.edu/membership/001"
|
@@ -132,7 +148,7 @@ module Caliper
|
|
132
148
|
attempt.name = nil
|
133
149
|
|
134
150
|
# The Object (edApp)
|
135
|
-
edApp = Caliper::Entities::SoftwareApplication.new
|
151
|
+
edApp = Caliper::Entities::Agent::SoftwareApplication.new
|
136
152
|
edApp.id = 'https://com.sat/super-assessment-tool'
|
137
153
|
edApp.name = 'Super Assessment Tool'
|
138
154
|
edApp.hasMembership = []
|
@@ -199,9 +215,7 @@ module Caliper
|
|
199
215
|
|
200
216
|
# Ensure that the deserialized bookmark event object conforms
|
201
217
|
expect(assessment_item_started_event).to eql(deser_assessment_item_started_event)
|
202
|
-
|
203
218
|
end
|
204
|
-
|
205
219
|
end
|
206
220
|
end
|
207
|
-
end
|
221
|
+
end
|
@@ -0,0 +1,225 @@
|
|
1
|
+
##
|
2
|
+
# This file is part of IMS Caliper Analytics™ and is licensed to
|
3
|
+
# IMS Global Learning Consortium, Inc. (http://www.imsglobal.org)
|
4
|
+
# under one or more contributor license agreements. See the NOTICE
|
5
|
+
# file distributed with this work for additional information.
|
6
|
+
#
|
7
|
+
# IMS Caliper is free software: you can redistribute it and/or modify it under
|
8
|
+
# the terms of the GNU Lesser General Public License as published by the Free
|
9
|
+
# Software Foundation, version 3 of the License.
|
10
|
+
#
|
11
|
+
# IMS Caliper is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
13
|
+
# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public License along
|
16
|
+
# with this program. If not, see http://www.gnu.org/licenses/.
|
17
|
+
|
18
|
+
require 'require_all'
|
19
|
+
require_all 'lib/caliper/entities/entity.rb'
|
20
|
+
require_all 'lib/caliper/entities/agent/software_application.rb'
|
21
|
+
require_all 'lib/caliper/entities/agent/person.rb'
|
22
|
+
require_all 'lib/caliper/entities/lis/membership.rb'
|
23
|
+
require_all 'lib/caliper/entities/lis/roles.rb'
|
24
|
+
require_all 'lib/caliper/entities/lis/status.rb'
|
25
|
+
require_all 'lib/caliper/entities/lis/course_section.rb'
|
26
|
+
require_all 'lib/caliper/entities/lis/course_offering.rb'
|
27
|
+
require_all 'lib/caliper/entities/lis/group.rb'
|
28
|
+
require_all 'lib/caliper/entities/assessment/assessment.rb'
|
29
|
+
require_all 'lib/caliper/entities/assessment/assessment_item.rb'
|
30
|
+
require_all 'lib/caliper/entities/assignable/attempt.rb'
|
31
|
+
require_all 'lib/caliper/entities/assignable/assignable_digital_resource.rb'
|
32
|
+
require_all 'lib/caliper/event/assignable_event.rb'
|
33
|
+
require_all 'lib/caliper/profiles/assignable_profile.rb'
|
34
|
+
require 'json_spec'
|
35
|
+
|
36
|
+
module Caliper
|
37
|
+
module Event
|
38
|
+
|
39
|
+
describe AssignableEvent do
|
40
|
+
|
41
|
+
it 'should ensure that an AssignableEvent is correctly created and serialized' do
|
42
|
+
|
43
|
+
# The Actor = Person/Student))
|
44
|
+
student = Caliper::Entities::Agent::Person.new
|
45
|
+
student.id = 'https://some-university.edu/user/554433'
|
46
|
+
|
47
|
+
membership1 = Caliper::Entities::LIS::Membership.new
|
48
|
+
membership1.id = "https://some-university.edu/membership/001"
|
49
|
+
membership1.member = "https://some-university.edu/user/554433"
|
50
|
+
membership1.organization = "https://some-university.edu/politicalScience/2015/american-revolution-101"
|
51
|
+
membership1.roles = [Caliper::Entities::LIS::Roles::LEARNER]
|
52
|
+
membership1.status = Caliper::Entities::LIS::Status::ACTIVE
|
53
|
+
membership1.dateCreated = "2015-08-01T06:00:00.000Z"
|
54
|
+
membership1.dateModified = nil;
|
55
|
+
|
56
|
+
membership2 = Caliper::Entities::LIS::Membership.new
|
57
|
+
membership2.id = "https://some-university.edu/membership/002"
|
58
|
+
membership2.member = "https://some-university.edu/user/554433"
|
59
|
+
membership2.organization = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001"
|
60
|
+
membership2.roles = [Caliper::Entities::LIS::Roles::LEARNER]
|
61
|
+
membership2.status = Caliper::Entities::LIS::Status::ACTIVE
|
62
|
+
membership2.dateCreated = "2015-08-01T06:00:00.000Z"
|
63
|
+
membership2.dateModified = nil
|
64
|
+
|
65
|
+
membership3 = Caliper::Entities::LIS::Membership.new
|
66
|
+
membership3.id = "https://some-university.edu/membership/003"
|
67
|
+
membership3.member = "https://some-university.edu/user/554433"
|
68
|
+
membership3.organization = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
69
|
+
membership3.roles = [Caliper::Entities::LIS::Roles::LEARNER]
|
70
|
+
membership3.status = Caliper::Entities::LIS::Status::ACTIVE
|
71
|
+
membership3.dateCreated = "2015-08-01T06:00:00.000Z"
|
72
|
+
membership3.dateModified = nil
|
73
|
+
|
74
|
+
student.hasMembership = [membership1, membership2, membership3]
|
75
|
+
student.dateCreated = '2015-08-01T06:00:00.000Z'
|
76
|
+
student.dateModified = '2015-09-02T11:30:00.000Z'
|
77
|
+
# puts "new student = #{student.to_json}"
|
78
|
+
|
79
|
+
# The Action
|
80
|
+
action = Caliper::Profiles::AssignableActions::ACTIVATED
|
81
|
+
|
82
|
+
# The Object (Assessment)
|
83
|
+
assessment = Caliper::Entities::Assessment::Assessment.new
|
84
|
+
assessment.id = "https://some-university.edu/politicalScience/2015/american-revolution-101/assessment1"
|
85
|
+
assessment.name = "American Revolution - Key Figures Assessment"
|
86
|
+
assessment.dateModified = '2015-09-02T11:30:00.000Z'
|
87
|
+
assessment.dateCreated = '2015-08-01T06:00:00.000Z'
|
88
|
+
assessment.datePublished = '2015-08-15T09:30:00.000Z'
|
89
|
+
assessment.version = "1.0"
|
90
|
+
assessment.dateToActivate = '2015-08-16T05:00:00.000Z'
|
91
|
+
assessment.dateToShow = '2015-08-16T05:00:00.000Z'
|
92
|
+
assessment.dateToStartOn = "2015-08-16T05:00:00.000Z"
|
93
|
+
assessment.dateToSubmit = "2015-09-28T11:59:59.000Z"
|
94
|
+
assessment.maxAttempts = 2
|
95
|
+
assessment.maxSubmits = 2
|
96
|
+
assessment.maxScore = 3.0
|
97
|
+
|
98
|
+
# The Assessment has three items
|
99
|
+
assessmentItem1 = Caliper::Entities::Assessment::AssessmentItem.new
|
100
|
+
assessmentItem1.id = "https://some-university.edu/politicalScience/2015/american-revolution-101/assessment1/item1"
|
101
|
+
assessmentItem1.name = "Assessment Item 1"
|
102
|
+
assessmentItem1.isPartOf = assessment.id
|
103
|
+
assessmentItem1.maxAttempts = 2
|
104
|
+
assessmentItem1.maxSubmits = 2
|
105
|
+
assessmentItem1.maxScore = 1.0
|
106
|
+
assessmentItem1.dateCreated = nil
|
107
|
+
assessmentItem1.dateModified = nil
|
108
|
+
assessmentItem1.version = "1.0"
|
109
|
+
assessmentItem1.isTimeDependent = false
|
110
|
+
|
111
|
+
assessmentItem2 = Caliper::Entities::Assessment::AssessmentItem.new
|
112
|
+
assessmentItem2.id = "https://some-university.edu/politicalScience/2015/american-revolution-101/assessment1/item2"
|
113
|
+
assessmentItem2.name = "Assessment Item 2"
|
114
|
+
assessmentItem2.isPartOf = assessment.id
|
115
|
+
assessmentItem2.maxAttempts = 2
|
116
|
+
assessmentItem2.maxSubmits = 2
|
117
|
+
assessmentItem2.maxScore = 1.0
|
118
|
+
assessmentItem2.dateCreated = nil
|
119
|
+
assessmentItem2.dateModified = nil
|
120
|
+
assessmentItem2.version = "1.0"
|
121
|
+
assessmentItem2.isTimeDependent = false
|
122
|
+
|
123
|
+
assessmentItem3 = Caliper::Entities::Assessment::AssessmentItem.new
|
124
|
+
assessmentItem3.id = "https://some-university.edu/politicalScience/2015/american-revolution-101/assessment1/item3"
|
125
|
+
assessmentItem3.name = "Assessment Item 3"
|
126
|
+
assessmentItem3.isPartOf = assessment.id
|
127
|
+
assessmentItem3.maxAttempts = 2
|
128
|
+
assessmentItem3.maxSubmits = 2
|
129
|
+
assessmentItem3.maxScore = 1.0
|
130
|
+
assessmentItem3.dateCreated = nil
|
131
|
+
assessmentItem3.dateModified = nil
|
132
|
+
assessmentItem3.version = "1.0"
|
133
|
+
assessmentItem3.isTimeDependent = false
|
134
|
+
|
135
|
+
assessment.assessmentItems = [assessmentItem1, assessmentItem2, assessmentItem3]
|
136
|
+
|
137
|
+
# The Event target
|
138
|
+
target = nil;
|
139
|
+
|
140
|
+
# The generated attempt
|
141
|
+
attempt = Caliper::Entities::Assignable::Attempt.new
|
142
|
+
attempt.id = "https://some-university.edu/politicalScience/2015/american-revolution-101/assessment1/attempt1"
|
143
|
+
attempt.actor = "https://some-university.edu/user/554433"
|
144
|
+
attempt.assignable = "https://some-university.edu/politicalScience/2015/american-revolution-101/assessment1"
|
145
|
+
attempt.dateCreated = "2015-08-01T06:00:00.000Z"
|
146
|
+
attempt.dateModified = nil
|
147
|
+
attempt.count = 1
|
148
|
+
attempt.startedAtTime = "2015-09-15T10:15:00.000Z"
|
149
|
+
attempt.duration = nil
|
150
|
+
attempt.endedAtTime = nil
|
151
|
+
attempt.extensions = {}
|
152
|
+
attempt.name = nil
|
153
|
+
|
154
|
+
# The edApp
|
155
|
+
edApp = Caliper::Entities::Agent::SoftwareApplication.new
|
156
|
+
edApp.id = 'https://com.sat/super-assessment-tool'
|
157
|
+
edApp.name = 'Super Assessment Tool'
|
158
|
+
edApp.hasMembership = []
|
159
|
+
edApp.dateCreated = '2015-08-01T06:00:00.000Z'
|
160
|
+
edApp.dateModified = nil
|
161
|
+
|
162
|
+
#LIS Course Offering
|
163
|
+
courseOffering = Caliper::Entities::LIS::CourseOffering.new
|
164
|
+
courseOffering.id = "https://some-university.edu/politicalScience/2015/american-revolution-101"
|
165
|
+
courseOffering.name = "Political Science 101: The American Revolution"
|
166
|
+
courseOffering.courseNumber = "POL101"
|
167
|
+
courseOffering.academicSession = "Fall-2015"
|
168
|
+
courseOffering.membership = []
|
169
|
+
courseOffering.subOrganizationOf = nil
|
170
|
+
courseOffering.dateCreated = '2015-08-01T06:00:00.000Z'
|
171
|
+
courseOffering.dateModified = '2015-09-02T11:30:00.000Z'
|
172
|
+
|
173
|
+
# The LIS Course Section for the Caliper Event
|
174
|
+
course = Caliper::Entities::LIS::CourseSection.new
|
175
|
+
course.id = 'https://some-university.edu/politicalScience/2015/american-revolution-101/section/001'
|
176
|
+
course.name = 'American Revolution 101'
|
177
|
+
course.courseNumber = "POL101"
|
178
|
+
course.academicSession = "Fall-2015"
|
179
|
+
course.category = nil
|
180
|
+
course.membership = [membership2]
|
181
|
+
course.subOrganizationOf = courseOffering
|
182
|
+
course.dateCreated = '2015-08-01T06:00:00.000Z'
|
183
|
+
course.dateModified = '2015-09-02T11:30:00.000Z'
|
184
|
+
|
185
|
+
# LIS Group
|
186
|
+
group = Caliper::Entities::LIS::Group.new
|
187
|
+
group.id = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
188
|
+
group.name = "Discussion Group 001"
|
189
|
+
group.membership = [membership3]
|
190
|
+
group.subOrganizationOf = course
|
191
|
+
group.dateCreated = '2015-08-01T06:00:00.000Z'
|
192
|
+
group.dateModified = nil
|
193
|
+
|
194
|
+
# The Assignable Event
|
195
|
+
assignable_event = AssignableEvent.new
|
196
|
+
assignable_event.actor = student
|
197
|
+
assignable_event.action = action
|
198
|
+
assignable_event.object = assessment
|
199
|
+
assignable_event.target = nil
|
200
|
+
assignable_event.generated = attempt
|
201
|
+
assignable_event.edApp = edApp
|
202
|
+
assignable_event.group = group
|
203
|
+
assignable_event.startedAtTime = '2015-09-15T10:15:00.000Z'
|
204
|
+
assignable_event.endedAtTime = nil
|
205
|
+
assignable_event.duration = nil
|
206
|
+
# puts "Event JSON = #{assignable_event.to_json}'"
|
207
|
+
|
208
|
+
# Load JSON from caliper-common-fixtures for comparison
|
209
|
+
# NOTE - sym link to caliper-common-fixtures needs to exist under spec/fixtures
|
210
|
+
file = File.read('spec/fixtures/caliperAssignableEvent.json')
|
211
|
+
data_hash = JSON.parse(file)
|
212
|
+
expected_json = data_hash.to_json # convert hash back to JSON string after parse
|
213
|
+
assignable_event.to_json.should be_json_eql(expected_json)#.excluding("actor", "action", "object", "target", "generated", "edApp", "group")
|
214
|
+
|
215
|
+
# puts "JSON from file = #{data_hash}"
|
216
|
+
deser_assignable_event = AssignableEvent.new
|
217
|
+
deser_assignable_event.from_json data_hash
|
218
|
+
# puts "AssignableEvent from JSON = #{deser_assignable_event.to_json}"
|
219
|
+
|
220
|
+
# Ensure that the deserialized bookmark event object conforms
|
221
|
+
expect(assignable_event).to eql(deser_assignable_event)
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
@@ -1,8 +1,25 @@
|
|
1
|
+
##
|
2
|
+
# This file is part of IMS Caliper Analytics™ and is licensed to
|
3
|
+
# IMS Global Learning Consortium, Inc. (http://www.imsglobal.org)
|
4
|
+
# under one or more contributor license agreements. See the NOTICE
|
5
|
+
# file distributed with this work for additional information.
|
6
|
+
#
|
7
|
+
# IMS Caliper is free software: you can redistribute it and/or modify it under
|
8
|
+
# the terms of the GNU Lesser General Public License as published by the Free
|
9
|
+
# Software Foundation, version 3 of the License.
|
10
|
+
#
|
11
|
+
# IMS Caliper is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
13
|
+
# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public License along
|
16
|
+
# with this program. If not, see http://www.gnu.org/licenses/.
|
17
|
+
|
1
18
|
require 'require_all'
|
2
19
|
require_all 'lib/caliper/entities/entity.rb'
|
3
|
-
require_all 'lib/caliper/entities/software_application.rb'
|
20
|
+
require_all 'lib/caliper/entities/agent/software_application.rb'
|
4
21
|
require_all 'lib/caliper/entities/learning_objective.rb'
|
5
|
-
require_all 'lib/caliper/entities/
|
22
|
+
require_all 'lib/caliper/entities/agent/person.rb'
|
6
23
|
require_all 'lib/caliper/entities/lis/membership.rb'
|
7
24
|
require_all 'lib/caliper/entities/lis/roles.rb'
|
8
25
|
require_all 'lib/caliper/entities/lis/status.rb'
|
@@ -21,10 +38,10 @@ module Caliper
|
|
21
38
|
|
22
39
|
describe MediaEvent do
|
23
40
|
|
24
|
-
it 'should ensure that a
|
41
|
+
it 'should ensure that a Paused Video MediaObjectEvent is correctly created and serialized' do
|
25
42
|
|
26
43
|
# The Actor (Person/Student))
|
27
|
-
student = Caliper::Entities::
|
44
|
+
student = Caliper::Entities::Agent::Person.new
|
28
45
|
student.id = 'https://some-university.edu/user/554433'
|
29
46
|
membership1 = Caliper::Entities::LIS::Membership.new
|
30
47
|
membership1.id = "https://some-university.edu/membership/001"
|
@@ -82,7 +99,7 @@ module Caliper
|
|
82
99
|
videoLocation.currentTime = 710
|
83
100
|
|
84
101
|
# The course that is part of the Learning Context (edApp)
|
85
|
-
edApp = Caliper::Entities::SoftwareApplication.new
|
102
|
+
edApp = Caliper::Entities::Agent::SoftwareApplication.new
|
86
103
|
edApp.id = 'https://com.sat/super-media-tool'
|
87
104
|
edApp.name = 'Super Media Tool'
|
88
105
|
edApp.hasMembership = []
|
@@ -149,9 +166,7 @@ module Caliper
|
|
149
166
|
|
150
167
|
# Ensure that the deserialized shared event object conforms
|
151
168
|
expect(media_event).to eql(deser_media_event)
|
152
|
-
|
153
169
|
end
|
154
|
-
|
155
170
|
end
|
156
171
|
end
|
157
172
|
end
|
@@ -1,8 +1,24 @@
|
|
1
|
+
##
|
2
|
+
# This file is part of IMS Caliper Analytics™ and is licensed to
|
3
|
+
# IMS Global Learning Consortium, Inc. (http://www.imsglobal.org)
|
4
|
+
# under one or more contributor license agreements. See the NOTICE
|
5
|
+
# file distributed with this work for additional information.
|
6
|
+
#
|
7
|
+
# IMS Caliper is free software: you can redistribute it and/or modify it under
|
8
|
+
# the terms of the GNU Lesser General Public License as published by the Free
|
9
|
+
# Software Foundation, version 3 of the License.
|
10
|
+
#
|
11
|
+
# IMS Caliper is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
13
|
+
# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public License along
|
16
|
+
# with this program. If not, see http://www.gnu.org/licenses/.
|
17
|
+
|
1
18
|
require 'require_all'
|
2
19
|
require_all 'lib/caliper/entities/entity.rb'
|
3
|
-
require_all 'lib/caliper/entities/
|
4
|
-
require_all 'lib/caliper/entities/
|
5
|
-
require_all 'lib/caliper/entities/lis/person.rb'
|
20
|
+
require_all 'lib/caliper/entities/agent/software_application.rb'
|
21
|
+
require_all 'lib/caliper/entities/agent/person.rb'
|
6
22
|
require_all 'lib/caliper/entities/lis/membership.rb'
|
7
23
|
require_all 'lib/caliper/entities/lis/roles.rb'
|
8
24
|
require_all 'lib/caliper/entities/lis/status.rb'
|
@@ -10,6 +26,7 @@ require_all 'lib/caliper/entities/lis/course_section.rb'
|
|
10
26
|
require_all 'lib/caliper/entities/lis/course_offering.rb'
|
11
27
|
require_all 'lib/caliper/entities/lis/group.rb'
|
12
28
|
require_all 'lib/caliper/entities/reading/epub_volume.rb'
|
29
|
+
require_all 'lib/caliper/entities/reading/web_page.rb'
|
13
30
|
require_all 'lib/caliper/event/navigation_event.rb'
|
14
31
|
require_all 'lib/caliper/profiles/reading_profile.rb'
|
15
32
|
require 'json_spec'
|
@@ -19,10 +36,10 @@ module Caliper
|
|
19
36
|
|
20
37
|
describe NavigationEvent do
|
21
38
|
|
22
|
-
it 'should ensure that a
|
39
|
+
it 'should ensure that a NavigatedTo NavigationEvent is correctly created and serialized' do
|
23
40
|
|
24
41
|
# The Actor (Person/Student))
|
25
|
-
student = Caliper::Entities::
|
42
|
+
student = Caliper::Entities::Agent::Person.new
|
26
43
|
student.id = 'https://some-university.edu/user/554433'
|
27
44
|
membership1 = Caliper::Entities::LIS::Membership.new
|
28
45
|
membership1.id = "https://some-university.edu/membership/001"
|
@@ -54,7 +71,7 @@ module Caliper
|
|
54
71
|
# puts "new student = #{student.to_json}"
|
55
72
|
|
56
73
|
# The Action
|
57
|
-
action = Caliper::Profiles::
|
74
|
+
action = Caliper::Profiles::ProfileActions::NAVIGATED_TO
|
58
75
|
|
59
76
|
# The Object navigated (ePub Volume)
|
60
77
|
ePubVolume = Caliper::Entities::Reading::EPubVolume.new
|
@@ -75,7 +92,7 @@ module Caliper
|
|
75
92
|
frame.isPartOf = ePubVolume.id
|
76
93
|
|
77
94
|
# The course that is part of the Learning Context (edApp)
|
78
|
-
edApp = Caliper::Entities::SoftwareApplication.new
|
95
|
+
edApp = Caliper::Entities::Agent::SoftwareApplication.new
|
79
96
|
edApp.id = 'https://github.com/readium/readium-js-viewer'
|
80
97
|
edApp.name = 'Readium'
|
81
98
|
edApp.hasMembership = []
|
@@ -115,7 +132,7 @@ module Caliper
|
|
115
132
|
group.dateModified = nil
|
116
133
|
|
117
134
|
# The navigatedFrom property (specific to Navigation Event)
|
118
|
-
fromPage = Caliper::Entities::WebPage.new
|
135
|
+
fromPage = Caliper::Entities::Reading::WebPage.new
|
119
136
|
fromPage.id = 'https://some-university.edu/politicalScience/2015/american-revolution-101/index.html'
|
120
137
|
fromPage.name = 'American Revolution 101 Landing Page'
|
121
138
|
fromPage.dateCreated = '2015-08-01T06:00:00.000Z'
|
@@ -152,9 +169,7 @@ module Caliper
|
|
152
169
|
|
153
170
|
# Ensure that the deserialized shared event object conforms
|
154
171
|
expect(navigated_event).to eql(deser_navigated_event)
|
155
|
-
|
156
172
|
end
|
157
|
-
|
158
173
|
end
|
159
174
|
end
|
160
|
-
end
|
175
|
+
end
|