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 Shared 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::SHARED
|
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/3)'
|
61
|
+
obj.name = 'Key Figures: John Adams'
|
62
|
+
obj.isPartOf = ePub
|
63
|
+
obj.version = ePub.version
|
64
|
+
obj.index = 3
|
65
|
+
obj.dateCreated = '2015-08-01T06:00:00.000Z'
|
66
|
+
obj.dateModified = '2015-09-02T11:30:00.000Z'
|
67
|
+
|
68
|
+
# Generated annotation
|
94
69
|
shared = Caliper::Entities::Annotation::SharedAnnotation.new
|
95
70
|
shared.id = 'https://someEduApp.edu/shared/9999'
|
96
71
|
shared.name = nil
|
@@ -101,86 +76,92 @@ module Caliper
|
|
101
76
|
|
102
77
|
classmate1 = Caliper::Entities::Agent::Person.new
|
103
78
|
classmate1.id = 'https://some-university.edu/students/657585'
|
104
|
-
classmate1.hasMembership = []
|
105
79
|
classmate1.dateCreated = '2015-08-01T06:00:00.000Z'
|
106
80
|
classmate1.dateModified = '2015-09-02T11:30:00.000Z'
|
107
81
|
|
108
82
|
classmate2 = Caliper::Entities::Agent::Person.new
|
109
83
|
classmate2.id = 'https://some-university.edu/students/667788'
|
110
|
-
classmate2.hasMembership = []
|
111
84
|
classmate2.dateCreated = '2015-08-01T06:00:00.000Z'
|
112
85
|
classmate2.dateModified = '2015-09-02T11:30:00.000Z'
|
113
86
|
|
114
87
|
shared.withAgents = [classmate1, classmate2]
|
115
88
|
|
116
|
-
#
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
courseOffering.name = "Political Science 101: The American Revolution"
|
128
|
-
courseOffering.courseNumber = "POL101"
|
129
|
-
courseOffering.academicSession = "Fall-2015"
|
130
|
-
courseOffering.membership = []
|
131
|
-
courseOffering.subOrganizationOf = nil
|
132
|
-
courseOffering.dateCreated = '2015-08-01T06:00:00.000Z'
|
133
|
-
courseOffering.dateModified = '2015-09-02T11:30:00.000Z'
|
134
|
-
|
135
|
-
# The LIS Course Section for the Caliper Event
|
136
|
-
course = Caliper::Entities::LIS::CourseSection.new
|
137
|
-
course.id = 'https://some-university.edu/politicalScience/2015/american-revolution-101/section/001'
|
138
|
-
course.name = 'American Revolution 101'
|
89
|
+
# Readium app
|
90
|
+
ed_app = Caliper::Entities::Agent::SoftwareApplication.new
|
91
|
+
ed_app.id = 'https://github.com/readium/readium-js-viewer'
|
92
|
+
ed_app.name = 'Readium'
|
93
|
+
ed_app.dateCreated = '2015-08-01T06:00:00.000Z'
|
94
|
+
ed_app.dateModified = '2015-09-02T11:30:00.000Z'
|
95
|
+
|
96
|
+
# LIS Course Offering
|
97
|
+
course = Caliper::Entities::LIS::CourseOffering.new
|
98
|
+
course.id = "https://some-university.edu/politicalScience/2015/american-revolution-101"
|
99
|
+
course.name = "Political Science 101: The American Revolution"
|
139
100
|
course.courseNumber = "POL101"
|
140
101
|
course.academicSession = "Fall-2015"
|
141
|
-
course.
|
142
|
-
course.membership = [membership2]
|
143
|
-
course.subOrganizationOf = courseOffering
|
102
|
+
course.subOrganizationOf = nil
|
144
103
|
course.dateCreated = '2015-08-01T06:00:00.000Z'
|
145
104
|
course.dateModified = '2015-09-02T11:30:00.000Z'
|
146
105
|
|
106
|
+
# LIS Course Section
|
107
|
+
section = Caliper::Entities::LIS::CourseSection.new
|
108
|
+
section.id = 'https://some-university.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.category = nil
|
113
|
+
section.subOrganizationOf = course
|
114
|
+
section.dateCreated = '2015-08-01T06:00:00.000Z'
|
115
|
+
section.dateModified = '2015-09-02T11:30:00.000Z'
|
116
|
+
|
147
117
|
# LIS Group
|
148
118
|
group = Caliper::Entities::LIS::Group.new
|
149
119
|
group.id = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
150
120
|
group.name = "Discussion Group 001"
|
151
|
-
group.
|
152
|
-
group.subOrganizationOf = course
|
121
|
+
group.subOrganizationOf = section
|
153
122
|
group.dateCreated = '2015-08-01T06:00:00.000Z'
|
154
123
|
group.dateModified = nil
|
155
124
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
125
|
+
membership = Caliper::Entities::LIS::Membership.new
|
126
|
+
membership.id = "https://some-university.edu/politicalScience/2015/american-revolution-101/roster/554433"
|
127
|
+
membership.name = "American Revolution 101"
|
128
|
+
membership.description = "Roster entry"
|
129
|
+
membership.member = "https://some-university.edu/user/554433"
|
130
|
+
membership.organization = "https://some-university.edu/politicalScience/2015/american-revolution-101/section/001"
|
131
|
+
membership.roles = [Caliper::Entities::LIS::Role::LEARNER]
|
132
|
+
membership.status = Caliper::Entities::LIS::Status::ACTIVE
|
133
|
+
membership.dateCreated = "2015-08-01T06:00:00.000Z"
|
134
|
+
membership.dateModified = nil
|
135
|
+
|
136
|
+
# Create the Event
|
137
|
+
event = AnnotationEvent.new
|
138
|
+
event.actor = actor
|
139
|
+
event.action = action
|
140
|
+
event.object = obj
|
141
|
+
event.target = nil
|
142
|
+
event.generated = shared
|
143
|
+
event.startedAtTime = '2015-09-15T10:15:00.000Z'
|
144
|
+
event.endedAtTime = nil
|
145
|
+
event.duration = nil
|
146
|
+
event.edApp = ed_app
|
147
|
+
event.group = group
|
148
|
+
event.membership = membership
|
149
|
+
# puts "Event JSON = #{event.to_json}'"
|
169
150
|
|
170
151
|
# Load JSON from caliper-common-fixtures for comparison
|
171
152
|
# NOTE - sym link to caliper-common-fixtures needs to exist under spec/fixtures
|
172
153
|
file = File.read('spec/fixtures/caliperSharedAnnotationEvent.json')
|
173
154
|
data_hash = JSON.parse(file)
|
174
155
|
expected_json = data_hash.to_json # convert hash back to JSON string after parse
|
175
|
-
|
156
|
+
expect(event.to_json).to be_json_eql(expected_json)#.excluding("actor", "action", "object", "target", "generated", "ed_app", "group")
|
176
157
|
|
177
158
|
# puts "JSON from file = #{data_hash}"
|
178
|
-
|
179
|
-
|
180
|
-
# puts "AnnotationEvent from JSON = #{
|
159
|
+
deser_event = AnnotationEvent.new
|
160
|
+
deser_event.from_json data_hash
|
161
|
+
# puts "AnnotationEvent from JSON = #{deser_event.to_json}"
|
181
162
|
|
182
163
|
# Ensure that the deserialized shared event object conforms
|
183
|
-
expect(
|
164
|
+
expect(event).to eql(deser_event)
|
184
165
|
end
|
185
166
|
end
|
186
167
|
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 Tagged 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::TAGGED
|
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/4)'
|
61
|
+
obj.name = 'The Stamp Act Crisis'
|
62
|
+
obj.isPartOf = ePub
|
63
|
+
obj.version = ePub.version
|
64
|
+
obj.index = 4
|
65
|
+
obj.dateCreated = '2015-08-01T06:00:00.000Z'
|
66
|
+
obj.dateModified = '2015-09-02T11:30:00.000Z'
|
67
|
+
|
68
|
+
# Generated annotation
|
94
69
|
tag = Caliper::Entities::Annotation::TagAnnotation.new
|
95
70
|
tag.id = 'https://someEduApp.edu/tags/7654'
|
96
71
|
tag.name = nil
|
@@ -100,74 +75,82 @@ module Caliper
|
|
100
75
|
tag.annotated = 'https://github.com/readium/readium-js-viewer/book/34843#epubcfi(/4/3/4)'
|
101
76
|
tag.tags = ["to-read", "1765", "shared-with-project-team"]
|
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'
|
133
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'
|
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 = tag
|
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/caliperTagAnnotationEvent.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 tag event object conforms
|
170
|
-
expect(
|
153
|
+
expect(event).to eql(deser_event)
|
171
154
|
end
|
172
155
|
end
|
173
156
|
end
|