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,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,59 +38,34 @@ module Caliper
|
|
38
38
|
|
39
39
|
it 'should ensure that a Bookmarked AnnotationEvent 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::AnnotationActions::BOOKMARKED
|
75
49
|
|
76
|
-
#
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
50
|
+
# ePub parent volume
|
51
|
+
ePub = Caliper::Entities::Reading::EPubVolume.new
|
52
|
+
ePub.id = 'https://github.com/readium/readium-js-viewer/book/34843#epubcfi(/4/3)'
|
53
|
+
ePub.name = 'The Glorious Cause: The American Revolution, 1763-1789 (Oxford History of the United States)'
|
54
|
+
ePub.version = '2nd ed.'
|
55
|
+
ePub.dateCreated = '2015-08-01T06:00:00.000Z'
|
56
|
+
ePub.dateModified = '2015-09-02T11:30:00.000Z'
|
57
|
+
|
58
|
+
# Object
|
59
|
+
obj = Caliper::Entities::Reading::Frame.new
|
60
|
+
obj.id = 'https://github.com/readium/readium-js-viewer/book/34843#epubcfi(/4/3/2)'
|
61
|
+
obj.name = 'Key Figures: Lord North'
|
62
|
+
obj.isPartOf = ePub
|
63
|
+
obj.version = ePub.version
|
64
|
+
obj.index = 2
|
65
|
+
obj.dateCreated = '2015-08-01T06:00:00.000Z'
|
66
|
+
obj.dateModified = '2015-09-02T11:30:00.000Z'
|
67
|
+
|
68
|
+
# Generated annotation
|
94
69
|
bookmark = Caliper::Entities::Annotation::BookmarkAnnotation.new
|
95
70
|
bookmark.id = 'https://someEduApp.edu/bookmarks/00001'
|
96
71
|
bookmark.name = nil
|
@@ -100,74 +75,82 @@ module Caliper
|
|
100
75
|
bookmark.annotated = 'https://github.com/readium/readium-js-viewer/book/34843#epubcfi(/4/3/2)'
|
101
76
|
bookmark.bookmarkNotes = 'The Intolerable Acts (1774)--bad idea Lord North'
|
102
77
|
|
103
|
-
#
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
courseOffering.name = "Political Science 101: The American Revolution"
|
115
|
-
courseOffering.courseNumber = "POL101"
|
116
|
-
courseOffering.academicSession = "Fall-2015"
|
117
|
-
courseOffering.membership = []
|
118
|
-
courseOffering.subOrganizationOf = nil
|
119
|
-
courseOffering.dateCreated = '2015-08-01T06:00:00.000Z'
|
120
|
-
courseOffering.dateModified = '2015-09-02T11:30:00.000Z'
|
121
|
-
|
122
|
-
# The LIS Course Section for the Caliper Event
|
123
|
-
course = Caliper::Entities::LIS::CourseSection.new
|
124
|
-
course.id = 'https://some-university.edu/politicalScience/2015/american-revolution-101/section/001'
|
125
|
-
course.name = 'American Revolution 101'
|
78
|
+
# Readium app
|
79
|
+
ed_app = Caliper::Entities::Agent::SoftwareApplication.new
|
80
|
+
ed_app.id = 'https://github.com/readium/readium-js-viewer'
|
81
|
+
ed_app.name = 'Readium'
|
82
|
+
ed_app.dateCreated = '2015-08-01T06:00:00.000Z'
|
83
|
+
ed_app.dateModified = '2015-09-02T11:30:00.000Z'
|
84
|
+
|
85
|
+
# LIS Course Offering
|
86
|
+
course = Caliper::Entities::LIS::CourseOffering.new
|
87
|
+
course.id = "https://some-university.edu/politicalScience/2015/american-revolution-101"
|
88
|
+
course.name = "Political Science 101: The American Revolution"
|
126
89
|
course.courseNumber = "POL101"
|
127
90
|
course.academicSession = "Fall-2015"
|
128
|
-
course.
|
129
|
-
course.membership = [membership2]
|
130
|
-
course.subOrganizationOf = courseOffering
|
91
|
+
course.subOrganizationOf = nil
|
131
92
|
course.dateCreated = '2015-08-01T06:00:00.000Z'
|
132
93
|
course.dateModified = '2015-09-02T11:30:00.000Z'
|
94
|
+
|
95
|
+
# LIS Course Section
|
96
|
+
section = Caliper::Entities::LIS::CourseSection.new
|
97
|
+
section.id = 'https://some-university.edu/politicalScience/2015/american-revolution-101/section/001'
|
98
|
+
section.name = 'American Revolution 101'
|
99
|
+
section.courseNumber = "POL101"
|
100
|
+
section.academicSession = "Fall-2015"
|
101
|
+
section.category = nil
|
102
|
+
section.subOrganizationOf = course
|
103
|
+
section.dateCreated = '2015-08-01T06:00:00.000Z'
|
104
|
+
section.dateModified = '2015-09-02T11:30:00.000Z'
|
133
105
|
|
134
106
|
# LIS Group
|
135
107
|
group = Caliper::Entities::LIS::Group.new
|
136
108
|
group.id = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
137
109
|
group.name = "Discussion Group 001"
|
138
|
-
group.
|
139
|
-
group.subOrganizationOf = course
|
110
|
+
group.subOrganizationOf = section
|
140
111
|
group.dateCreated = '2015-08-01T06:00:00.000Z'
|
141
112
|
group.dateModified = nil
|
142
113
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
114
|
+
membership = Caliper::Entities::LIS::Membership.new
|
115
|
+
membership.id = "https://some-university.edu/politicalScience/2015/american-revolution-101/roster/554433"
|
116
|
+
membership.name = "American Revolution 101"
|
117
|
+
membership.description = "Roster entry"
|
118
|
+
membership.member = "https://some-university.edu/user/554433"
|
119
|
+
membership.organization = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001"
|
120
|
+
membership.roles = [Caliper::Entities::LIS::Role::LEARNER]
|
121
|
+
membership.status = Caliper::Entities::LIS::Status::ACTIVE
|
122
|
+
membership.dateCreated = "2015-08-01T06:00:00.000Z"
|
123
|
+
membership.dateModified = nil
|
124
|
+
|
125
|
+
# Create the Event
|
126
|
+
event = AnnotationEvent.new
|
127
|
+
event.actor = actor
|
128
|
+
event.action = action
|
129
|
+
event.object = obj
|
130
|
+
event.target = nil
|
131
|
+
event.generated = bookmark
|
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}'"
|
156
139
|
|
157
140
|
# Load JSON from caliper-common-fixtures for comparison
|
158
141
|
# NOTE - sym link to caliper-common-fixtures needs to exist under spec/fixtures
|
159
142
|
file = File.read('spec/fixtures/caliperBookmarkAnnotationEvent.json')
|
160
143
|
data_hash = JSON.parse(file)
|
161
144
|
expected_json = data_hash.to_json # convert hash back to JSON string after parse
|
162
|
-
|
145
|
+
expect(event.to_json).to be_json_eql(expected_json)#.excluding("actor", "action", "object", "target", "generated", "ed_app", "group")
|
163
146
|
|
164
147
|
# puts "JSON from file = #{data_hash}"
|
165
|
-
|
166
|
-
|
167
|
-
# puts "AnnotationEvent from JSON = #{
|
148
|
+
deser_event = AnnotationEvent.new
|
149
|
+
deser_event.from_json data_hash
|
150
|
+
# puts "AnnotationEvent from JSON = #{deser_event.to_json}"
|
168
151
|
|
169
152
|
# Ensure that the deserialized bookmark event object conforms
|
170
|
-
expect(
|
153
|
+
expect(event).to eql(deser_event)
|
171
154
|
end
|
172
155
|
end
|
173
156
|
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,59 +38,34 @@ module Caliper
|
|
38
38
|
|
39
39
|
it 'should ensure that a Highlighted AnnotationEvent 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::AnnotationActions::HIGHLIGHTED
|
75
49
|
|
76
|
-
#
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
50
|
+
# ePub parent volume
|
51
|
+
ePub = Caliper::Entities::Reading::EPubVolume.new
|
52
|
+
ePub.id = 'https://github.com/readium/readium-js-viewer/book/34843#epubcfi(/4/3)'
|
53
|
+
ePub.name = 'The Glorious Cause: The American Revolution, 1763-1789 (Oxford History of the United States)'
|
54
|
+
ePub.version = '2nd ed.'
|
55
|
+
ePub.dateCreated = '2015-08-01T06:00:00.000Z'
|
56
|
+
ePub.dateModified = '2015-09-02T11:30:00.000Z'
|
57
|
+
|
58
|
+
# Object
|
59
|
+
obj = Caliper::Entities::Reading::Frame.new
|
60
|
+
obj.id = 'https://github.com/readium/readium-js-viewer/book/34843#epubcfi(/4/3/1)'
|
61
|
+
obj.name = 'Key Figures: George Washington'
|
62
|
+
obj.isPartOf = ePub
|
63
|
+
obj.version = ePub.version
|
64
|
+
obj.index = 1
|
65
|
+
obj.dateCreated = '2015-08-01T06:00:00.000Z'
|
66
|
+
obj.dateModified = '2015-09-02T11:30:00.000Z'
|
67
|
+
|
68
|
+
# Generated annotation
|
94
69
|
highlight = Caliper::Entities::Annotation::HighlightAnnotation.new
|
95
70
|
highlight.id = 'https://someEduApp.edu/highlights/12345'
|
96
71
|
highlight.name = nil
|
@@ -101,74 +76,82 @@ module Caliper
|
|
101
76
|
highlight.selectionText = 'Life, Liberty and the pursuit of Happiness'
|
102
77
|
highlight.selection = { 'start' => '455', 'end' => '489'}
|
103
78
|
|
104
|
-
#
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
courseOffering.name = "Political Science 101: The American Revolution"
|
116
|
-
courseOffering.courseNumber = "POL101"
|
117
|
-
courseOffering.academicSession = "Fall-2015"
|
118
|
-
courseOffering.membership = []
|
119
|
-
courseOffering.subOrganizationOf = nil
|
120
|
-
courseOffering.dateCreated = '2015-08-01T06:00:00.000Z'
|
121
|
-
courseOffering.dateModified = '2015-09-02T11:30:00.000Z'
|
122
|
-
|
123
|
-
# The LIS Course Section for the Caliper Event
|
124
|
-
course = Caliper::Entities::LIS::CourseSection.new
|
125
|
-
course.id = 'https://some-university.edu/politicalScience/2015/american-revolution-101/section/001'
|
126
|
-
course.name = 'American Revolution 101'
|
79
|
+
# Readium app
|
80
|
+
ed_app = Caliper::Entities::Agent::SoftwareApplication.new
|
81
|
+
ed_app.id = 'https://github.com/readium/readium-js-viewer'
|
82
|
+
ed_app.name = 'Readium'
|
83
|
+
ed_app.dateCreated = '2015-08-01T06:00:00.000Z'
|
84
|
+
ed_app.dateModified = '2015-09-02T11:30:00.000Z'
|
85
|
+
|
86
|
+
# LIS Course Offering
|
87
|
+
course = Caliper::Entities::LIS::CourseOffering.new
|
88
|
+
course.id = "https://some-university.edu/politicalScience/2015/american-revolution-101"
|
89
|
+
course.name = "Political Science 101: The American Revolution"
|
127
90
|
course.courseNumber = "POL101"
|
128
91
|
course.academicSession = "Fall-2015"
|
129
|
-
course.
|
130
|
-
course.membership = [membership2]
|
131
|
-
course.subOrganizationOf = courseOffering
|
92
|
+
course.subOrganizationOf = nil
|
132
93
|
course.dateCreated = '2015-08-01T06:00:00.000Z'
|
133
94
|
course.dateModified = '2015-09-02T11:30:00.000Z'
|
134
95
|
|
96
|
+
# LIS Course Section
|
97
|
+
section = Caliper::Entities::LIS::CourseSection.new
|
98
|
+
section.id = 'https://some-university.edu/politicalScience/2015/american-revolution-101/section/001'
|
99
|
+
section.name = 'American Revolution 101'
|
100
|
+
section.courseNumber = "POL101"
|
101
|
+
section.academicSession = "Fall-2015"
|
102
|
+
section.category = nil
|
103
|
+
section.subOrganizationOf = course
|
104
|
+
section.dateCreated = '2015-08-01T06:00:00.000Z'
|
105
|
+
section.dateModified = '2015-09-02T11:30:00.000Z'
|
106
|
+
|
135
107
|
# LIS Group
|
136
108
|
group = Caliper::Entities::LIS::Group.new
|
137
109
|
group.id = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
138
110
|
group.name = "Discussion Group 001"
|
139
|
-
group.
|
140
|
-
group.subOrganizationOf = course
|
111
|
+
group.subOrganizationOf = section
|
141
112
|
group.dateCreated = '2015-08-01T06:00:00.000Z'
|
142
113
|
group.dateModified = nil
|
143
114
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
115
|
+
membership = Caliper::Entities::LIS::Membership.new
|
116
|
+
membership.id = "https://some-university.edu/politicalScience/2015/american-revolution-101/roster/554433"
|
117
|
+
membership.name = "American Revolution 101"
|
118
|
+
membership.description = "Roster entry"
|
119
|
+
membership.member = "https://some-university.edu/user/554433"
|
120
|
+
membership.organization = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001"
|
121
|
+
membership.roles = [Caliper::Entities::LIS::Role::LEARNER]
|
122
|
+
membership.status = Caliper::Entities::LIS::Status::ACTIVE
|
123
|
+
membership.dateCreated = "2015-08-01T06:00:00.000Z"
|
124
|
+
membership.dateModified = nil
|
125
|
+
|
126
|
+
# Create the Event
|
127
|
+
event = AnnotationEvent.new
|
128
|
+
event.actor = actor
|
129
|
+
event.action = action
|
130
|
+
event.object = obj
|
131
|
+
event.target = nil
|
132
|
+
event.generated = highlight
|
133
|
+
event.startedAtTime = '2015-09-15T10:15:00.000Z'
|
134
|
+
event.endedAtTime = nil
|
135
|
+
event.duration = nil
|
136
|
+
event.edApp = ed_app
|
137
|
+
event.group = group
|
138
|
+
event.membership = membership
|
139
|
+
# puts "Event JSON = #{event.to_json}'"
|
157
140
|
|
158
141
|
# Load JSON from caliper-common-fixtures for comparison
|
159
142
|
# NOTE - sym link to caliper-common-fixtures needs to exist under spec/fixtures
|
160
143
|
file = File.read('spec/fixtures/caliperHighlightAnnotationEvent.json')
|
161
144
|
data_hash = JSON.parse(file)
|
162
145
|
expected_json = data_hash.to_json # convert hash back to JSON string after parse
|
163
|
-
|
146
|
+
expect(event.to_json).to be_json_eql(expected_json)#.excluding("actor", "action", "object", "target", "generated", "ed_app", "group")
|
164
147
|
|
165
148
|
# puts "JSON from file = #{data_hash}"
|
166
|
-
|
167
|
-
|
168
|
-
# puts "AnnotationEvent from JSON = #{
|
149
|
+
deser_event = AnnotationEvent.new
|
150
|
+
deser_event.from_json data_hash
|
151
|
+
# puts "AnnotationEvent from JSON = #{deser_event.to_json}"
|
169
152
|
|
170
153
|
# Ensure that the deserialized highlight event object conforms
|
171
|
-
expect(
|
154
|
+
expect(event).to eql(deser_event)
|
172
155
|
end
|
173
156
|
end
|
174
157
|
end
|