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.
Files changed (52) hide show
  1. checksums.yaml +5 -13
  2. data/lib/caliper/defaults.rb +2 -2
  3. data/lib/caliper/entities/agent/organization.rb +3 -3
  4. data/lib/caliper/entities/assessment/assessment.rb +0 -2
  5. data/lib/caliper/entities/entity.rb +0 -1
  6. data/lib/caliper/entities/foaf/agent.rb +1 -1
  7. data/lib/caliper/entities/lis/course_offering.rb +0 -1
  8. data/lib/caliper/entities/lis/group.rb +1 -2
  9. data/lib/caliper/entities/lis/{roles.rb → role.rb} +1 -1
  10. data/lib/caliper/entities/outcome/result.rb +3 -3
  11. data/lib/caliper/entities/response/fillin_blank_response.rb +1 -0
  12. data/lib/caliper/entities/response/multiple_choice_response.rb +1 -0
  13. data/lib/caliper/entities/response/multiple_response_response.rb +1 -0
  14. data/lib/caliper/entities/response/response.rb +1 -0
  15. data/lib/caliper/entities/response/select_type_response.rb +1 -0
  16. data/lib/caliper/entities/response/true_false_response.rb +1 -0
  17. data/lib/caliper/event/annotation_event.rb +1 -0
  18. data/lib/caliper/event/event.rb +28 -26
  19. data/lib/caliper/event/view_event.rb +1 -0
  20. data/lib/caliper/jsonable.rb +2 -1
  21. data/lib/caliper/options.rb +11 -11
  22. data/lib/caliper/profiles/assessment_profile.rb +0 -1
  23. data/lib/caliper/{event/grade_predict_event.rb → request/envelope.rb} +21 -11
  24. data/lib/caliper/request/envelope_jsonable.rb +69 -0
  25. data/lib/caliper/request/event_store_requestor.rb +16 -27
  26. data/lib/caliper/request/http_requestor.rb +8 -27
  27. data/lib/caliper/sensor.rb +12 -23
  28. data/lib/caliper/version.rb +1 -1
  29. data/spec/lib/entities/agent/person_spec.rb +1 -1
  30. data/spec/lib/entities/entity_spec.rb +1 -1
  31. data/spec/lib/event/annotation_event_bookmark_spec.rb +81 -98
  32. data/spec/lib/event/annotation_event_highlight_spec.rb +81 -98
  33. data/spec/lib/event/annotation_event_shared_spec.rb +81 -100
  34. data/spec/lib/event/annotation_event_tag_spec.rb +81 -98
  35. data/spec/lib/event/assessment_event_spec.rb +64 -124
  36. data/spec/lib/event/assessment_item_completed_event_spec.rb +93 -138
  37. data/spec/lib/event/assessment_item_started_event_spec.rb +92 -139
  38. data/spec/lib/event/assignable_event_spec.rb +65 -129
  39. data/spec/lib/event/media_event_spec.rb +77 -94
  40. data/spec/lib/event/navigated_event_spec.rb +90 -108
  41. data/spec/lib/event/session_event_login_spec.rb +98 -108
  42. data/spec/lib/event/session_event_logout_spec.rb +66 -81
  43. data/spec/lib/event/session_event_timeout_spec.rb +62 -88
  44. data/spec/lib/event/viewed_event_spec.rb +74 -92
  45. data/spec/lib/event_helper.rb +89 -109
  46. data/spec/lib/request/http_requestor_spec.rb +170 -0
  47. data/spec/lib/sensor_spec.rb +9 -29
  48. metadata +10 -11
  49. data/lib/caliper/entities/outcome/predicted_grade.rb +0 -43
  50. data/lib/caliper/entity_envelope.rb +0 -33
  51. data/lib/caliper/event_envelope.rb +0 -33
  52. 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/roles.rb'
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
- # The Actor (Person/Student))
44
- student = Caliper::Entities::Agent::Person.new
45
- student.id = 'https://some-university.edu/user/554433'
46
- membership1 = Caliper::Entities::LIS::Membership.new
47
- membership1.id = "https://some-university.edu/membership/001"
48
- membership1.member = "https://some-university.edu/user/554433"
49
- membership1.organization = "https://some-university.edu/politicalScience/2015/american-revolution-101"
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
- # The Object viewed (Video)
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
- # The Target within the Object (MediaLocation)
94
- videoLocation = Caliper::Entities::Media::MediaLocation.new
95
- videoLocation.id = 'https://com.sat/super-media-tool/video/video1'
96
- videoLocation.version = '1.0'
97
- videoLocation.dateCreated = '2015-08-01T06:00:00.000Z'
98
- videoLocation.dateModified = nil
99
- videoLocation.currentTime = 710
100
-
101
- # The course that is part of the Learning Context (edApp)
102
- edApp = Caliper::Entities::Agent::SoftwareApplication.new
103
- edApp.id = 'https://com.sat/super-media-tool'
104
- edApp.name = 'Super Media Tool'
105
- edApp.hasMembership = []
106
- edApp.dateCreated = '2015-08-01T06:00:00.000Z'
107
- edApp.dateModified = '2015-09-02T11:30:00.000Z'
108
-
109
- #LIS Course Offering
110
- courseOffering = Caliper::Entities::LIS::CourseOffering.new
111
- courseOffering.id = "https://some-university.edu/politicalScience/2015/american-revolution-101"
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.category = nil
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.membership = [membership3]
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
- # The (Reading::BookmarkReading) Event
142
- media_event = Caliper::Event::MediaEvent.new
143
- media_event.actor = student
144
- media_event.action = action
145
- media_event.object = video
146
- media_event.target = videoLocation
147
- media_event.generated = nil
148
- media_event.edApp = edApp
149
- media_event.group = group
150
- media_event.startedAtTime = '2015-09-15T10:15:00.000Z'
151
- media_event.endedAtTime = nil
152
- media_event.duration = nil
153
- # puts "Event JSON = #{media_event.to_json}'"
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
- media_event.to_json.should be_json_eql(expected_json)#.excluding("actor", "action", "object", "target", "generated", "edApp", "group")
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
- deser_media_event = Caliper::Event::MediaEvent.new
164
- deser_media_event.from_json data_hash
165
- # puts "ReadingEvent from JSON = #{deser_media_event.to_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(media_event).to eql(deser_media_event)
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/roles.rb'
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
- # The Actor (Person/Student))
42
- student = Caliper::Entities::Agent::Person.new
43
- student.id = 'https://some-university.edu/user/554433'
44
- membership1 = Caliper::Entities::LIS::Membership.new
45
- membership1.id = "https://some-university.edu/membership/001"
46
- membership1.member = "https://some-university.edu/user/554433"
47
- membership1.organization = "https://some-university.edu/politicalScience/2015/american-revolution-101"
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
- # The Object navigated (ePub Volume)
77
- ePubVolume = Caliper::Entities::Reading::EPubVolume.new
78
- ePubVolume.id = 'https://github.com/readium/readium-js-viewer/book/34843#epubcfi(/4/3)'
79
- ePubVolume.name = 'The Glorious Cause: The American Revolution, 1763-1789 (Oxford History of the United States)'
80
- ePubVolume.version = '2nd ed.'
81
- ePubVolume.dateCreated = '2015-08-01T06:00:00.000Z'
82
- ePubVolume.dateModified = '2015-09-02T11:30:00.000Z'
83
-
84
- # The Target within the Object (frame)
85
- frame = Caliper::Entities::Reading::Frame.new
86
- frame.id = 'https://github.com/readium/readium-js-viewer/book/34843#epubcfi(/4/3/1)'
87
- frame.name = 'Key Figures: George Washington'
88
- frame.version = '2nd ed.'
89
- frame.dateCreated = '2015-08-01T06:00:00.000Z'
90
- frame.dateModified = '2015-09-02T11:30:00.000Z'
91
- frame.index = 1
92
- frame.isPartOf = ePubVolume.id
93
-
94
- # The course that is part of the Learning Context (edApp)
95
- edApp = Caliper::Entities::Agent::SoftwareApplication.new
96
- edApp.id = 'https://github.com/readium/readium-js-viewer'
97
- edApp.name = 'Readium'
98
- edApp.hasMembership = []
99
- edApp.dateCreated = '2015-08-01T06:00:00.000Z'
100
- edApp.dateModified = '2015-09-02T11:30:00.000Z'
101
-
102
- #LIS Course Offering
103
- courseOffering = Caliper::Entities::LIS::CourseOffering.new
104
- courseOffering.id = "https://some-university.edu/politicalScience/2015/american-revolution-101"
105
- courseOffering.name = "Political Science 101: The American Revolution"
106
- courseOffering.courseNumber = "POL101"
107
- courseOffering.academicSession = "Fall-2015"
108
- courseOffering.membership = []
109
- courseOffering.subOrganizationOf = nil
110
- courseOffering.dateCreated = '2015-08-01T06:00:00.000Z'
111
- courseOffering.dateModified = '2015-09-02T11:30:00.000Z'
112
-
113
- # The LIS Course Section for the Caliper Event
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.category = nil
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.membership = [membership3]
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
- # The navigatedFrom property (specific to Navigation Event)
135
- fromPage = Caliper::Entities::Reading::WebPage.new
136
- fromPage.id = 'https://some-university.edu/politicalScience/2015/american-revolution-101/index.html'
137
- fromPage.name = 'American Revolution 101 Landing Page'
138
- fromPage.dateCreated = '2015-08-01T06:00:00.000Z'
139
- fromPage.dateModified = '2015-09-02T11:30:00.000Z'
140
- fromPage.isPartOf = nil
141
- fromPage.version = '1.0'
142
-
143
- # The (Reading::BookmarkReading) Event
144
- navigated_event = Caliper::Event::NavigationEvent.new
145
- navigated_event.actor = student
146
- navigated_event.action = action
147
- navigated_event.object = ePubVolume
148
- navigated_event.target = frame
149
- navigated_event.generated = nil
150
- navigated_event.edApp = edApp
151
- navigated_event.group = group
152
- navigated_event.navigatedFrom = fromPage
153
- navigated_event.startedAtTime = '2015-09-15T10:15:00.000Z'
154
- navigated_event.endedAtTime = nil
155
- navigated_event.duration = nil
156
- # puts "Event JSON = #{navigated_event.to_json}'"
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
- navigated_event.to_json.should be_json_eql(expected_json)#.excluding("actor", "action", "object", "target", "generated", "edApp", "group")
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
- deser_navigated_event = Caliper::Event::NavigationEvent.new
167
- deser_navigated_event.from_json data_hash
168
- # puts "ReadingEvent from JSON = #{deser_navigated_event.to_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(navigated_event).to eql(deser_navigated_event)
153
+ expect(event).to eql(deser_event)
172
154
  end
173
155
  end
174
156
  end