ims_caliper 0.9.3.15 → 1.0.0
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 +4 -4
- data/README.md +10 -5
- data/lib/caliper/{profiles/annotation_profile.rb → actions/annotation_actions.rb} +3 -41
- data/lib/caliper/{profiles/assessment_profile.rb → actions/assessment_actions.rb} +3 -19
- data/lib/caliper/actions/assessment_item_actions.rb +31 -0
- data/lib/caliper/{profiles/assignable_profile.rb → actions/assignable_actions.rb} +3 -28
- data/lib/caliper/{profiles/media_profile.rb → actions/media_actions.rb} +4 -29
- data/lib/caliper/{event/view_event.rb → actions/navigation_actions.rb} +5 -11
- data/lib/caliper/{validators/event_validator_context.rb → actions/outcome_actions.rb} +7 -15
- data/lib/caliper/{event/navigation_event.rb → actions/reading_actions.rb} +6 -14
- data/lib/caliper/actions/session_actions.rb +30 -0
- data/lib/caliper/context/context.rb +31 -0
- data/lib/caliper/entities/agent/organization.rb +4 -3
- data/lib/caliper/entities/agent/person.rb +4 -3
- data/lib/caliper/entities/agent/software_application.rb +4 -3
- data/lib/caliper/entities/annotation/annotation.rb +4 -12
- data/lib/caliper/entities/annotation/annotation_type.rb +32 -0
- data/lib/caliper/entities/annotation/bookmark_annotation.rb +3 -1
- data/lib/caliper/entities/annotation/highlight_annotation.rb +4 -4
- data/lib/caliper/entities/annotation/shared_annotation.rb +3 -1
- data/lib/caliper/entities/annotation/tag_annotation.rb +3 -1
- data/lib/caliper/entities/assessment/assessment.rb +1 -1
- data/lib/caliper/entities/assessment/assessment_item.rb +2 -0
- data/lib/caliper/entities/assignable/assignable_digital_resource.rb +3 -13
- data/lib/caliper/{event/session_event.rb → entities/assignable/assignable_digital_resource_type.rb} +7 -11
- data/lib/caliper/entities/assignable/attempt.rb +8 -9
- data/lib/caliper/entities/digital_resource.rb +5 -22
- data/lib/caliper/entities/digital_resource_type.rb +33 -0
- data/lib/caliper/entities/entity.rb +7 -37
- data/lib/caliper/entities/{learning_context.rb → entity_base.rb} +19 -15
- data/lib/caliper/entities/entity_type.rb +39 -0
- data/lib/caliper/entities/foaf/agent.rb +0 -2
- data/lib/caliper/entities/jsonable.rb +14 -3
- data/lib/caliper/entities/learning_objective.rb +4 -3
- data/lib/caliper/entities/lis/course_offering.rb +9 -6
- data/lib/caliper/entities/lis/course_section.rb +3 -1
- data/lib/caliper/entities/lis/group.rb +5 -3
- data/lib/caliper/entities/lis/membership.rb +5 -7
- data/lib/caliper/entities/media/audio_object.rb +2 -1
- data/lib/caliper/entities/media/image_object.rb +2 -1
- data/lib/caliper/entities/media/media_location.rb +2 -1
- data/lib/caliper/entities/media/media_object.rb +2 -9
- data/lib/caliper/entities/media/media_object_type.rb +31 -0
- data/lib/caliper/entities/media/video_object.rb +2 -1
- data/lib/caliper/entities/outcome/result.rb +23 -16
- data/lib/caliper/entities/reading/epub_chapter.rb +2 -1
- data/lib/caliper/entities/reading/epub_part.rb +2 -1
- data/lib/caliper/entities/reading/epub_sub_chapter.rb +2 -1
- data/lib/caliper/entities/reading/epub_volume.rb +2 -1
- data/lib/caliper/entities/reading/frame.rb +4 -3
- data/lib/caliper/entities/reading/web_page.rb +3 -2
- data/lib/caliper/entities/response/fillin_blank_response.rb +3 -3
- data/lib/caliper/entities/response/multiple_choice_response.rb +3 -3
- data/lib/caliper/entities/response/multiple_response_response.rb +3 -3
- data/lib/caliper/entities/response/response.rb +8 -10
- data/lib/caliper/entities/response/response_type.rb +5 -5
- data/lib/caliper/entities/response/select_type_response.rb +3 -3
- data/lib/caliper/entities/response/true_false_response.rb +2 -3
- data/lib/caliper/entities/session/session.rb +8 -7
- data/lib/caliper/{event → events}/annotation_event.rb +11 -3
- data/lib/caliper/{event → events}/assessment_event.rb +11 -8
- data/lib/caliper/{event → events}/assessment_item_event.rb +11 -8
- data/lib/caliper/{event → events}/assignable_event.rb +11 -8
- data/lib/caliper/{profiles/profile.rb → events/event.rb} +15 -15
- data/lib/caliper/events/event_context.rb +24 -0
- data/lib/caliper/events/event_type.rb +33 -0
- data/lib/caliper/{event → events}/jsonable.rb +2 -2
- data/lib/caliper/{event → events}/media_event.rb +11 -8
- data/lib/caliper/events/navigation_event.rb +47 -0
- data/lib/caliper/events/outcome_event.rb +44 -0
- data/lib/caliper/{event/outcome_event.rb → events/reading_event.rb} +13 -10
- data/lib/caliper/events/session_event.rb +42 -0
- data/lib/caliper/events/view_event.rb +44 -0
- data/lib/caliper/request/envelope.rb +4 -15
- data/lib/caliper/request/event_store_requestor.rb +1 -1
- data/lib/caliper/request/{envelope_jsonable.rb → jsonable.rb} +9 -11
- data/lib/caliper/sensor.rb +1 -1
- data/lib/caliper/version.rb +1 -1
- data/lib/caliper.rb +1 -1
- data/spec/lib/entities/agent/{student.json → person.json} +4 -3
- data/spec/lib/entities/agent/person_spec.rb +5 -6
- data/spec/lib/entities/assessment/assessment.json +23 -0
- data/spec/lib/entities/assessment/assessment_spec.rb +54 -0
- data/spec/lib/event_helper.rb +33 -41
- data/spec/lib/{event/annotation_event_bookmark_spec.rb → events/annotation_bookmarked_event_spec.rb} +36 -46
- data/spec/lib/{event/annotation_event_highlight_spec.rb → events/annotation_highlighted_event_spec.rb} +36 -46
- data/spec/lib/{event/annotation_event_shared_spec.rb → events/annotation_shared_event_spec.rb} +42 -52
- data/spec/lib/{event/annotation_event_tag_spec.rb → events/annotation_tagged_event_spec.rb} +36 -46
- data/spec/lib/{event → events}/assessment_item_completed_event_spec.rb +41 -65
- data/spec/lib/{event → events}/assessment_item_started_event_spec.rb +38 -56
- data/spec/lib/{event/assessment_event_spec.rb → events/assessment_started_event_spec.rb} +36 -51
- data/spec/lib/{event/assignable_event_spec.rb → events/assignable_activated_event_spec.rb} +37 -52
- data/spec/lib/{event/media_event_spec.rb → events/media_paused_video_event_spec.rb} +33 -43
- data/spec/lib/{event/navigated_event_spec.rb → events/navigation_navigated_to_event_spec.rb} +36 -45
- data/spec/lib/events/outcome_graded_event_spec.rb +163 -0
- data/spec/lib/{event/session_event_login_spec.rb → events/session_logged_in_event_spec.rb} +38 -46
- data/spec/lib/{event/session_event_logout_spec.rb → events/session_logged_out-event_spec.rb} +28 -37
- data/spec/lib/{event/session_event_timeout_spec.rb → events/session_timed_out_event_spec.rb} +24 -34
- data/spec/lib/{event/viewed_event_spec.rb → events/view_viewed_event_spec.rb} +33 -41
- data/spec/lib/request/{http_requestor_spec.rb → http_requestor_single_event_spec.rb} +46 -47
- data/spec/lib/request/http_requestor_single_minimal_event_spec.rb +84 -0
- data/spec/lib/sensor_spec.rb +1 -1
- metadata +77 -70
- data/lib/caliper/event/event.rb +0 -114
- data/lib/caliper/profiles/assessment_item_profile.rb +0 -48
- data/lib/caliper/profiles/reading_profile.rb +0 -56
- data/lib/caliper/profiles/session_profile.rb +0 -46
- data/lib/caliper/validators/error_message.rb +0 -63
- data/lib/caliper/validators/event_validator.rb +0 -57
- data/lib/caliper/validators/property_type_check.rb +0 -33
- data/lib/caliper/validators/session_login_event_validator.rb +0 -121
- data/lib/caliper/validators/session_logout_event_validator.rb +0 -120
- data/lib/caliper/validators/time_check.rb +0 -50
- data/spec/lib/entities/entity.json +0 -9
- data/spec/lib/entities/entity_spec.rb +0 -52
@@ -16,25 +16,24 @@
|
|
16
16
|
# with this program. If not, see http://www.gnu.org/licenses/.
|
17
17
|
|
18
18
|
require 'require_all'
|
19
|
-
require_all 'lib/caliper/
|
19
|
+
require_all 'lib/caliper/actions/assignable_actions.rb'
|
20
|
+
require_all 'lib/caliper/entities/entity_base.rb'
|
20
21
|
require_all 'lib/caliper/entities/agent/software_application.rb'
|
21
22
|
require_all 'lib/caliper/entities/agent/person.rb'
|
23
|
+
require_all 'lib/caliper/entities/assessment/assessment.rb'
|
22
24
|
require_all 'lib/caliper/entities/lis/membership.rb'
|
23
25
|
require_all 'lib/caliper/entities/lis/role.rb'
|
24
26
|
require_all 'lib/caliper/entities/lis/status.rb'
|
25
27
|
require_all 'lib/caliper/entities/lis/course_section.rb'
|
26
28
|
require_all 'lib/caliper/entities/lis/course_offering.rb'
|
27
29
|
require_all 'lib/caliper/entities/lis/group.rb'
|
28
|
-
require_all 'lib/caliper/entities/assessment/assessment.rb'
|
29
|
-
require_all 'lib/caliper/entities/assessment/assessment_item.rb'
|
30
30
|
require_all 'lib/caliper/entities/assignable/attempt.rb'
|
31
31
|
require_all 'lib/caliper/entities/assignable/assignable_digital_resource.rb'
|
32
|
-
require_all 'lib/caliper/
|
33
|
-
require_all 'lib/caliper/profiles/assignable_profile.rb'
|
32
|
+
require_all 'lib/caliper/events/assignable_event.rb'
|
34
33
|
require 'json_spec'
|
35
34
|
|
36
35
|
module Caliper
|
37
|
-
module
|
36
|
+
module Events
|
38
37
|
|
39
38
|
describe AssignableEvent do
|
40
39
|
|
@@ -42,104 +41,90 @@ module Caliper
|
|
42
41
|
|
43
42
|
# Actor
|
44
43
|
actor = Caliper::Entities::Agent::Person.new
|
45
|
-
actor.id = 'https://
|
46
|
-
actor.dateCreated =
|
47
|
-
actor.dateModified =
|
44
|
+
actor.id = 'https://example.edu/user/554433'
|
45
|
+
actor.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
46
|
+
actor.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
48
47
|
|
49
48
|
# Action
|
50
|
-
action = Caliper::
|
49
|
+
action = Caliper::Actions::AssignableActions::ACTIVATED
|
51
50
|
|
52
51
|
# Object
|
53
52
|
assessment = Caliper::Entities::Assessment::Assessment.new
|
54
|
-
assessment.id = "https://
|
53
|
+
assessment.id = "https://example.edu/politicalScience/2015/american-revolution-101/assessment/001"
|
55
54
|
assessment.name = "American Revolution - Key Figures Assessment"
|
56
|
-
assessment.dateModified =
|
57
|
-
assessment.dateCreated =
|
58
|
-
assessment.datePublished =
|
55
|
+
assessment.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
56
|
+
assessment.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
57
|
+
assessment.datePublished = Time.utc(2015,8,15,9,30,0).iso8601(3)
|
59
58
|
assessment.version = "1.0"
|
60
|
-
assessment.dateToActivate =
|
61
|
-
assessment.dateToShow =
|
62
|
-
assessment.dateToStartOn =
|
63
|
-
assessment.dateToSubmit =
|
59
|
+
assessment.dateToActivate = Time.utc(2015,8,16,5,0,0).iso8601(3)
|
60
|
+
assessment.dateToShow = Time.utc(2015,8,16,5,0,0).iso8601(3)
|
61
|
+
assessment.dateToStartOn = Time.utc(2015,8,16,5,0,0).iso8601(3)
|
62
|
+
assessment.dateToSubmit = Time.utc(2015,9,28,11,59,59).iso8601(3)
|
64
63
|
assessment.maxAttempts = 2
|
65
64
|
assessment.maxSubmits = 2
|
66
65
|
assessment.maxScore = 3.0
|
67
66
|
|
68
67
|
# Generated attempt
|
69
68
|
attempt = Caliper::Entities::Assignable::Attempt.new
|
70
|
-
attempt.id = "https://
|
71
|
-
attempt.actor = "https://
|
72
|
-
attempt.assignable = "https://
|
73
|
-
attempt.dateCreated =
|
74
|
-
attempt.dateModified = nil
|
69
|
+
attempt.id = "https://example.edu/politicalScience/2015/american-revolution-101/assessment/001/attempt/5678"
|
70
|
+
attempt.actor = "https://example.edu/user/554433"
|
71
|
+
attempt.assignable = "https://example.edu/politicalScience/2015/american-revolution-101/assessment/001"
|
72
|
+
attempt.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
75
73
|
attempt.count = 1
|
76
|
-
attempt.startedAtTime =
|
77
|
-
attempt.duration = nil
|
78
|
-
attempt.endedAtTime = nil
|
79
|
-
attempt.extensions = {}
|
80
|
-
attempt.name = nil
|
74
|
+
attempt.startedAtTime = Time.utc(2015,9,15,10,15,0).iso8601(3)
|
81
75
|
|
82
76
|
# EdApp
|
83
77
|
ed_app = Caliper::Entities::Agent::SoftwareApplication.new
|
84
|
-
ed_app.id = 'https://com
|
78
|
+
ed_app.id = 'https://example.com/super-assessment-tool'
|
85
79
|
ed_app.name = 'Super Assessment Tool'
|
86
|
-
ed_app.dateCreated =
|
87
|
-
ed_app.dateModified = nil
|
80
|
+
ed_app.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
88
81
|
|
89
82
|
# LIS Course Offering
|
90
83
|
course = Caliper::Entities::LIS::CourseOffering.new
|
91
|
-
course.id = "https://
|
84
|
+
course.id = "https://example.edu/politicalScience/2015/american-revolution-101"
|
92
85
|
course.name = "Political Science 101: The American Revolution"
|
93
86
|
course.courseNumber = "POL101"
|
94
87
|
course.academicSession = "Fall-2015"
|
95
|
-
course.
|
96
|
-
course.
|
97
|
-
course.dateModified = '2015-09-02T11:30:00.000Z'
|
88
|
+
course.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
89
|
+
course.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
98
90
|
|
99
91
|
# LIS Course Section
|
100
92
|
section = Caliper::Entities::LIS::CourseSection.new
|
101
|
-
section.id = 'https://
|
93
|
+
section.id = 'https://example.edu/politicalScience/2015/american-revolution-101/section/001'
|
102
94
|
section.name = 'American Revolution 101'
|
103
95
|
section.courseNumber = "POL101"
|
104
96
|
section.academicSession = "Fall-2015"
|
105
|
-
section.category = nil
|
106
97
|
section.subOrganizationOf = course
|
107
|
-
section.dateCreated =
|
108
|
-
section.dateModified =
|
98
|
+
section.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
99
|
+
section.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
109
100
|
|
110
101
|
# LIS Group
|
111
102
|
group = Caliper::Entities::LIS::Group.new
|
112
|
-
group.id = "https://
|
103
|
+
group.id = "https://example.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
113
104
|
group.name = "Discussion Group 001"
|
114
105
|
group.subOrganizationOf = section
|
115
|
-
group.dateCreated =
|
116
|
-
group.dateModified = nil
|
106
|
+
group.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
117
107
|
|
118
108
|
membership = Caliper::Entities::LIS::Membership.new
|
119
|
-
membership.id = "https://
|
109
|
+
membership.id = "https://example.edu/politicalScience/2015/american-revolution-101/roster/554433"
|
120
110
|
membership.name = "American Revolution 101"
|
121
111
|
membership.description = "Roster entry"
|
122
|
-
membership.member = "https://
|
123
|
-
membership.organization = "https://
|
112
|
+
membership.member = "https://example.edu/user/554433"
|
113
|
+
membership.organization = "https://example.edu/politicalScience/2015/american-revolution-101/section/001"
|
124
114
|
membership.roles = [Caliper::Entities::LIS::Role::LEARNER]
|
125
115
|
membership.status = Caliper::Entities::LIS::Status::ACTIVE
|
126
|
-
membership.dateCreated =
|
127
|
-
membership.dateModified = nil
|
116
|
+
membership.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
128
117
|
|
129
118
|
# Create the Event
|
130
119
|
event = AssignableEvent.new
|
131
120
|
event.actor = actor
|
132
121
|
event.action = action
|
133
122
|
event.object = assessment
|
134
|
-
event.target = nil
|
135
123
|
event.generated = attempt
|
136
|
-
event.
|
137
|
-
event.endedAtTime = nil
|
138
|
-
event.duration = nil
|
124
|
+
event.eventTime = Time.utc(2015,9,15,10,15,0).iso8601(3)
|
139
125
|
event.edApp = ed_app
|
140
126
|
event.group = group
|
141
127
|
event.membership = membership
|
142
|
-
# puts "Event JSON = #{event.to_json}'"
|
143
128
|
|
144
129
|
# Load JSON from caliper-common-fixtures for comparison
|
145
130
|
# NOTE - sym link to caliper-common-fixtures needs to exist under spec/fixtures
|
@@ -16,7 +16,8 @@
|
|
16
16
|
# with this program. If not, see http://www.gnu.org/licenses/.
|
17
17
|
|
18
18
|
require 'require_all'
|
19
|
-
require_all 'lib/caliper/
|
19
|
+
require_all 'lib/caliper/actions/media_actions.rb'
|
20
|
+
require_all 'lib/caliper/entities/entity_base.rb'
|
20
21
|
require_all 'lib/caliper/entities/agent/software_application.rb'
|
21
22
|
require_all 'lib/caliper/entities/learning_objective.rb'
|
22
23
|
require_all 'lib/caliper/entities/agent/person.rb'
|
@@ -29,12 +30,11 @@ require_all 'lib/caliper/entities/lis/group.rb'
|
|
29
30
|
require_all 'lib/caliper/entities/media/media_object.rb'
|
30
31
|
require_all 'lib/caliper/entities/media/video_object.rb'
|
31
32
|
require_all 'lib/caliper/entities/media/media_location.rb'
|
32
|
-
require_all 'lib/caliper/
|
33
|
-
require_all 'lib/caliper/profiles/media_profile.rb'
|
33
|
+
require_all 'lib/caliper/events/media_event.rb'
|
34
34
|
require 'json_spec'
|
35
35
|
|
36
36
|
module Caliper
|
37
|
-
module
|
37
|
+
module Events
|
38
38
|
|
39
39
|
describe MediaEvent do
|
40
40
|
|
@@ -42,98 +42,88 @@ module Caliper
|
|
42
42
|
|
43
43
|
# Actor
|
44
44
|
actor = Caliper::Entities::Agent::Person.new
|
45
|
-
actor.id = 'https://
|
46
|
-
actor.dateCreated =
|
47
|
-
actor.dateModified =
|
45
|
+
actor.id = 'https://example.edu/user/554433'
|
46
|
+
actor.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
47
|
+
actor.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
48
48
|
|
49
49
|
# Action
|
50
|
-
action = Caliper::
|
50
|
+
action = Caliper::Actions::MediaActions::PAUSED
|
51
51
|
|
52
52
|
# Learning Objective (video.alignedLearningObjective)
|
53
53
|
learnObjective = Caliper::Entities::LearningObjective.new
|
54
|
-
learnObjective.id = '
|
55
|
-
learnObjective.dateCreated =
|
56
|
-
learnObjective.dateModified = nil
|
54
|
+
learnObjective.id = 'https://example.edu/american-revolution-101/personalities/learn'
|
55
|
+
learnObjective.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
57
56
|
|
58
57
|
# Object
|
59
58
|
video = Caliper::Entities::Media::VideoObject.new
|
60
|
-
video.id = 'https://com
|
59
|
+
video.id = 'https://example.com/super-media-tool/video/1225'
|
61
60
|
video.name = 'American Revolution - Key Figures Video'
|
62
61
|
video.version = '1.0'
|
63
62
|
video.duration = 1420
|
64
|
-
video.dateCreated =
|
65
|
-
video.dateModified =
|
63
|
+
video.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
64
|
+
video.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
66
65
|
video.alignedLearningObjective = [learnObjective]
|
67
66
|
|
68
67
|
# Target coordinates
|
69
68
|
target = Caliper::Entities::Media::MediaLocation.new
|
70
|
-
target.id = 'https://com
|
69
|
+
target.id = 'https://example.com/super-media-tool/video/1225'
|
71
70
|
target.version = '1.0'
|
72
|
-
target.dateCreated =
|
73
|
-
target.dateModified = nil
|
71
|
+
target.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
74
72
|
target.currentTime = 710
|
75
73
|
|
76
74
|
# ed_app
|
77
75
|
ed_app = Caliper::Entities::Agent::SoftwareApplication.new
|
78
|
-
ed_app.id = 'https://com
|
76
|
+
ed_app.id = 'https://example.com/super-media-tool'
|
79
77
|
ed_app.name = 'Super Media Tool'
|
80
|
-
ed_app.dateCreated =
|
81
|
-
ed_app.dateModified =
|
78
|
+
ed_app.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
79
|
+
ed_app.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
82
80
|
|
83
81
|
# LIS Course Offering
|
84
82
|
course = Caliper::Entities::LIS::CourseOffering.new
|
85
|
-
course.id = "https://
|
83
|
+
course.id = "https://example.edu/politicalScience/2015/american-revolution-101"
|
86
84
|
course.name = "Political Science 101: The American Revolution"
|
87
85
|
course.courseNumber = "POL101"
|
88
86
|
course.academicSession = "Fall-2015"
|
89
|
-
course.
|
90
|
-
course.
|
91
|
-
course.dateModified = '2015-09-02T11:30:00.000Z'
|
87
|
+
course.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
88
|
+
course.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
92
89
|
|
93
90
|
# LIS Course Section
|
94
91
|
section = Caliper::Entities::LIS::CourseSection.new
|
95
|
-
section.id = 'https://
|
92
|
+
section.id = 'https://example.edu/politicalScience/2015/american-revolution-101/section/001'
|
96
93
|
section.name = 'American Revolution 101'
|
97
94
|
section.courseNumber = "POL101"
|
98
95
|
section.academicSession = "Fall-2015"
|
99
|
-
section.category = nil
|
100
96
|
section.subOrganizationOf = course
|
101
|
-
section.dateCreated =
|
102
|
-
section.dateModified =
|
97
|
+
section.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
98
|
+
section.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
103
99
|
|
104
100
|
# LIS Group
|
105
101
|
group = Caliper::Entities::LIS::Group.new
|
106
|
-
group.id = "https://
|
102
|
+
group.id = "https://example.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
107
103
|
group.name = "Discussion Group 001"
|
108
104
|
group.subOrganizationOf = section
|
109
|
-
group.dateCreated =
|
110
|
-
group.dateModified = nil
|
105
|
+
group.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
111
106
|
|
112
107
|
membership = Caliper::Entities::LIS::Membership.new
|
113
|
-
membership.id = "https://
|
108
|
+
membership.id = "https://example.edu/politicalScience/2015/american-revolution-101/roster/554433"
|
114
109
|
membership.name = "American Revolution 101"
|
115
110
|
membership.description = "Roster entry"
|
116
|
-
membership.member = "https://
|
117
|
-
membership.organization = "https://
|
111
|
+
membership.member = "https://example.edu/user/554433"
|
112
|
+
membership.organization = "https://example.edu/politicalScience/2015/american-revolution-101/section/001"
|
118
113
|
membership.roles = [Caliper::Entities::LIS::Role::LEARNER]
|
119
114
|
membership.status = Caliper::Entities::LIS::Status::ACTIVE
|
120
|
-
membership.dateCreated =
|
121
|
-
membership.dateModified = nil
|
115
|
+
membership.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
122
116
|
|
123
117
|
# Create the Event
|
124
|
-
event = Caliper::
|
118
|
+
event = Caliper::Events::MediaEvent.new
|
125
119
|
event.actor = actor
|
126
120
|
event.action = action
|
127
121
|
event.object = video
|
128
122
|
event.target = target
|
129
|
-
event.
|
130
|
-
event.startedAtTime = '2015-09-15T10:15:00.000Z'
|
131
|
-
event.endedAtTime = nil
|
132
|
-
event.duration = nil
|
123
|
+
event.eventTime = Time.utc(2015,9,15,10,15,0).iso8601(3)
|
133
124
|
event.edApp = ed_app
|
134
125
|
event.group = group
|
135
126
|
event.membership = membership
|
136
|
-
# puts "Event JSON = #{event.to_json}'"
|
137
127
|
|
138
128
|
# Load JSON from caliper-common-fixtures for comparison
|
139
129
|
# NOTE - sym link to caliper-common-fixtures needs to exist under spec/fixtures
|
@@ -143,7 +133,7 @@ module Caliper
|
|
143
133
|
expect(event.to_json).to be_json_eql(expected_json)#.excluding("actor", "action", "object", "target", "generated", "ed_app", "group")
|
144
134
|
|
145
135
|
# puts "JSON from file = #{data_hash}"
|
146
|
-
deser_event = Caliper::
|
136
|
+
deser_event = Caliper::Events::MediaEvent.new
|
147
137
|
deser_event.from_json data_hash
|
148
138
|
# puts "ReadingEvent from JSON = #{deser_event.to_json}"
|
149
139
|
|
data/spec/lib/{event/navigated_event_spec.rb → events/navigation_navigated_to_event_spec.rb}
RENAMED
@@ -16,7 +16,8 @@
|
|
16
16
|
# with this program. If not, see http://www.gnu.org/licenses/.
|
17
17
|
|
18
18
|
require 'require_all'
|
19
|
-
require_all 'lib/caliper/
|
19
|
+
require_all 'lib/caliper/actions/navigation_actions.rb'
|
20
|
+
require_all 'lib/caliper/entities/entity_base.rb'
|
20
21
|
require_all 'lib/caliper/entities/agent/software_application.rb'
|
21
22
|
require_all 'lib/caliper/entities/agent/person.rb'
|
22
23
|
require_all 'lib/caliper/entities/lis/membership.rb'
|
@@ -27,12 +28,11 @@ require_all 'lib/caliper/entities/lis/course_offering.rb'
|
|
27
28
|
require_all 'lib/caliper/entities/lis/group.rb'
|
28
29
|
require_all 'lib/caliper/entities/reading/epub_volume.rb'
|
29
30
|
require_all 'lib/caliper/entities/reading/web_page.rb'
|
30
|
-
require_all 'lib/caliper/
|
31
|
-
require_all 'lib/caliper/profiles/reading_profile.rb'
|
31
|
+
require_all 'lib/caliper/events/navigation_event.rb'
|
32
32
|
require 'json_spec'
|
33
33
|
|
34
34
|
module Caliper
|
35
|
-
module
|
35
|
+
module Events
|
36
36
|
|
37
37
|
describe NavigationEvent do
|
38
38
|
|
@@ -40,102 +40,93 @@ module Caliper
|
|
40
40
|
|
41
41
|
# Actor
|
42
42
|
actor = Caliper::Entities::Agent::Person.new
|
43
|
-
actor.id = 'https://
|
44
|
-
actor.dateCreated =
|
45
|
-
actor.dateModified =
|
43
|
+
actor.id = 'https://example.edu/user/554433'
|
44
|
+
actor.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
45
|
+
actor.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
46
46
|
|
47
47
|
# Action
|
48
|
-
action = Caliper::
|
48
|
+
action = Caliper::Actions::NavigationActions::NAVIGATED_TO
|
49
49
|
|
50
50
|
# Object
|
51
51
|
obj = Caliper::Entities::Reading::EPubVolume.new
|
52
|
-
obj.id = 'https://
|
52
|
+
obj.id = 'https://example.com/viewer/book/34843#epubcfi(/4/3)'
|
53
53
|
obj.name = 'The Glorious Cause: The American Revolution, 1763-1789 (Oxford History of the United States)'
|
54
54
|
obj.version = '2nd ed.'
|
55
|
-
obj.dateCreated =
|
56
|
-
obj.dateModified =
|
55
|
+
obj.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
56
|
+
obj.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
57
57
|
|
58
58
|
# Target frame
|
59
59
|
target = Caliper::Entities::Reading::Frame.new
|
60
|
-
target.id = 'https://
|
60
|
+
target.id = 'https://example.com/viewer/book/34843#epubcfi(/4/3/1)'
|
61
61
|
target.name = 'Key Figures: George Washington'
|
62
62
|
target.isPartOf = obj
|
63
63
|
target.version = obj.version
|
64
64
|
target.index = 1
|
65
|
-
target.dateCreated =
|
66
|
-
target.dateModified =
|
65
|
+
target.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
66
|
+
target.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
67
67
|
|
68
68
|
# NavigatedFrom property (specific to Navigation Event)
|
69
69
|
from = Caliper::Entities::Reading::WebPage.new
|
70
|
-
from.id = 'https://
|
70
|
+
from.id = 'https://example.edu/politicalScience/2015/american-revolution-101/index.html'
|
71
71
|
from.name = 'American Revolution 101 Landing Page'
|
72
|
-
from.dateCreated =
|
73
|
-
from.dateModified =
|
74
|
-
from.isPartOf = nil
|
72
|
+
from.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
73
|
+
from.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
75
74
|
from.version = '1.0'
|
76
75
|
|
77
76
|
# EdApp
|
78
77
|
ed_app = Caliper::Entities::Agent::SoftwareApplication.new
|
79
|
-
ed_app.id = 'https://
|
80
|
-
ed_app.name = '
|
81
|
-
ed_app.dateCreated =
|
82
|
-
ed_app.dateModified =
|
78
|
+
ed_app.id = 'https://example.com/viewer'
|
79
|
+
ed_app.name = 'ePub'
|
80
|
+
ed_app.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
81
|
+
ed_app.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
83
82
|
|
84
83
|
# LIS Course Offering
|
85
84
|
course = Caliper::Entities::LIS::CourseOffering.new
|
86
|
-
course.id = "https://
|
85
|
+
course.id = "https://example.edu/politicalScience/2015/american-revolution-101"
|
87
86
|
course.name = "Political Science 101: The American Revolution"
|
88
87
|
course.courseNumber = "POL101"
|
89
88
|
course.academicSession = "Fall-2015"
|
90
|
-
course.
|
91
|
-
course.
|
92
|
-
course.dateModified = '2015-09-02T11:30:00.000Z'
|
89
|
+
course.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
90
|
+
course.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
93
91
|
|
94
92
|
# LIS Course Section
|
95
93
|
section = Caliper::Entities::LIS::CourseSection.new
|
96
|
-
section.id = 'https://
|
94
|
+
section.id = 'https://example.edu/politicalScience/2015/american-revolution-101/section/001'
|
97
95
|
section.name = 'American Revolution 101'
|
98
96
|
section.courseNumber = "POL101"
|
99
97
|
section.academicSession = "Fall-2015"
|
100
|
-
section.category = nil
|
101
98
|
section.subOrganizationOf = course
|
102
|
-
section.dateCreated =
|
103
|
-
section.dateModified =
|
99
|
+
section.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
100
|
+
section.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
104
101
|
|
105
102
|
# LIS Group
|
106
103
|
group = Caliper::Entities::LIS::Group.new
|
107
|
-
group.id = "https://
|
104
|
+
group.id = "https://example.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
108
105
|
group.name = "Discussion Group 001"
|
109
106
|
group.subOrganizationOf = section
|
110
|
-
group.dateCreated =
|
111
|
-
group.dateModified = nil
|
107
|
+
group.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
112
108
|
|
113
109
|
membership = Caliper::Entities::LIS::Membership.new
|
114
|
-
membership.id = "https://
|
110
|
+
membership.id = "https://example.edu/politicalScience/2015/american-revolution-101/roster/554433"
|
115
111
|
membership.name = "American Revolution 101"
|
116
112
|
membership.description = "Roster entry"
|
117
|
-
membership.member = "https://
|
118
|
-
membership.organization = "https://
|
113
|
+
membership.member = "https://example.edu/user/554433"
|
114
|
+
membership.organization = "https://example.edu/politicalScience/2015/american-revolution-101/section/001"
|
119
115
|
membership.roles = [Caliper::Entities::LIS::Role::LEARNER]
|
120
116
|
membership.status = Caliper::Entities::LIS::Status::ACTIVE
|
121
|
-
membership.dateCreated =
|
122
|
-
membership.dateModified = nil
|
117
|
+
membership.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
123
118
|
|
124
119
|
# Create the Event
|
125
|
-
event = Caliper::
|
120
|
+
event = Caliper::Events::NavigationEvent.new
|
126
121
|
event.actor = actor
|
127
122
|
event.action = action
|
128
123
|
event.object = obj
|
129
124
|
event.target = target
|
130
|
-
event.generated = nil
|
131
125
|
event.navigatedFrom = from
|
132
|
-
event.
|
133
|
-
event.endedAtTime = nil
|
134
|
-
event.duration = nil
|
126
|
+
event.eventTime = Time.utc(2015,9,15,10,15,0).iso8601(3)
|
135
127
|
event.edApp = ed_app
|
136
128
|
event.group = group
|
137
129
|
event.membership = membership
|
138
|
-
# puts "Event JSON = #{event.to_json}'"
|
139
130
|
|
140
131
|
# Load JSON from caliper-common-fixtures for comparison
|
141
132
|
# NOTE - sym link to caliper-common-fixtures needs to exist under spec/fixtures
|
@@ -145,7 +136,7 @@ module Caliper
|
|
145
136
|
expect(event.to_json).to be_json_eql(expected_json)#.excluding("actor", "action", "object", "target", "generated", "edApp", "group")
|
146
137
|
|
147
138
|
# puts "JSON from file = #{data_hash}"
|
148
|
-
deser_event = Caliper::
|
139
|
+
deser_event = Caliper::Events::NavigationEvent.new
|
149
140
|
deser_event.from_json data_hash
|
150
141
|
# puts "ReadingEvent from JSON = #{deser_event.to_json}"
|
151
142
|
|