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
@@ -20,15 +20,15 @@ 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'
|
27
27
|
require_all 'lib/caliper/entities/lis/group.rb'
|
28
|
+
require_all 'lib/caliper/entities/reading/epub_volume.rb'
|
28
29
|
require_all 'lib/caliper/entities/session/session.rb'
|
29
30
|
require_all 'lib/caliper/event/session_event.rb'
|
30
31
|
require_all 'lib/caliper/profiles/session_profile.rb'
|
31
|
-
require_all 'lib/caliper/entities/reading/epub_volume.rb'
|
32
32
|
require 'json_spec'
|
33
33
|
|
34
34
|
module Caliper
|
@@ -38,136 +38,126 @@ module Caliper
|
|
38
38
|
|
39
39
|
it 'should ensure that a LoggedIn SessionEvent 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::SessionActions::LOGGED_IN
|
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
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
# The LIS Course Section for the Caliper Event
|
125
|
-
course = Caliper::Entities::LIS::CourseSection.new
|
126
|
-
course.id = 'https://some-university.edu/politicalScience/2015/american-revolution-101/section/001'
|
127
|
-
course.name = 'American Revolution 101'
|
50
|
+
# Object (edApp)
|
51
|
+
obj = Caliper::Entities::Agent::SoftwareApplication.new
|
52
|
+
obj.id = 'https://github.com/readium/readium-js-viewer'
|
53
|
+
obj.name = 'Readium'
|
54
|
+
obj.dateCreated = '2015-08-01T06:00:00.000Z'
|
55
|
+
obj.dateModified = '2015-09-02T11:30:00.000Z'
|
56
|
+
|
57
|
+
# ePub parent (target.isPartOf)
|
58
|
+
ePub = Caliper::Entities::Reading::EPubVolume.new
|
59
|
+
ePub.id = 'https://github.com/readium/readium-js-viewer/book/34843#epubcfi(/4/3)'
|
60
|
+
ePub.name = 'The Glorious Cause: The American Revolution, 1763-1789 (Oxford History of the United States)'
|
61
|
+
ePub.version = '2nd ed.'
|
62
|
+
ePub.dateCreated = '2015-08-01T06:00:00.000Z'
|
63
|
+
ePub.dateModified = '2015-09-02T11:30:00.000Z'
|
64
|
+
|
65
|
+
# Target frame
|
66
|
+
target = Caliper::Entities::Reading::Frame.new
|
67
|
+
target.id = 'https://github.com/readium/readium-js-viewer/book/34843#epubcfi(/4/3/1)'
|
68
|
+
target.name = 'Key Figures: George Washington'
|
69
|
+
target.isPartOf = ePub
|
70
|
+
target.version = ePub.version
|
71
|
+
target.index = 1
|
72
|
+
target.dateCreated = '2015-08-01T06:00:00.000Z'
|
73
|
+
target.dateModified = '2015-09-02T11:30:00.000Z'
|
74
|
+
|
75
|
+
# Generated session
|
76
|
+
generated = Caliper::Entities::Session::Session.new
|
77
|
+
generated.id = 'https://github.com/readium/session-123456789'
|
78
|
+
generated.name = 'session-123456789'
|
79
|
+
generated.description = nil
|
80
|
+
generated.actor = actor
|
81
|
+
generated.startedAtTime = '2015-09-15T10:15:00.000Z'
|
82
|
+
generated.endedAtTime = nil
|
83
|
+
generated.duration = nil
|
84
|
+
generated.dateCreated = '2015-08-01T06:00:00.000Z'
|
85
|
+
generated.dateModified = '2015-09-02T11:30:00.000Z'
|
86
|
+
|
87
|
+
# EdApp
|
88
|
+
ed_app = Caliper::Entities::Agent::SoftwareApplication.new
|
89
|
+
ed_app.id = 'https://github.com/readium/readium-js-viewer'
|
90
|
+
ed_app.name = 'Readium'
|
91
|
+
ed_app.dateCreated = '2015-08-01T06:00:00.000Z'
|
92
|
+
ed_app.dateModified = '2015-09-02T11:30:00.000Z'
|
93
|
+
|
94
|
+
# LIS Course Offering
|
95
|
+
course = Caliper::Entities::LIS::CourseOffering.new
|
96
|
+
course.id = "https://some-university.edu/politicalScience/2015/american-revolution-101"
|
97
|
+
course.name = "Political Science 101: The American Revolution"
|
128
98
|
course.courseNumber = "POL101"
|
129
99
|
course.academicSession = "Fall-2015"
|
130
|
-
course.
|
131
|
-
course.membership = [membership2]
|
132
|
-
course.subOrganizationOf = courseOffering
|
100
|
+
course.subOrganizationOf = nil
|
133
101
|
course.dateCreated = '2015-08-01T06:00:00.000Z'
|
134
102
|
course.dateModified = '2015-09-02T11:30:00.000Z'
|
135
103
|
|
104
|
+
# LIS Course Section
|
105
|
+
section = Caliper::Entities::LIS::CourseSection.new
|
106
|
+
section.id = 'https://some-university.edu/politicalScience/2015/american-revolution-101/section/001'
|
107
|
+
section.name = 'American Revolution 101'
|
108
|
+
section.courseNumber = "POL101"
|
109
|
+
section.academicSession = "Fall-2015"
|
110
|
+
section.category = nil
|
111
|
+
section.subOrganizationOf = course
|
112
|
+
section.dateCreated = '2015-08-01T06:00:00.000Z'
|
113
|
+
section.dateModified = '2015-09-02T11:30:00.000Z'
|
114
|
+
|
136
115
|
# LIS Group
|
137
116
|
group = Caliper::Entities::LIS::Group.new
|
138
117
|
group.id = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
139
118
|
group.name = "Discussion Group 001"
|
140
|
-
group.
|
141
|
-
group.subOrganizationOf = course
|
119
|
+
group.subOrganizationOf = section
|
142
120
|
group.dateCreated = '2015-08-01T06:00:00.000Z'
|
143
121
|
group.dateModified = nil
|
144
122
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
123
|
+
membership = Caliper::Entities::LIS::Membership.new
|
124
|
+
membership.id = "https://some-university.edu/politicalScience/2015/american-revolution-101/roster/554433"
|
125
|
+
membership.name = "American Revolution 101"
|
126
|
+
membership.description = "Roster entry"
|
127
|
+
membership.member = "https://some-university.edu/user/554433"
|
128
|
+
membership.organization = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001"
|
129
|
+
membership.roles = [Caliper::Entities::LIS::Role::LEARNER]
|
130
|
+
membership.status = Caliper::Entities::LIS::Status::ACTIVE
|
131
|
+
membership.dateCreated = "2015-08-01T06:00:00.000Z"
|
132
|
+
membership.dateModified = nil
|
133
|
+
|
134
|
+
# Create the Event
|
135
|
+
event = SessionEvent.new
|
136
|
+
event.actor = actor
|
137
|
+
event.action = action
|
138
|
+
event.object = obj
|
139
|
+
event.target = target
|
140
|
+
event.generated = generated
|
141
|
+
event.startedAtTime = '2015-09-15T10:15:00.000Z'
|
142
|
+
event.edApp = ed_app
|
143
|
+
event.group = group
|
144
|
+
event.membership = membership
|
145
|
+
# puts "Event JSON = #{event.to_json}'"
|
156
146
|
|
157
147
|
# Load JSON from caliper-common-fixtures for comparison
|
158
148
|
# NOTE - sym link to caliper-common-fixtures needs to exist under spec/fixtures
|
159
149
|
file = File.read('spec/fixtures/caliperSessionLoginEvent.json')
|
160
150
|
data_hash = JSON.parse(file)
|
161
151
|
expected_json = data_hash.to_json # convert hash back to JSON string after parse
|
162
|
-
|
152
|
+
expect(event.to_json).to be_json_eql(expected_json)#.excluding("actor", "action", "object", "target", "generated", "edApp", "group")
|
163
153
|
|
164
154
|
# puts "JSON from file = #{data_hash}"
|
165
|
-
|
166
|
-
|
167
|
-
# puts "SessionEvent from JSON = #{
|
155
|
+
deser_event = SessionEvent.new
|
156
|
+
deser_event.from_json data_hash
|
157
|
+
# puts "SessionEvent from JSON = #{deser_event.to_json}"
|
168
158
|
|
169
159
|
# Ensure that the deserialized session event object conforms
|
170
|
-
expect(
|
160
|
+
expect(event).to eql(deser_event)
|
171
161
|
end
|
172
162
|
end
|
173
163
|
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'
|
@@ -37,121 +37,106 @@ module Caliper
|
|
37
37
|
|
38
38
|
it 'should ensure that a loggedOut SessionEvent is correctly created and serialized' do
|
39
39
|
|
40
|
-
#
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
membership2.organization = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001"
|
55
|
-
membership2.roles = [Caliper::Entities::LIS::Roles::LEARNER]
|
56
|
-
membership2.status = Caliper::Entities::LIS::Status::ACTIVE
|
57
|
-
membership2.dateCreated = "2015-08-01T06:00:00.000Z"
|
58
|
-
membership2.dateModified = nil
|
59
|
-
membership3 = Caliper::Entities::LIS::Membership.new
|
60
|
-
membership3.id = "https://some-university.edu/membership/003"
|
61
|
-
membership3.member = "https://some-university.edu/user/554433"
|
62
|
-
membership3.organization = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
63
|
-
membership3.roles = [Caliper::Entities::LIS::Roles::LEARNER]
|
64
|
-
membership3.status = Caliper::Entities::LIS::Status::ACTIVE
|
65
|
-
membership3.dateCreated = "2015-08-01T06:00:00.000Z"
|
66
|
-
membership3.dateModified = nil
|
67
|
-
student.hasMembership = [membership1, membership2, membership3]
|
68
|
-
student.dateCreated = '2015-08-01T06:00:00.000Z'
|
69
|
-
student.dateModified = '2015-09-02T11:30:00.000Z'
|
70
|
-
# puts "new student = #{student.to_json}"
|
71
|
-
|
72
|
-
# The Action
|
40
|
+
# EdApp
|
41
|
+
ed_app = Caliper::Entities::Agent::SoftwareApplication.new
|
42
|
+
ed_app.id = 'https://github.com/readium/readium-js-viewer'
|
43
|
+
ed_app.name = 'Readium'
|
44
|
+
ed_app.dateCreated = '2015-08-01T06:00:00.000Z'
|
45
|
+
ed_app.dateModified = '2015-09-02T11:30:00.000Z'
|
46
|
+
|
47
|
+
# Actor
|
48
|
+
actor = Caliper::Entities::Agent::Person.new
|
49
|
+
actor.id = 'https://some-university.edu/user/554433'
|
50
|
+
actor.dateCreated = '2015-08-01T06:00:00.000Z'
|
51
|
+
actor.dateModified = '2015-09-02T11:30:00.000Z'
|
52
|
+
|
53
|
+
# Action
|
73
54
|
action = Caliper::Profiles::SessionActions::LOGGED_OUT
|
74
55
|
|
75
|
-
#
|
76
|
-
|
77
|
-
edApp.id = 'https://github.com/readium/readium-js-viewer'
|
78
|
-
edApp.name = 'Readium'
|
79
|
-
edApp.hasMembership = []
|
80
|
-
edApp.dateCreated = '2015-08-01T06:00:00.000Z'
|
81
|
-
edApp.dateModified = '2015-09-02T11:30:00.000Z'
|
56
|
+
# Object (edApp)
|
57
|
+
obj = ed_app
|
82
58
|
|
83
|
-
#
|
59
|
+
# Target session
|
84
60
|
session = Caliper::Entities::Session::Session.new
|
85
61
|
session.id = 'https://github.com/readium/session-123456789'
|
86
62
|
session.name = 'session-123456789'
|
87
63
|
session.description = nil
|
88
|
-
session.actor =
|
64
|
+
session.actor = actor
|
89
65
|
session.startedAtTime = '2015-09-15T10:15:00.000Z'
|
90
66
|
session.endedAtTime = '2015-09-15T11:05:00.000Z'
|
91
67
|
session.duration = 'PT3000S'
|
92
68
|
session.dateCreated = '2015-08-01T06:00:00.000Z'
|
93
69
|
session.dateModified = '2015-09-02T11:30:00.000Z'
|
94
70
|
|
95
|
-
#LIS Course Offering
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
courseOffering.courseNumber = "POL101"
|
100
|
-
courseOffering.academicSession = "Fall-2015"
|
101
|
-
courseOffering.membership = []
|
102
|
-
courseOffering.subOrganizationOf = nil
|
103
|
-
courseOffering.dateCreated = '2015-08-01T06:00:00.000Z'
|
104
|
-
courseOffering.dateModified = '2015-09-02T11:30:00.000Z'
|
105
|
-
|
106
|
-
# The LIS Course Section for the Caliper Event
|
107
|
-
course = Caliper::Entities::LIS::CourseSection.new
|
108
|
-
course.id = 'https://some-university.edu/politicalScience/2015/american-revolution-101/section/001'
|
109
|
-
course.name = 'American Revolution 101'
|
71
|
+
# LIS Course Offering
|
72
|
+
course = Caliper::Entities::LIS::CourseOffering.new
|
73
|
+
course.id = "https://some-university.edu/politicalScience/2015/american-revolution-101"
|
74
|
+
course.name = "Political Science 101: The American Revolution"
|
110
75
|
course.courseNumber = "POL101"
|
111
76
|
course.academicSession = "Fall-2015"
|
112
|
-
course.
|
113
|
-
course.membership = [membership2]
|
114
|
-
course.subOrganizationOf = courseOffering
|
77
|
+
course.subOrganizationOf = nil
|
115
78
|
course.dateCreated = '2015-08-01T06:00:00.000Z'
|
116
79
|
course.dateModified = '2015-09-02T11:30:00.000Z'
|
117
80
|
|
81
|
+
# LIS Course Section
|
82
|
+
section = Caliper::Entities::LIS::CourseSection.new
|
83
|
+
section.id = 'https://some-university.edu/politicalScience/2015/american-revolution-101/section/001'
|
84
|
+
section.name = 'American Revolution 101'
|
85
|
+
section.courseNumber = "POL101"
|
86
|
+
section.academicSession = "Fall-2015"
|
87
|
+
section.category = nil
|
88
|
+
section.subOrganizationOf = course
|
89
|
+
section.dateCreated = '2015-08-01T06:00:00.000Z'
|
90
|
+
section.dateModified = '2015-09-02T11:30:00.000Z'
|
91
|
+
|
118
92
|
# LIS Group
|
119
93
|
group = Caliper::Entities::LIS::Group.new
|
120
94
|
group.id = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
121
95
|
group.name = "Discussion Group 001"
|
122
|
-
group.
|
123
|
-
group.subOrganizationOf = course
|
96
|
+
group.subOrganizationOf = section
|
124
97
|
group.dateCreated = '2015-08-01T06:00:00.000Z'
|
125
98
|
group.dateModified = nil
|
126
99
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
100
|
+
membership = Caliper::Entities::LIS::Membership.new
|
101
|
+
membership.id = "https://some-university.edu/politicalScience/2015/american-revolution-101/roster/554433"
|
102
|
+
membership.name = "American Revolution 101"
|
103
|
+
membership.description = "Roster entry"
|
104
|
+
membership.member = "https://some-university.edu/user/554433"
|
105
|
+
membership.organization = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001"
|
106
|
+
membership.roles = [Caliper::Entities::LIS::Role::LEARNER]
|
107
|
+
membership.status = Caliper::Entities::LIS::Status::ACTIVE
|
108
|
+
membership.dateCreated = "2015-08-01T06:00:00.000Z"
|
109
|
+
membership.dateModified = nil
|
110
|
+
|
111
|
+
# Create Event
|
112
|
+
event = SessionEvent.new
|
113
|
+
event.actor = actor
|
114
|
+
event.action = action
|
115
|
+
event.object = obj
|
116
|
+
event.target = session
|
117
|
+
event.generated = nil
|
118
|
+
event.startedAtTime = '2015-09-15T10:15:00.000Z'
|
119
|
+
event.endedAtTime = '2015-09-15T11:05:00.000Z'
|
120
|
+
event.duration = 'PT3000S'
|
121
|
+
event.edApp = ed_app
|
122
|
+
event.group = group
|
123
|
+
event.membership = membership
|
124
|
+
# puts "Event JSON = #{event.to_json}'"
|
140
125
|
|
141
126
|
# Load JSON from caliper-common-fixtures for comparison
|
142
127
|
# NOTE - sym link to caliper-common-fixtures needs to exist under spec/fixtures
|
143
128
|
file = File.read('spec/fixtures/caliperSessionLogoutEvent.json')
|
144
129
|
data_hash = JSON.parse(file)
|
145
130
|
expected_json = data_hash.to_json # convert hash back to JSON string after parse
|
146
|
-
|
131
|
+
expect(event.to_json).to be_json_eql(expected_json)#.excluding("actor", "action", "object", "target", "generated", "edApp", "group")
|
147
132
|
|
148
133
|
# puts "JSON from file = #{data_hash}"
|
149
|
-
|
150
|
-
|
151
|
-
# puts "SessionEvent from JSON = #{
|
134
|
+
deser_event = SessionEvent.new
|
135
|
+
deser_event.from_json data_hash
|
136
|
+
# puts "SessionEvent from JSON = #{deser_event.to_json}"
|
152
137
|
|
153
138
|
# Ensure that the deserialized session event object conforms
|
154
|
-
expect(
|
139
|
+
expect(event).to eql(deser_event)
|
155
140
|
end
|
156
141
|
end
|
157
142
|
end
|