ims_caliper 0.9.3.15 → 1.0.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 +4 -4
- data/README.md +10 -5
- data/lib/caliper/{profiles/annotation_profile.rb → actions/annotation_actions.rb} +3 -41
- data/lib/caliper/{profiles/assessment_profile.rb → actions/assessment_actions.rb} +3 -19
- data/lib/caliper/actions/assessment_item_actions.rb +31 -0
- data/lib/caliper/{profiles/assignable_profile.rb → actions/assignable_actions.rb} +3 -28
- data/lib/caliper/{profiles/media_profile.rb → actions/media_actions.rb} +4 -29
- data/lib/caliper/{event/view_event.rb → actions/navigation_actions.rb} +5 -11
- data/lib/caliper/{validators/event_validator_context.rb → actions/outcome_actions.rb} +7 -15
- data/lib/caliper/{event/navigation_event.rb → actions/reading_actions.rb} +6 -14
- data/lib/caliper/actions/session_actions.rb +30 -0
- data/lib/caliper/context/context.rb +31 -0
- data/lib/caliper/entities/agent/organization.rb +4 -3
- data/lib/caliper/entities/agent/person.rb +4 -3
- data/lib/caliper/entities/agent/software_application.rb +4 -3
- data/lib/caliper/entities/annotation/annotation.rb +4 -12
- data/lib/caliper/entities/annotation/annotation_type.rb +32 -0
- data/lib/caliper/entities/annotation/bookmark_annotation.rb +3 -1
- data/lib/caliper/entities/annotation/highlight_annotation.rb +4 -4
- data/lib/caliper/entities/annotation/shared_annotation.rb +3 -1
- data/lib/caliper/entities/annotation/tag_annotation.rb +3 -1
- data/lib/caliper/entities/assessment/assessment.rb +1 -1
- data/lib/caliper/entities/assessment/assessment_item.rb +2 -0
- data/lib/caliper/entities/assignable/assignable_digital_resource.rb +3 -13
- data/lib/caliper/{event/session_event.rb → entities/assignable/assignable_digital_resource_type.rb} +7 -11
- data/lib/caliper/entities/assignable/attempt.rb +8 -9
- data/lib/caliper/entities/digital_resource.rb +5 -22
- data/lib/caliper/entities/digital_resource_type.rb +33 -0
- data/lib/caliper/entities/entity.rb +7 -37
- data/lib/caliper/entities/{learning_context.rb → entity_base.rb} +19 -15
- data/lib/caliper/entities/entity_type.rb +39 -0
- data/lib/caliper/entities/foaf/agent.rb +0 -2
- data/lib/caliper/entities/jsonable.rb +14 -3
- data/lib/caliper/entities/learning_objective.rb +4 -3
- data/lib/caliper/entities/lis/course_offering.rb +9 -6
- data/lib/caliper/entities/lis/course_section.rb +3 -1
- data/lib/caliper/entities/lis/group.rb +5 -3
- data/lib/caliper/entities/lis/membership.rb +5 -7
- data/lib/caliper/entities/media/audio_object.rb +2 -1
- data/lib/caliper/entities/media/image_object.rb +2 -1
- data/lib/caliper/entities/media/media_location.rb +2 -1
- data/lib/caliper/entities/media/media_object.rb +2 -9
- data/lib/caliper/entities/media/media_object_type.rb +31 -0
- data/lib/caliper/entities/media/video_object.rb +2 -1
- data/lib/caliper/entities/outcome/result.rb +23 -16
- data/lib/caliper/entities/reading/epub_chapter.rb +2 -1
- data/lib/caliper/entities/reading/epub_part.rb +2 -1
- data/lib/caliper/entities/reading/epub_sub_chapter.rb +2 -1
- data/lib/caliper/entities/reading/epub_volume.rb +2 -1
- data/lib/caliper/entities/reading/frame.rb +4 -3
- data/lib/caliper/entities/reading/web_page.rb +3 -2
- data/lib/caliper/entities/response/fillin_blank_response.rb +3 -3
- data/lib/caliper/entities/response/multiple_choice_response.rb +3 -3
- data/lib/caliper/entities/response/multiple_response_response.rb +3 -3
- data/lib/caliper/entities/response/response.rb +8 -10
- data/lib/caliper/entities/response/response_type.rb +5 -5
- data/lib/caliper/entities/response/select_type_response.rb +3 -3
- data/lib/caliper/entities/response/true_false_response.rb +2 -3
- data/lib/caliper/entities/session/session.rb +8 -7
- data/lib/caliper/{event → events}/annotation_event.rb +11 -3
- data/lib/caliper/{event → events}/assessment_event.rb +11 -8
- data/lib/caliper/{event → events}/assessment_item_event.rb +11 -8
- data/lib/caliper/{event → events}/assignable_event.rb +11 -8
- data/lib/caliper/{profiles/profile.rb → events/event.rb} +15 -15
- data/lib/caliper/events/event_context.rb +24 -0
- data/lib/caliper/events/event_type.rb +33 -0
- data/lib/caliper/{event → events}/jsonable.rb +2 -2
- data/lib/caliper/{event → events}/media_event.rb +11 -8
- data/lib/caliper/events/navigation_event.rb +47 -0
- data/lib/caliper/events/outcome_event.rb +44 -0
- data/lib/caliper/{event/outcome_event.rb → events/reading_event.rb} +13 -10
- data/lib/caliper/events/session_event.rb +42 -0
- data/lib/caliper/events/view_event.rb +44 -0
- data/lib/caliper/request/envelope.rb +4 -15
- data/lib/caliper/request/event_store_requestor.rb +1 -1
- data/lib/caliper/request/{envelope_jsonable.rb → jsonable.rb} +9 -11
- data/lib/caliper/sensor.rb +1 -1
- data/lib/caliper/version.rb +1 -1
- data/lib/caliper.rb +1 -1
- data/spec/lib/entities/agent/{student.json → person.json} +4 -3
- data/spec/lib/entities/agent/person_spec.rb +5 -6
- data/spec/lib/entities/assessment/assessment.json +23 -0
- data/spec/lib/entities/assessment/assessment_spec.rb +54 -0
- data/spec/lib/event_helper.rb +33 -41
- data/spec/lib/{event/annotation_event_bookmark_spec.rb → events/annotation_bookmarked_event_spec.rb} +36 -46
- data/spec/lib/{event/annotation_event_highlight_spec.rb → events/annotation_highlighted_event_spec.rb} +36 -46
- data/spec/lib/{event/annotation_event_shared_spec.rb → events/annotation_shared_event_spec.rb} +42 -52
- data/spec/lib/{event/annotation_event_tag_spec.rb → events/annotation_tagged_event_spec.rb} +36 -46
- data/spec/lib/{event → events}/assessment_item_completed_event_spec.rb +41 -65
- data/spec/lib/{event → events}/assessment_item_started_event_spec.rb +38 -56
- data/spec/lib/{event/assessment_event_spec.rb → events/assessment_started_event_spec.rb} +36 -51
- data/spec/lib/{event/assignable_event_spec.rb → events/assignable_activated_event_spec.rb} +37 -52
- data/spec/lib/{event/media_event_spec.rb → events/media_paused_video_event_spec.rb} +33 -43
- data/spec/lib/{event/navigated_event_spec.rb → events/navigation_navigated_to_event_spec.rb} +36 -45
- data/spec/lib/events/outcome_graded_event_spec.rb +163 -0
- data/spec/lib/{event/session_event_login_spec.rb → events/session_logged_in_event_spec.rb} +38 -46
- data/spec/lib/{event/session_event_logout_spec.rb → events/session_logged_out-event_spec.rb} +28 -37
- data/spec/lib/{event/session_event_timeout_spec.rb → events/session_timed_out_event_spec.rb} +24 -34
- data/spec/lib/{event/viewed_event_spec.rb → events/view_viewed_event_spec.rb} +33 -41
- data/spec/lib/request/{http_requestor_spec.rb → http_requestor_single_event_spec.rb} +46 -47
- data/spec/lib/request/http_requestor_single_minimal_event_spec.rb +84 -0
- data/spec/lib/sensor_spec.rb +1 -1
- metadata +77 -70
- data/lib/caliper/event/event.rb +0 -114
- data/lib/caliper/profiles/assessment_item_profile.rb +0 -48
- data/lib/caliper/profiles/reading_profile.rb +0 -56
- data/lib/caliper/profiles/session_profile.rb +0 -46
- data/lib/caliper/validators/error_message.rb +0 -63
- data/lib/caliper/validators/event_validator.rb +0 -57
- data/lib/caliper/validators/property_type_check.rb +0 -33
- data/lib/caliper/validators/session_login_event_validator.rb +0 -121
- data/lib/caliper/validators/session_logout_event_validator.rb +0 -120
- data/lib/caliper/validators/time_check.rb +0 -50
- data/spec/lib/entities/entity.json +0 -9
- data/spec/lib/entities/entity_spec.rb +0 -52
@@ -0,0 +1,163 @@
|
|
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/actions/outcome_actions.rb'
|
20
|
+
require_all 'lib/caliper/entities/entity_base.rb'
|
21
|
+
require_all 'lib/caliper/entities/agent/software_application.rb'
|
22
|
+
require_all 'lib/caliper/entities/agent/person.rb'
|
23
|
+
require_all 'lib/caliper/entities/assessment/assessment.rb'
|
24
|
+
require_all 'lib/caliper/entities/lis/membership.rb'
|
25
|
+
require_all 'lib/caliper/entities/lis/role.rb'
|
26
|
+
require_all 'lib/caliper/entities/lis/status.rb'
|
27
|
+
require_all 'lib/caliper/entities/lis/course_section.rb'
|
28
|
+
require_all 'lib/caliper/entities/lis/course_offering.rb'
|
29
|
+
require_all 'lib/caliper/entities/lis/group.rb'
|
30
|
+
require_all 'lib/caliper/entities/assignable/attempt.rb'
|
31
|
+
require_all 'lib/caliper/entities/outcome/result.rb'
|
32
|
+
require_all 'lib/caliper/events/outcome_event.rb'
|
33
|
+
require 'json_spec'
|
34
|
+
|
35
|
+
module Caliper
|
36
|
+
module Events
|
37
|
+
|
38
|
+
describe OutcomeEvent do
|
39
|
+
|
40
|
+
it 'should ensure that an OutcomeEvent is correctly created and serialized' do
|
41
|
+
|
42
|
+
# Scoring edApp
|
43
|
+
ed_app = Caliper::Entities::Agent::SoftwareApplication.new
|
44
|
+
ed_app.id = 'https://example.com/super-assessment-tool'
|
45
|
+
ed_app.name = 'Super Assessment Tool'
|
46
|
+
ed_app.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
47
|
+
|
48
|
+
# Actor
|
49
|
+
actor = Caliper::Entities::Agent::Person.new
|
50
|
+
actor.id = 'https://example.edu/user/554433'
|
51
|
+
actor.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
52
|
+
actor.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
53
|
+
|
54
|
+
# Action
|
55
|
+
action = Caliper::Actions::OutcomeActions::GRADED
|
56
|
+
|
57
|
+
# Object
|
58
|
+
obj = Caliper::Entities::Assignable::Attempt.new
|
59
|
+
obj.id = "https://example.edu/politicalScience/2015/american-revolution-101/assessment/001/attempt/5678"
|
60
|
+
obj.actor = "https://example.edu/user/554433"
|
61
|
+
obj.assignable = "https://example.edu/politicalScience/2015/american-revolution-101/assessment/001"
|
62
|
+
obj.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
63
|
+
obj.count = 1
|
64
|
+
obj.startedAtTime = "2015-09-15T10:15:00.000Z"
|
65
|
+
|
66
|
+
# Assessment (result.assignable)
|
67
|
+
assessment = Caliper::Entities::Assessment::Assessment.new
|
68
|
+
assessment.id = "https://example.edu/politicalScience/2015/american-revolution-101/assessment/001"
|
69
|
+
assessment.name = "American Revolution - Key Figures Assessment"
|
70
|
+
assessment.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
71
|
+
assessment.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
72
|
+
assessment.datePublished = Time.utc(2015,8,15,9,30,0).iso8601(3)
|
73
|
+
assessment.version = "1.0"
|
74
|
+
assessment.dateToActivate = Time.utc(2015,8,16,5,0,0).iso8601(3)
|
75
|
+
assessment.dateToShow = Time.utc(2015,8,16,5,0,0).iso8601(3)
|
76
|
+
assessment.dateToStartOn = Time.utc(2015,8,16,5,0,0).iso8601(3)
|
77
|
+
assessment.dateToSubmit = Time.utc(2015,9,28,11,59,59).iso8601(3)
|
78
|
+
assessment.maxAttempts = 2
|
79
|
+
assessment.maxSubmits = 2
|
80
|
+
assessment.maxScore = 3.0
|
81
|
+
|
82
|
+
# Generated result
|
83
|
+
generated = Caliper::Entities::Outcome::Result.new
|
84
|
+
generated.id = "https://example.edu/politicalScience/2015/american-revolution-101/assessment/001/attempt/5678/result"
|
85
|
+
generated.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
86
|
+
generated.assignable = assessment.id
|
87
|
+
generated.actor = actor.id
|
88
|
+
generated.normalScore = 3.0
|
89
|
+
generated.penaltyScore = 0.0
|
90
|
+
generated.extraCreditScore = 0.0
|
91
|
+
generated.totalScore = 3.0
|
92
|
+
generated.curvedTotalScore = 3.0
|
93
|
+
generated.curveFactor = 0.0
|
94
|
+
generated.comment = "Well done."
|
95
|
+
generated.scoredBy = ed_app
|
96
|
+
|
97
|
+
# LIS Course Offering
|
98
|
+
course = Caliper::Entities::LIS::CourseOffering.new
|
99
|
+
course.id = "https://example.edu/politicalScience/2015/american-revolution-101"
|
100
|
+
course.name = "Political Science 101: The American Revolution"
|
101
|
+
course.courseNumber = "POL101"
|
102
|
+
course.academicSession = "Fall-2015"
|
103
|
+
course.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
104
|
+
course.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
105
|
+
|
106
|
+
# LIS Course Section
|
107
|
+
section = Caliper::Entities::LIS::CourseSection.new
|
108
|
+
section.id = 'https://example.edu/politicalScience/2015/american-revolution-101/section/001'
|
109
|
+
section.name = 'American Revolution 101'
|
110
|
+
section.courseNumber = "POL101"
|
111
|
+
section.academicSession = "Fall-2015"
|
112
|
+
section.subOrganizationOf = course
|
113
|
+
section.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
114
|
+
section.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
115
|
+
|
116
|
+
# LIS Group
|
117
|
+
group = Caliper::Entities::LIS::Group.new
|
118
|
+
group.id = "https://example.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
119
|
+
group.name = "Discussion Group 001"
|
120
|
+
group.subOrganizationOf = section
|
121
|
+
group.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
122
|
+
|
123
|
+
# Membership
|
124
|
+
membership = Caliper::Entities::LIS::Membership.new
|
125
|
+
membership.id = "https://example.edu/politicalScience/2015/american-revolution-101/roster/554433"
|
126
|
+
membership.name = "American Revolution 101"
|
127
|
+
membership.description = "Roster entry"
|
128
|
+
membership.member = "https://example.edu/user/554433"
|
129
|
+
membership.organization = "https://example.edu/politicalScience/2015/american-revolution-101/section/001"
|
130
|
+
membership.roles = [Caliper::Entities::LIS::Role::LEARNER]
|
131
|
+
membership.status = Caliper::Entities::LIS::Status::ACTIVE
|
132
|
+
membership.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
133
|
+
|
134
|
+
# Create the Event
|
135
|
+
event = OutcomeEvent.new
|
136
|
+
event.actor = actor
|
137
|
+
event.action = action
|
138
|
+
event.object = obj
|
139
|
+
event.generated = generated
|
140
|
+
event.eventTime = Time.utc(2015,9,15,10,15,0).iso8601(3)
|
141
|
+
event.edApp = ed_app
|
142
|
+
event.group = group
|
143
|
+
event.membership = membership
|
144
|
+
|
145
|
+
# Load JSON from caliper-common-fixtures for comparison
|
146
|
+
# NOTE - sym link to caliper-common-fixtures needs to exist under spec/fixtures
|
147
|
+
file = File.read('spec/fixtures/caliperAssessmentOutcomeEvent.json')
|
148
|
+
data_hash = JSON.parse(file)
|
149
|
+
expected_json = data_hash.to_json # convert hash back to JSON string after parse
|
150
|
+
#puts "JSON= #{event.to_json}"
|
151
|
+
expect(event.to_json).to be_json_eql(expected_json)#.excluding("actor", "action", "object", "target", "generated", "ed_app", "group")
|
152
|
+
|
153
|
+
# puts "JSON from file = #{data_hash}"
|
154
|
+
deser_event = OutcomeEvent.new
|
155
|
+
deser_event.from_json data_hash
|
156
|
+
# puts "AssessmentEvent from JSON = #{deser_event.to_json}"
|
157
|
+
|
158
|
+
# Ensure that the deserialized bookmark event object conforms
|
159
|
+
expect(event).to eql(deser_event)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
@@ -16,7 +16,8 @@
|
|
16
16
|
# with this program. If not, see http://www.gnu.org/licenses/.
|
17
17
|
|
18
18
|
require 'require_all'
|
19
|
-
require_all 'lib/caliper/
|
19
|
+
require_all 'lib/caliper/actions/session_actions.rb'
|
20
|
+
require_all 'lib/caliper/entities/entity_base.rb'
|
20
21
|
require_all 'lib/caliper/entities/agent/software_application.rb'
|
21
22
|
require_all 'lib/caliper/entities/agent/person.rb'
|
22
23
|
require_all 'lib/caliper/entities/lis/membership.rb'
|
@@ -27,12 +28,11 @@ require_all 'lib/caliper/entities/lis/course_offering.rb'
|
|
27
28
|
require_all 'lib/caliper/entities/lis/group.rb'
|
28
29
|
require_all 'lib/caliper/entities/reading/epub_volume.rb'
|
29
30
|
require_all 'lib/caliper/entities/session/session.rb'
|
30
|
-
require_all 'lib/caliper/
|
31
|
-
require_all 'lib/caliper/profiles/session_profile.rb'
|
31
|
+
require_all 'lib/caliper/events/session_event.rb'
|
32
32
|
require 'json_spec'
|
33
33
|
|
34
34
|
module Caliper
|
35
|
-
module
|
35
|
+
module Events
|
36
36
|
|
37
37
|
describe SessionEvent do
|
38
38
|
|
@@ -40,96 +40,89 @@ module Caliper
|
|
40
40
|
|
41
41
|
# Actor
|
42
42
|
actor = Caliper::Entities::Agent::Person.new
|
43
|
-
actor.id = 'https://
|
44
|
-
actor.dateCreated =
|
45
|
-
actor.dateModified =
|
43
|
+
actor.id = 'https://example.edu/user/554433'
|
44
|
+
actor.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
45
|
+
actor.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
46
46
|
|
47
47
|
# Action
|
48
|
-
action = Caliper::
|
48
|
+
action = Caliper::Actions::SessionActions::LOGGED_IN
|
49
49
|
|
50
50
|
# Object (edApp)
|
51
51
|
obj = Caliper::Entities::Agent::SoftwareApplication.new
|
52
|
-
obj.id = 'https://
|
53
|
-
obj.name = '
|
54
|
-
obj.dateCreated =
|
55
|
-
obj.dateModified =
|
52
|
+
obj.id = 'https://example.com/viewer'
|
53
|
+
obj.name = 'ePub'
|
54
|
+
obj.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
55
|
+
obj.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
56
56
|
|
57
57
|
# ePub parent (target.isPartOf)
|
58
58
|
ePub = Caliper::Entities::Reading::EPubVolume.new
|
59
|
-
ePub.id = 'https://
|
59
|
+
ePub.id = 'https://example.com/viewer/book/34843#epubcfi(/4/3)'
|
60
60
|
ePub.name = 'The Glorious Cause: The American Revolution, 1763-1789 (Oxford History of the United States)'
|
61
61
|
ePub.version = '2nd ed.'
|
62
|
-
ePub.dateCreated =
|
63
|
-
ePub.dateModified =
|
62
|
+
ePub.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
63
|
+
ePub.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
64
64
|
|
65
65
|
# Target frame
|
66
66
|
target = Caliper::Entities::Reading::Frame.new
|
67
|
-
target.id = 'https://
|
67
|
+
target.id = 'https://example.com/viewer/book/34843#epubcfi(/4/3/1)'
|
68
68
|
target.name = 'Key Figures: George Washington'
|
69
69
|
target.isPartOf = ePub
|
70
70
|
target.version = ePub.version
|
71
71
|
target.index = 1
|
72
|
-
target.dateCreated =
|
73
|
-
target.dateModified =
|
72
|
+
target.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
73
|
+
target.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
74
74
|
|
75
75
|
# Generated session
|
76
76
|
generated = Caliper::Entities::Session::Session.new
|
77
|
-
generated.id = 'https://
|
77
|
+
generated.id = 'https://example.com/viewer/session-123456789'
|
78
78
|
generated.name = 'session-123456789'
|
79
|
-
generated.description = nil
|
80
79
|
generated.actor = actor
|
81
80
|
generated.startedAtTime = '2015-09-15T10:15:00.000Z'
|
82
|
-
generated.
|
83
|
-
generated.
|
84
|
-
generated.dateCreated = '2015-08-01T06:00:00.000Z'
|
85
|
-
generated.dateModified = '2015-09-02T11:30:00.000Z'
|
81
|
+
generated.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
82
|
+
generated.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
86
83
|
|
87
84
|
# EdApp
|
88
85
|
ed_app = Caliper::Entities::Agent::SoftwareApplication.new
|
89
|
-
ed_app.id = 'https://
|
90
|
-
ed_app.name = '
|
91
|
-
ed_app.dateCreated =
|
92
|
-
ed_app.dateModified =
|
86
|
+
ed_app.id = 'https://example.com/viewer'
|
87
|
+
ed_app.name = 'ePub'
|
88
|
+
ed_app.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
89
|
+
ed_app.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
93
90
|
|
94
91
|
# LIS Course Offering
|
95
92
|
course = Caliper::Entities::LIS::CourseOffering.new
|
96
|
-
course.id = "https://
|
93
|
+
course.id = "https://example.edu/politicalScience/2015/american-revolution-101"
|
97
94
|
course.name = "Political Science 101: The American Revolution"
|
98
95
|
course.courseNumber = "POL101"
|
99
96
|
course.academicSession = "Fall-2015"
|
100
|
-
course.
|
101
|
-
course.
|
102
|
-
course.dateModified = '2015-09-02T11:30:00.000Z'
|
97
|
+
course.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
98
|
+
course.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
103
99
|
|
104
100
|
# LIS Course Section
|
105
101
|
section = Caliper::Entities::LIS::CourseSection.new
|
106
|
-
section.id = 'https://
|
102
|
+
section.id = 'https://example.edu/politicalScience/2015/american-revolution-101/section/001'
|
107
103
|
section.name = 'American Revolution 101'
|
108
104
|
section.courseNumber = "POL101"
|
109
105
|
section.academicSession = "Fall-2015"
|
110
|
-
section.category = nil
|
111
106
|
section.subOrganizationOf = course
|
112
|
-
section.dateCreated =
|
113
|
-
section.dateModified =
|
107
|
+
section.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
108
|
+
section.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
114
109
|
|
115
110
|
# LIS Group
|
116
111
|
group = Caliper::Entities::LIS::Group.new
|
117
|
-
group.id = "https://
|
112
|
+
group.id = "https://example.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
118
113
|
group.name = "Discussion Group 001"
|
119
114
|
group.subOrganizationOf = section
|
120
|
-
group.dateCreated =
|
121
|
-
group.dateModified = nil
|
115
|
+
group.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
122
116
|
|
123
117
|
membership = Caliper::Entities::LIS::Membership.new
|
124
|
-
membership.id = "https://
|
118
|
+
membership.id = "https://example.edu/politicalScience/2015/american-revolution-101/roster/554433"
|
125
119
|
membership.name = "American Revolution 101"
|
126
120
|
membership.description = "Roster entry"
|
127
|
-
membership.member = "https://
|
128
|
-
membership.organization = "https://
|
121
|
+
membership.member = "https://example.edu/user/554433"
|
122
|
+
membership.organization = "https://example.edu/politicalScience/2015/american-revolution-101/section/001"
|
129
123
|
membership.roles = [Caliper::Entities::LIS::Role::LEARNER]
|
130
124
|
membership.status = Caliper::Entities::LIS::Status::ACTIVE
|
131
|
-
membership.dateCreated =
|
132
|
-
membership.dateModified = nil
|
125
|
+
membership.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
133
126
|
|
134
127
|
# Create the Event
|
135
128
|
event = SessionEvent.new
|
@@ -138,11 +131,10 @@ module Caliper
|
|
138
131
|
event.object = obj
|
139
132
|
event.target = target
|
140
133
|
event.generated = generated
|
141
|
-
event.
|
134
|
+
event.eventTime = Time.utc(2015,9,15,10,15,0).iso8601(3)
|
142
135
|
event.edApp = ed_app
|
143
136
|
event.group = group
|
144
137
|
event.membership = membership
|
145
|
-
# puts "Event JSON = #{event.to_json}'"
|
146
138
|
|
147
139
|
# Load JSON from caliper-common-fixtures for comparison
|
148
140
|
# NOTE - sym link to caliper-common-fixtures needs to exist under spec/fixtures
|
data/spec/lib/{event/session_event_logout_spec.rb → events/session_logged_out-event_spec.rb}
RENAMED
@@ -16,7 +16,8 @@
|
|
16
16
|
# with this program. If not, see http://www.gnu.org/licenses/.
|
17
17
|
|
18
18
|
require 'require_all'
|
19
|
-
require_all 'lib/caliper/
|
19
|
+
require_all 'lib/caliper/actions/session_actions.rb'
|
20
|
+
require_all 'lib/caliper/entities/entity_base.rb'
|
20
21
|
require_all 'lib/caliper/entities/agent/software_application.rb'
|
21
22
|
require_all 'lib/caliper/entities/agent/person.rb'
|
22
23
|
require_all 'lib/caliper/entities/lis/membership.rb'
|
@@ -26,12 +27,11 @@ require_all 'lib/caliper/entities/lis/course_section.rb'
|
|
26
27
|
require_all 'lib/caliper/entities/lis/course_offering.rb'
|
27
28
|
require_all 'lib/caliper/entities/lis/group.rb'
|
28
29
|
require_all 'lib/caliper/entities/session/session.rb'
|
29
|
-
require_all 'lib/caliper/
|
30
|
-
require_all 'lib/caliper/profiles/session_profile.rb'
|
30
|
+
require_all 'lib/caliper/events/session_event.rb'
|
31
31
|
require 'json_spec'
|
32
32
|
|
33
33
|
module Caliper
|
34
|
-
module
|
34
|
+
module Events
|
35
35
|
|
36
36
|
describe SessionEvent do
|
37
37
|
|
@@ -39,74 +39,69 @@ module Caliper
|
|
39
39
|
|
40
40
|
# EdApp
|
41
41
|
ed_app = Caliper::Entities::Agent::SoftwareApplication.new
|
42
|
-
ed_app.id = 'https://
|
43
|
-
ed_app.name = '
|
44
|
-
ed_app.dateCreated =
|
45
|
-
ed_app.dateModified =
|
42
|
+
ed_app.id = 'https://example.com/viewer'
|
43
|
+
ed_app.name = 'ePub'
|
44
|
+
ed_app.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
45
|
+
ed_app.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
46
46
|
|
47
47
|
# Actor
|
48
48
|
actor = Caliper::Entities::Agent::Person.new
|
49
|
-
actor.id = 'https://
|
50
|
-
actor.dateCreated =
|
51
|
-
actor.dateModified =
|
49
|
+
actor.id = 'https://example.edu/user/554433'
|
50
|
+
actor.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
51
|
+
actor.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
52
52
|
|
53
53
|
# Action
|
54
|
-
action = Caliper::
|
54
|
+
action = Caliper::Actions::SessionActions::LOGGED_OUT
|
55
55
|
|
56
56
|
# Object (edApp)
|
57
57
|
obj = ed_app
|
58
58
|
|
59
59
|
# Target session
|
60
60
|
session = Caliper::Entities::Session::Session.new
|
61
|
-
session.id = 'https://
|
61
|
+
session.id = 'https://example.com/viewer/session-123456789'
|
62
62
|
session.name = 'session-123456789'
|
63
|
-
session.description = nil
|
64
63
|
session.actor = actor
|
65
64
|
session.startedAtTime = '2015-09-15T10:15:00.000Z'
|
66
65
|
session.endedAtTime = '2015-09-15T11:05:00.000Z'
|
67
66
|
session.duration = 'PT3000S'
|
68
|
-
session.dateCreated =
|
69
|
-
session.dateModified =
|
67
|
+
session.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
68
|
+
session.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
70
69
|
|
71
70
|
# LIS Course Offering
|
72
71
|
course = Caliper::Entities::LIS::CourseOffering.new
|
73
|
-
course.id = "https://
|
72
|
+
course.id = "https://example.edu/politicalScience/2015/american-revolution-101"
|
74
73
|
course.name = "Political Science 101: The American Revolution"
|
75
74
|
course.courseNumber = "POL101"
|
76
75
|
course.academicSession = "Fall-2015"
|
77
|
-
course.
|
78
|
-
course.
|
79
|
-
course.dateModified = '2015-09-02T11:30:00.000Z'
|
76
|
+
course.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
77
|
+
course.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
80
78
|
|
81
79
|
# LIS Course Section
|
82
80
|
section = Caliper::Entities::LIS::CourseSection.new
|
83
|
-
section.id = 'https://
|
81
|
+
section.id = 'https://example.edu/politicalScience/2015/american-revolution-101/section/001'
|
84
82
|
section.name = 'American Revolution 101'
|
85
83
|
section.courseNumber = "POL101"
|
86
84
|
section.academicSession = "Fall-2015"
|
87
|
-
section.category = nil
|
88
85
|
section.subOrganizationOf = course
|
89
|
-
section.dateCreated =
|
90
|
-
section.dateModified =
|
86
|
+
section.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
87
|
+
section.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
91
88
|
|
92
89
|
# LIS Group
|
93
90
|
group = Caliper::Entities::LIS::Group.new
|
94
|
-
group.id = "https://
|
91
|
+
group.id = "https://example.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
95
92
|
group.name = "Discussion Group 001"
|
96
93
|
group.subOrganizationOf = section
|
97
|
-
group.dateCreated =
|
98
|
-
group.dateModified = nil
|
94
|
+
group.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
99
95
|
|
100
96
|
membership = Caliper::Entities::LIS::Membership.new
|
101
|
-
membership.id = "https://
|
97
|
+
membership.id = "https://example.edu/politicalScience/2015/american-revolution-101/roster/554433"
|
102
98
|
membership.name = "American Revolution 101"
|
103
99
|
membership.description = "Roster entry"
|
104
|
-
membership.member = "https://
|
105
|
-
membership.organization = "https://
|
100
|
+
membership.member = "https://example.edu/user/554433"
|
101
|
+
membership.organization = "https://example.edu/politicalScience/2015/american-revolution-101/section/001"
|
106
102
|
membership.roles = [Caliper::Entities::LIS::Role::LEARNER]
|
107
103
|
membership.status = Caliper::Entities::LIS::Status::ACTIVE
|
108
|
-
membership.dateCreated =
|
109
|
-
membership.dateModified = nil
|
104
|
+
membership.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
110
105
|
|
111
106
|
# Create Event
|
112
107
|
event = SessionEvent.new
|
@@ -114,14 +109,10 @@ module Caliper
|
|
114
109
|
event.action = action
|
115
110
|
event.object = obj
|
116
111
|
event.target = session
|
117
|
-
event.
|
118
|
-
event.startedAtTime = '2015-09-15T10:15:00.000Z'
|
119
|
-
event.endedAtTime = '2015-09-15T11:05:00.000Z'
|
120
|
-
event.duration = 'PT3000S'
|
112
|
+
event.eventTime = Time.utc(2015,9,15,10,15,0).iso8601(3)
|
121
113
|
event.edApp = ed_app
|
122
114
|
event.group = group
|
123
115
|
event.membership = membership
|
124
|
-
# puts "Event JSON = #{event.to_json}'"
|
125
116
|
|
126
117
|
# Load JSON from caliper-common-fixtures for comparison
|
127
118
|
# NOTE - sym link to caliper-common-fixtures needs to exist under spec/fixtures
|