ims_caliper 0.9.3.14 → 0.9.3.15
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/lib/caliper/defaults.rb +2 -2
- data/lib/caliper/entities/agent/organization.rb +3 -3
- data/lib/caliper/entities/assessment/assessment.rb +0 -2
- data/lib/caliper/entities/entity.rb +0 -1
- data/lib/caliper/entities/foaf/agent.rb +1 -1
- data/lib/caliper/entities/lis/course_offering.rb +0 -1
- data/lib/caliper/entities/lis/group.rb +1 -2
- data/lib/caliper/entities/lis/{roles.rb → role.rb} +1 -1
- data/lib/caliper/entities/outcome/result.rb +3 -3
- data/lib/caliper/entities/response/fillin_blank_response.rb +1 -0
- data/lib/caliper/entities/response/multiple_choice_response.rb +1 -0
- data/lib/caliper/entities/response/multiple_response_response.rb +1 -0
- data/lib/caliper/entities/response/response.rb +1 -0
- data/lib/caliper/entities/response/select_type_response.rb +1 -0
- data/lib/caliper/entities/response/true_false_response.rb +1 -0
- data/lib/caliper/event/annotation_event.rb +1 -0
- data/lib/caliper/event/event.rb +28 -26
- data/lib/caliper/event/view_event.rb +1 -0
- data/lib/caliper/jsonable.rb +2 -1
- data/lib/caliper/options.rb +11 -11
- data/lib/caliper/profiles/assessment_profile.rb +0 -1
- data/lib/caliper/{event/grade_predict_event.rb → request/envelope.rb} +21 -11
- data/lib/caliper/request/envelope_jsonable.rb +69 -0
- data/lib/caliper/request/event_store_requestor.rb +16 -27
- data/lib/caliper/request/http_requestor.rb +8 -27
- data/lib/caliper/sensor.rb +12 -23
- data/lib/caliper/version.rb +1 -1
- data/spec/lib/entities/agent/person_spec.rb +1 -1
- data/spec/lib/entities/entity_spec.rb +1 -1
- data/spec/lib/event/annotation_event_bookmark_spec.rb +81 -98
- data/spec/lib/event/annotation_event_highlight_spec.rb +81 -98
- data/spec/lib/event/annotation_event_shared_spec.rb +81 -100
- data/spec/lib/event/annotation_event_tag_spec.rb +81 -98
- data/spec/lib/event/assessment_event_spec.rb +64 -124
- data/spec/lib/event/assessment_item_completed_event_spec.rb +93 -138
- data/spec/lib/event/assessment_item_started_event_spec.rb +92 -139
- data/spec/lib/event/assignable_event_spec.rb +65 -129
- data/spec/lib/event/media_event_spec.rb +77 -94
- data/spec/lib/event/navigated_event_spec.rb +90 -108
- data/spec/lib/event/session_event_login_spec.rb +98 -108
- data/spec/lib/event/session_event_logout_spec.rb +66 -81
- data/spec/lib/event/session_event_timeout_spec.rb +62 -88
- data/spec/lib/event/viewed_event_spec.rb +74 -92
- data/spec/lib/event_helper.rb +89 -109
- data/spec/lib/request/http_requestor_spec.rb +170 -0
- data/spec/lib/sensor_spec.rb +9 -29
- metadata +10 -11
- data/lib/caliper/entities/outcome/predicted_grade.rb +0 -43
- data/lib/caliper/entity_envelope.rb +0 -33
- data/lib/caliper/event_envelope.rb +0 -33
- data/lib/caliper/request/event_store_envelope.rb +0 -27
@@ -21,7 +21,7 @@ require_all 'lib/caliper/entities/agent/software_application.rb'
|
|
21
21
|
require_all 'lib/caliper/entities/learning_objective.rb'
|
22
22
|
require_all 'lib/caliper/entities/agent/person.rb'
|
23
23
|
require_all 'lib/caliper/entities/lis/membership.rb'
|
24
|
-
require_all 'lib/caliper/entities/lis/
|
24
|
+
require_all 'lib/caliper/entities/lis/role.rb'
|
25
25
|
require_all 'lib/caliper/entities/lis/status.rb'
|
26
26
|
require_all 'lib/caliper/entities/lis/course_section.rb'
|
27
27
|
require_all 'lib/caliper/entities/lis/course_offering.rb'
|
@@ -40,42 +40,22 @@ module Caliper
|
|
40
40
|
|
41
41
|
it 'should ensure that a Paused Video MediaObjectEvent is correctly created and serialized' do
|
42
42
|
|
43
|
-
#
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
membership1.roles = [Caliper::Entities::LIS::Roles::LEARNER]
|
51
|
-
membership1.status = Caliper::Entities::LIS::Status::ACTIVE
|
52
|
-
membership1.dateCreated = "2015-08-01T06:00:00.000Z"
|
53
|
-
membership1.dateModified = nil;
|
54
|
-
membership2 = Caliper::Entities::LIS::Membership.new
|
55
|
-
membership2.id = "https://some-university.edu/membership/002"
|
56
|
-
membership2.member = "https://some-university.edu/user/554433"
|
57
|
-
membership2.organization = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001"
|
58
|
-
membership2.roles = [Caliper::Entities::LIS::Roles::LEARNER]
|
59
|
-
membership2.status = Caliper::Entities::LIS::Status::ACTIVE
|
60
|
-
membership2.dateCreated = "2015-08-01T06:00:00.000Z"
|
61
|
-
membership2.dateModified = nil
|
62
|
-
membership3 = Caliper::Entities::LIS::Membership.new
|
63
|
-
membership3.id = "https://some-university.edu/membership/003"
|
64
|
-
membership3.member = "https://some-university.edu/user/554433"
|
65
|
-
membership3.organization = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
66
|
-
membership3.roles = [Caliper::Entities::LIS::Roles::LEARNER]
|
67
|
-
membership3.status = Caliper::Entities::LIS::Status::ACTIVE
|
68
|
-
membership3.dateCreated = "2015-08-01T06:00:00.000Z"
|
69
|
-
membership3.dateModified = nil
|
70
|
-
student.hasMembership = [membership1, membership2, membership3]
|
71
|
-
student.dateCreated = '2015-08-01T06:00:00.000Z'
|
72
|
-
student.dateModified = '2015-09-02T11:30:00.000Z'
|
73
|
-
# puts "new student = #{student.to_json}"
|
74
|
-
|
75
|
-
# The Action
|
43
|
+
# Actor
|
44
|
+
actor = Caliper::Entities::Agent::Person.new
|
45
|
+
actor.id = 'https://some-university.edu/user/554433'
|
46
|
+
actor.dateCreated = '2015-08-01T06:00:00.000Z'
|
47
|
+
actor.dateModified = '2015-09-02T11:30:00.000Z'
|
48
|
+
|
49
|
+
# Action
|
76
50
|
action = Caliper::Profiles::MediaActions::PAUSED
|
77
51
|
|
78
|
-
#
|
52
|
+
# Learning Objective (video.alignedLearningObjective)
|
53
|
+
learnObjective = Caliper::Entities::LearningObjective.new
|
54
|
+
learnObjective.id = 'http://americanrevolution.com/personalities/learn'
|
55
|
+
learnObjective.dateCreated = '2015-08-01T06:00:00.000Z'
|
56
|
+
learnObjective.dateModified = nil
|
57
|
+
|
58
|
+
# Object
|
79
59
|
video = Caliper::Entities::Media::VideoObject.new
|
80
60
|
video.id = 'https://com.sat/super-media-tool/video/video1'
|
81
61
|
video.name = 'American Revolution - Key Figures Video'
|
@@ -83,89 +63,92 @@ module Caliper
|
|
83
63
|
video.duration = 1420
|
84
64
|
video.dateCreated = '2015-08-01T06:00:00.000Z'
|
85
65
|
video.dateModified = '2015-09-02T11:30:00.000Z'
|
86
|
-
|
87
|
-
learnObjective = Caliper::Entities::LearningObjective.new
|
88
|
-
learnObjective.id = 'http://americanrevolution.com/personalities/learn'
|
89
|
-
learnObjective.dateCreated = '2015-08-01T06:00:00.000Z'
|
90
|
-
learnObjective.dateModified = nil
|
91
66
|
video.alignedLearningObjective = [learnObjective]
|
92
67
|
|
93
|
-
#
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
#
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
courseOffering.name = "Political Science 101: The American Revolution"
|
113
|
-
courseOffering.courseNumber = "POL101"
|
114
|
-
courseOffering.academicSession = "Fall-2015"
|
115
|
-
courseOffering.membership = []
|
116
|
-
courseOffering.subOrganizationOf = nil
|
117
|
-
courseOffering.dateCreated = '2015-08-01T06:00:00.000Z'
|
118
|
-
courseOffering.dateModified = '2015-09-02T11:30:00.000Z'
|
119
|
-
|
120
|
-
# The LIS Course Section for the Caliper Event
|
121
|
-
course = Caliper::Entities::LIS::CourseSection.new
|
122
|
-
course.id = 'https://some-university.edu/politicalScience/2015/american-revolution-101/section/001'
|
123
|
-
course.name = 'American Revolution 101'
|
68
|
+
# Target coordinates
|
69
|
+
target = Caliper::Entities::Media::MediaLocation.new
|
70
|
+
target.id = 'https://com.sat/super-media-tool/video/video1'
|
71
|
+
target.version = '1.0'
|
72
|
+
target.dateCreated = '2015-08-01T06:00:00.000Z'
|
73
|
+
target.dateModified = nil
|
74
|
+
target.currentTime = 710
|
75
|
+
|
76
|
+
# ed_app
|
77
|
+
ed_app = Caliper::Entities::Agent::SoftwareApplication.new
|
78
|
+
ed_app.id = 'https://com.sat/super-media-tool'
|
79
|
+
ed_app.name = 'Super Media Tool'
|
80
|
+
ed_app.dateCreated = '2015-08-01T06:00:00.000Z'
|
81
|
+
ed_app.dateModified = '2015-09-02T11:30:00.000Z'
|
82
|
+
|
83
|
+
# LIS Course Offering
|
84
|
+
course = Caliper::Entities::LIS::CourseOffering.new
|
85
|
+
course.id = "https://some-university.edu/politicalScience/2015/american-revolution-101"
|
86
|
+
course.name = "Political Science 101: The American Revolution"
|
124
87
|
course.courseNumber = "POL101"
|
125
88
|
course.academicSession = "Fall-2015"
|
126
|
-
course.
|
127
|
-
course.membership = [membership2]
|
128
|
-
course.subOrganizationOf = courseOffering
|
89
|
+
course.subOrganizationOf = nil
|
129
90
|
course.dateCreated = '2015-08-01T06:00:00.000Z'
|
130
91
|
course.dateModified = '2015-09-02T11:30:00.000Z'
|
131
92
|
|
93
|
+
# LIS Course Section
|
94
|
+
section = Caliper::Entities::LIS::CourseSection.new
|
95
|
+
section.id = 'https://some-university.edu/politicalScience/2015/american-revolution-101/section/001'
|
96
|
+
section.name = 'American Revolution 101'
|
97
|
+
section.courseNumber = "POL101"
|
98
|
+
section.academicSession = "Fall-2015"
|
99
|
+
section.category = nil
|
100
|
+
section.subOrganizationOf = course
|
101
|
+
section.dateCreated = '2015-08-01T06:00:00.000Z'
|
102
|
+
section.dateModified = '2015-09-02T11:30:00.000Z'
|
103
|
+
|
132
104
|
# LIS Group
|
133
105
|
group = Caliper::Entities::LIS::Group.new
|
134
106
|
group.id = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
135
107
|
group.name = "Discussion Group 001"
|
136
|
-
group.
|
137
|
-
group.subOrganizationOf = course
|
108
|
+
group.subOrganizationOf = section
|
138
109
|
group.dateCreated = '2015-08-01T06:00:00.000Z'
|
139
110
|
group.dateModified = nil
|
140
111
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
112
|
+
membership = Caliper::Entities::LIS::Membership.new
|
113
|
+
membership.id = "https://some-university.edu/politicalScience/2015/american-revolution-101/roster/554433"
|
114
|
+
membership.name = "American Revolution 101"
|
115
|
+
membership.description = "Roster entry"
|
116
|
+
membership.member = "https://some-university.edu/user/554433"
|
117
|
+
membership.organization = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001"
|
118
|
+
membership.roles = [Caliper::Entities::LIS::Role::LEARNER]
|
119
|
+
membership.status = Caliper::Entities::LIS::Status::ACTIVE
|
120
|
+
membership.dateCreated = "2015-08-01T06:00:00.000Z"
|
121
|
+
membership.dateModified = nil
|
122
|
+
|
123
|
+
# Create the Event
|
124
|
+
event = Caliper::Event::MediaEvent.new
|
125
|
+
event.actor = actor
|
126
|
+
event.action = action
|
127
|
+
event.object = video
|
128
|
+
event.target = target
|
129
|
+
event.generated = nil
|
130
|
+
event.startedAtTime = '2015-09-15T10:15:00.000Z'
|
131
|
+
event.endedAtTime = nil
|
132
|
+
event.duration = nil
|
133
|
+
event.edApp = ed_app
|
134
|
+
event.group = group
|
135
|
+
event.membership = membership
|
136
|
+
# puts "Event JSON = #{event.to_json}'"
|
154
137
|
|
155
138
|
# Load JSON from caliper-common-fixtures for comparison
|
156
139
|
# NOTE - sym link to caliper-common-fixtures needs to exist under spec/fixtures
|
157
140
|
file = File.read('spec/fixtures/caliperMediaEvent.json')
|
158
141
|
data_hash = JSON.parse(file)
|
159
142
|
expected_json = data_hash.to_json # convert hash back to JSON string after parse
|
160
|
-
|
143
|
+
expect(event.to_json).to be_json_eql(expected_json)#.excluding("actor", "action", "object", "target", "generated", "ed_app", "group")
|
161
144
|
|
162
145
|
# puts "JSON from file = #{data_hash}"
|
163
|
-
|
164
|
-
|
165
|
-
# puts "ReadingEvent from JSON = #{
|
146
|
+
deser_event = Caliper::Event::MediaEvent.new
|
147
|
+
deser_event.from_json data_hash
|
148
|
+
# puts "ReadingEvent from JSON = #{deser_event.to_json}"
|
166
149
|
|
167
150
|
# Ensure that the deserialized shared event object conforms
|
168
|
-
expect(
|
151
|
+
expect(event).to eql(deser_event)
|
169
152
|
end
|
170
153
|
end
|
171
154
|
end
|
@@ -20,7 +20,7 @@ require_all 'lib/caliper/entities/entity.rb'
|
|
20
20
|
require_all 'lib/caliper/entities/agent/software_application.rb'
|
21
21
|
require_all 'lib/caliper/entities/agent/person.rb'
|
22
22
|
require_all 'lib/caliper/entities/lis/membership.rb'
|
23
|
-
require_all 'lib/caliper/entities/lis/
|
23
|
+
require_all 'lib/caliper/entities/lis/role.rb'
|
24
24
|
require_all 'lib/caliper/entities/lis/status.rb'
|
25
25
|
require_all 'lib/caliper/entities/lis/course_section.rb'
|
26
26
|
require_all 'lib/caliper/entities/lis/course_offering.rb'
|
@@ -38,137 +38,119 @@ module Caliper
|
|
38
38
|
|
39
39
|
it 'should ensure that a NavigatedTo NavigationEvent is correctly created and serialized' do
|
40
40
|
|
41
|
-
#
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
membership1.roles = [Caliper::Entities::LIS::Roles::LEARNER]
|
49
|
-
membership1.status = Caliper::Entities::LIS::Status::ACTIVE
|
50
|
-
membership1.dateCreated = "2015-08-01T06:00:00.000Z"
|
51
|
-
membership1.dateModified = nil;
|
52
|
-
membership2 = Caliper::Entities::LIS::Membership.new
|
53
|
-
membership2.id = "https://some-university.edu/membership/002"
|
54
|
-
membership2.member = "https://some-university.edu/user/554433"
|
55
|
-
membership2.organization = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001"
|
56
|
-
membership2.roles = [Caliper::Entities::LIS::Roles::LEARNER]
|
57
|
-
membership2.status = Caliper::Entities::LIS::Status::ACTIVE
|
58
|
-
membership2.dateCreated = "2015-08-01T06:00:00.000Z"
|
59
|
-
membership2.dateModified = nil
|
60
|
-
membership3 = Caliper::Entities::LIS::Membership.new
|
61
|
-
membership3.id = "https://some-university.edu/membership/003"
|
62
|
-
membership3.member = "https://some-university.edu/user/554433"
|
63
|
-
membership3.organization = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
64
|
-
membership3.roles = [Caliper::Entities::LIS::Roles::LEARNER]
|
65
|
-
membership3.status = Caliper::Entities::LIS::Status::ACTIVE
|
66
|
-
membership3.dateCreated = "2015-08-01T06:00:00.000Z"
|
67
|
-
membership3.dateModified = nil
|
68
|
-
student.hasMembership = [membership1, membership2, membership3]
|
69
|
-
student.dateCreated = '2015-08-01T06:00:00.000Z'
|
70
|
-
student.dateModified = '2015-09-02T11:30:00.000Z'
|
71
|
-
# puts "new student = #{student.to_json}"
|
72
|
-
|
73
|
-
# The Action
|
41
|
+
# Actor
|
42
|
+
actor = Caliper::Entities::Agent::Person.new
|
43
|
+
actor.id = 'https://some-university.edu/user/554433'
|
44
|
+
actor.dateCreated = '2015-08-01T06:00:00.000Z'
|
45
|
+
actor.dateModified = '2015-09-02T11:30:00.000Z'
|
46
|
+
|
47
|
+
# Action
|
74
48
|
action = Caliper::Profiles::ProfileActions::NAVIGATED_TO
|
75
49
|
|
76
|
-
#
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
#
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
#
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
course = Caliper::Entities::LIS::CourseSection.new
|
115
|
-
course.id = 'https://some-university.edu/politicalScience/2015/american-revolution-101/section/001'
|
116
|
-
course.name = 'American Revolution 101'
|
50
|
+
# Object
|
51
|
+
obj = Caliper::Entities::Reading::EPubVolume.new
|
52
|
+
obj.id = 'https://github.com/readium/readium-js-viewer/book/34843#epubcfi(/4/3)'
|
53
|
+
obj.name = 'The Glorious Cause: The American Revolution, 1763-1789 (Oxford History of the United States)'
|
54
|
+
obj.version = '2nd ed.'
|
55
|
+
obj.dateCreated = '2015-08-01T06:00:00.000Z'
|
56
|
+
obj.dateModified = '2015-09-02T11:30:00.000Z'
|
57
|
+
|
58
|
+
# Target frame
|
59
|
+
target = Caliper::Entities::Reading::Frame.new
|
60
|
+
target.id = 'https://github.com/readium/readium-js-viewer/book/34843#epubcfi(/4/3/1)'
|
61
|
+
target.name = 'Key Figures: George Washington'
|
62
|
+
target.isPartOf = obj
|
63
|
+
target.version = obj.version
|
64
|
+
target.index = 1
|
65
|
+
target.dateCreated = '2015-08-01T06:00:00.000Z'
|
66
|
+
target.dateModified = '2015-09-02T11:30:00.000Z'
|
67
|
+
|
68
|
+
# NavigatedFrom property (specific to Navigation Event)
|
69
|
+
from = Caliper::Entities::Reading::WebPage.new
|
70
|
+
from.id = 'https://some-university.edu/politicalScience/2015/american-revolution-101/index.html'
|
71
|
+
from.name = 'American Revolution 101 Landing Page'
|
72
|
+
from.dateCreated = '2015-08-01T06:00:00.000Z'
|
73
|
+
from.dateModified = '2015-09-02T11:30:00.000Z'
|
74
|
+
from.isPartOf = nil
|
75
|
+
from.version = '1.0'
|
76
|
+
|
77
|
+
# EdApp
|
78
|
+
ed_app = Caliper::Entities::Agent::SoftwareApplication.new
|
79
|
+
ed_app.id = 'https://github.com/readium/readium-js-viewer'
|
80
|
+
ed_app.name = 'Readium'
|
81
|
+
ed_app.dateCreated = '2015-08-01T06:00:00.000Z'
|
82
|
+
ed_app.dateModified = '2015-09-02T11:30:00.000Z'
|
83
|
+
|
84
|
+
# LIS Course Offering
|
85
|
+
course = Caliper::Entities::LIS::CourseOffering.new
|
86
|
+
course.id = "https://some-university.edu/politicalScience/2015/american-revolution-101"
|
87
|
+
course.name = "Political Science 101: The American Revolution"
|
117
88
|
course.courseNumber = "POL101"
|
118
89
|
course.academicSession = "Fall-2015"
|
119
|
-
course.
|
120
|
-
course.membership = [membership2]
|
121
|
-
course.subOrganizationOf = courseOffering
|
90
|
+
course.subOrganizationOf = nil
|
122
91
|
course.dateCreated = '2015-08-01T06:00:00.000Z'
|
123
92
|
course.dateModified = '2015-09-02T11:30:00.000Z'
|
124
93
|
|
94
|
+
# LIS Course Section
|
95
|
+
section = Caliper::Entities::LIS::CourseSection.new
|
96
|
+
section.id = 'https://some-university.edu/politicalScience/2015/american-revolution-101/section/001'
|
97
|
+
section.name = 'American Revolution 101'
|
98
|
+
section.courseNumber = "POL101"
|
99
|
+
section.academicSession = "Fall-2015"
|
100
|
+
section.category = nil
|
101
|
+
section.subOrganizationOf = course
|
102
|
+
section.dateCreated = '2015-08-01T06:00:00.000Z'
|
103
|
+
section.dateModified = '2015-09-02T11:30:00.000Z'
|
104
|
+
|
125
105
|
# LIS Group
|
126
106
|
group = Caliper::Entities::LIS::Group.new
|
127
107
|
group.id = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
128
108
|
group.name = "Discussion Group 001"
|
129
|
-
group.
|
130
|
-
group.subOrganizationOf = course
|
109
|
+
group.subOrganizationOf = section
|
131
110
|
group.dateCreated = '2015-08-01T06:00:00.000Z'
|
132
111
|
group.dateModified = nil
|
133
112
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
113
|
+
membership = Caliper::Entities::LIS::Membership.new
|
114
|
+
membership.id = "https://some-university.edu/politicalScience/2015/american-revolution-101/roster/554433"
|
115
|
+
membership.name = "American Revolution 101"
|
116
|
+
membership.description = "Roster entry"
|
117
|
+
membership.member = "https://some-university.edu/user/554433"
|
118
|
+
membership.organization = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001"
|
119
|
+
membership.roles = [Caliper::Entities::LIS::Role::LEARNER]
|
120
|
+
membership.status = Caliper::Entities::LIS::Status::ACTIVE
|
121
|
+
membership.dateCreated = "2015-08-01T06:00:00.000Z"
|
122
|
+
membership.dateModified = nil
|
123
|
+
|
124
|
+
# Create the Event
|
125
|
+
event = Caliper::Event::NavigationEvent.new
|
126
|
+
event.actor = actor
|
127
|
+
event.action = action
|
128
|
+
event.object = obj
|
129
|
+
event.target = target
|
130
|
+
event.generated = nil
|
131
|
+
event.navigatedFrom = from
|
132
|
+
event.startedAtTime = '2015-09-15T10:15:00.000Z'
|
133
|
+
event.endedAtTime = nil
|
134
|
+
event.duration = nil
|
135
|
+
event.edApp = ed_app
|
136
|
+
event.group = group
|
137
|
+
event.membership = membership
|
138
|
+
# puts "Event JSON = #{event.to_json}'"
|
157
139
|
|
158
140
|
# Load JSON from caliper-common-fixtures for comparison
|
159
141
|
# NOTE - sym link to caliper-common-fixtures needs to exist under spec/fixtures
|
160
142
|
file = File.read('spec/fixtures/caliperNavigationEvent.json')
|
161
143
|
data_hash = JSON.parse(file)
|
162
144
|
expected_json = data_hash.to_json # convert hash back to JSON string after parse
|
163
|
-
|
145
|
+
expect(event.to_json).to be_json_eql(expected_json)#.excluding("actor", "action", "object", "target", "generated", "edApp", "group")
|
164
146
|
|
165
147
|
# puts "JSON from file = #{data_hash}"
|
166
|
-
|
167
|
-
|
168
|
-
# puts "ReadingEvent from JSON = #{
|
148
|
+
deser_event = Caliper::Event::NavigationEvent.new
|
149
|
+
deser_event.from_json data_hash
|
150
|
+
# puts "ReadingEvent from JSON = #{deser_event.to_json}"
|
169
151
|
|
170
152
|
# Ensure that the deserialized shared event object conforms
|
171
|
-
expect(
|
153
|
+
expect(event).to eql(deser_event)
|
172
154
|
end
|
173
155
|
end
|
174
156
|
end
|