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,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/annotation_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/annotation/highlight_annotation.rb'
|
30
|
-
require_all 'lib/caliper/
|
31
|
-
require_all 'lib/caliper/profiles/annotation_profile.rb'
|
31
|
+
require_all 'lib/caliper/events/annotation_event.rb'
|
32
32
|
require 'json_spec'
|
33
33
|
|
34
34
|
module Caliper
|
35
|
-
module
|
35
|
+
module Events
|
36
36
|
|
37
37
|
describe AnnotationEvent do
|
38
38
|
|
@@ -40,103 +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::AnnotationActions::HIGHLIGHTED
|
49
49
|
|
50
50
|
# ePub parent volume
|
51
51
|
ePub = Caliper::Entities::Reading::EPubVolume.new
|
52
|
-
ePub.id = 'https://
|
52
|
+
ePub.id = 'https://example.com/viewer/book/34843#epubcfi(/4/3)'
|
53
53
|
ePub.name = 'The Glorious Cause: The American Revolution, 1763-1789 (Oxford History of the United States)'
|
54
54
|
ePub.version = '2nd ed.'
|
55
|
-
ePub.dateCreated =
|
56
|
-
ePub.dateModified =
|
55
|
+
ePub.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
56
|
+
ePub.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
57
57
|
|
58
58
|
# Object
|
59
59
|
obj = Caliper::Entities::Reading::Frame.new
|
60
|
-
obj.id = 'https://
|
60
|
+
obj.id = 'https://example.com/viewer/book/34843#epubcfi(/4/3/1)'
|
61
61
|
obj.name = 'Key Figures: George Washington'
|
62
62
|
obj.isPartOf = ePub
|
63
63
|
obj.version = ePub.version
|
64
64
|
obj.index = 1
|
65
|
-
obj.dateCreated =
|
66
|
-
obj.dateModified =
|
65
|
+
obj.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
66
|
+
obj.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
67
67
|
|
68
68
|
# Generated annotation
|
69
69
|
highlight = Caliper::Entities::Annotation::HighlightAnnotation.new
|
70
|
-
highlight.id = 'https://
|
71
|
-
highlight.
|
72
|
-
highlight.
|
73
|
-
highlight.
|
74
|
-
highlight.dateModified = '2015-09-02T11:30:00.000Z'
|
75
|
-
highlight.annotated = 'https://github.com/readium/readium-js-viewer/book/34843#epubcfi(/4/3/1)'
|
70
|
+
highlight.id = 'https://example.edu/highlights/12345'
|
71
|
+
highlight.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
72
|
+
highlight.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
73
|
+
highlight.annotated = 'https://example.com/viewer/book/34843#epubcfi(/4/3/1)'
|
76
74
|
highlight.selectionText = 'Life, Liberty and the pursuit of Happiness'
|
77
75
|
highlight.selection = { 'start' => '455', 'end' => '489'}
|
78
76
|
|
79
|
-
#
|
77
|
+
# ePub app
|
80
78
|
ed_app = Caliper::Entities::Agent::SoftwareApplication.new
|
81
|
-
ed_app.id = 'https://
|
82
|
-
ed_app.name = '
|
83
|
-
ed_app.dateCreated =
|
84
|
-
ed_app.dateModified =
|
79
|
+
ed_app.id = 'https://example.com/viewer'
|
80
|
+
ed_app.name = 'ePub'
|
81
|
+
ed_app.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
82
|
+
ed_app.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
85
83
|
|
86
84
|
# LIS Course Offering
|
87
85
|
course = Caliper::Entities::LIS::CourseOffering.new
|
88
|
-
course.id = "https://
|
86
|
+
course.id = "https://example.edu/politicalScience/2015/american-revolution-101"
|
89
87
|
course.name = "Political Science 101: The American Revolution"
|
90
88
|
course.courseNumber = "POL101"
|
91
89
|
course.academicSession = "Fall-2015"
|
92
|
-
course.
|
93
|
-
course.
|
94
|
-
course.dateModified = '2015-09-02T11:30:00.000Z'
|
90
|
+
course.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
91
|
+
course.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
95
92
|
|
96
93
|
# LIS Course Section
|
97
94
|
section = Caliper::Entities::LIS::CourseSection.new
|
98
|
-
section.id = 'https://
|
95
|
+
section.id = 'https://example.edu/politicalScience/2015/american-revolution-101/section/001'
|
99
96
|
section.name = 'American Revolution 101'
|
100
97
|
section.courseNumber = "POL101"
|
101
98
|
section.academicSession = "Fall-2015"
|
102
|
-
section.category = nil
|
103
99
|
section.subOrganizationOf = course
|
104
|
-
section.dateCreated =
|
105
|
-
section.dateModified =
|
100
|
+
section.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
101
|
+
section.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
106
102
|
|
107
103
|
# LIS Group
|
108
104
|
group = Caliper::Entities::LIS::Group.new
|
109
|
-
group.id = "https://
|
105
|
+
group.id = "https://example.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
110
106
|
group.name = "Discussion Group 001"
|
111
107
|
group.subOrganizationOf = section
|
112
|
-
group.dateCreated =
|
113
|
-
group.dateModified = nil
|
108
|
+
group.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
114
109
|
|
115
110
|
membership = Caliper::Entities::LIS::Membership.new
|
116
|
-
membership.id = "https://
|
111
|
+
membership.id = "https://example.edu/politicalScience/2015/american-revolution-101/roster/554433"
|
117
112
|
membership.name = "American Revolution 101"
|
118
113
|
membership.description = "Roster entry"
|
119
|
-
membership.member = "https://
|
120
|
-
membership.organization = "https://
|
114
|
+
membership.member = "https://example.edu/user/554433"
|
115
|
+
membership.organization = "https://example.edu/politicalScience/2015/american-revolution-101/section/001"
|
121
116
|
membership.roles = [Caliper::Entities::LIS::Role::LEARNER]
|
122
117
|
membership.status = Caliper::Entities::LIS::Status::ACTIVE
|
123
|
-
membership.dateCreated =
|
124
|
-
membership.dateModified = nil
|
118
|
+
membership.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
125
119
|
|
126
120
|
# Create the Event
|
127
121
|
event = AnnotationEvent.new
|
128
122
|
event.actor = actor
|
129
123
|
event.action = action
|
130
124
|
event.object = obj
|
131
|
-
event.target = nil
|
132
125
|
event.generated = highlight
|
133
|
-
event.
|
134
|
-
event.endedAtTime = nil
|
135
|
-
event.duration = nil
|
126
|
+
event.eventTime = Time.utc(2015,9,15,10,15,0).iso8601(3)
|
136
127
|
event.edApp = ed_app
|
137
128
|
event.group = group
|
138
129
|
event.membership = membership
|
139
|
-
# puts "Event JSON = #{event.to_json}'"
|
140
130
|
|
141
131
|
# Load JSON from caliper-common-fixtures for comparison
|
142
132
|
# NOTE - sym link to caliper-common-fixtures needs to exist under spec/fixtures
|
data/spec/lib/{event/annotation_event_shared_spec.rb → events/annotation_shared_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/annotation_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/annotation/shared_annotation.rb'
|
30
|
-
require_all 'lib/caliper/
|
31
|
-
require_all 'lib/caliper/profiles/annotation_profile.rb'
|
31
|
+
require_all 'lib/caliper/events/annotation_event.rb'
|
32
32
|
require 'json_spec'
|
33
33
|
|
34
34
|
module Caliper
|
35
|
-
module
|
35
|
+
module Events
|
36
36
|
|
37
37
|
describe AnnotationEvent do
|
38
38
|
|
@@ -40,113 +40,103 @@ 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::AnnotationActions::SHARED
|
49
49
|
|
50
50
|
# ePub parent volume
|
51
51
|
ePub = Caliper::Entities::Reading::EPubVolume.new
|
52
|
-
ePub.id = 'https://
|
52
|
+
ePub.id = 'https://example.com/viewer/book/34843#epubcfi(/4/3)'
|
53
53
|
ePub.name = 'The Glorious Cause: The American Revolution, 1763-1789 (Oxford History of the United States)'
|
54
54
|
ePub.version = '2nd ed.'
|
55
|
-
ePub.dateCreated =
|
56
|
-
ePub.dateModified =
|
55
|
+
ePub.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
56
|
+
ePub.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
57
57
|
|
58
58
|
# Object
|
59
59
|
obj = Caliper::Entities::Reading::Frame.new
|
60
|
-
obj.id = 'https://
|
60
|
+
obj.id = 'https://example.com/viewer/book/34843#epubcfi(/4/3/3)'
|
61
61
|
obj.name = 'Key Figures: John Adams'
|
62
62
|
obj.isPartOf = ePub
|
63
63
|
obj.version = ePub.version
|
64
64
|
obj.index = 3
|
65
|
-
obj.dateCreated =
|
66
|
-
obj.dateModified =
|
65
|
+
obj.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
66
|
+
obj.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
67
67
|
|
68
68
|
# Generated annotation
|
69
69
|
shared = Caliper::Entities::Annotation::SharedAnnotation.new
|
70
|
-
shared.id = 'https://
|
71
|
-
shared.
|
72
|
-
shared.
|
73
|
-
shared.
|
74
|
-
shared.dateModified = '2015-09-02T11:30:00.000Z'
|
75
|
-
shared.annotated = 'https://github.com/readium/readium-js-viewer/book/34843#epubcfi(/4/3/3)'
|
70
|
+
shared.id = 'https://example.edu/shared/9999'
|
71
|
+
shared.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
72
|
+
shared.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
73
|
+
shared.annotated = 'https://example.com/viewer/book/34843#epubcfi(/4/3/3)'
|
76
74
|
|
77
75
|
classmate1 = Caliper::Entities::Agent::Person.new
|
78
|
-
classmate1.id = 'https://
|
79
|
-
classmate1.dateCreated =
|
80
|
-
classmate1.dateModified =
|
76
|
+
classmate1.id = 'https://example.edu/user/657585'
|
77
|
+
classmate1.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
78
|
+
classmate1.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
81
79
|
|
82
80
|
classmate2 = Caliper::Entities::Agent::Person.new
|
83
|
-
classmate2.id = 'https://
|
84
|
-
classmate2.dateCreated =
|
85
|
-
classmate2.dateModified =
|
81
|
+
classmate2.id = 'https://example.edu/user/667788'
|
82
|
+
classmate2.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
83
|
+
classmate2.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
86
84
|
|
87
85
|
shared.withAgents = [classmate1, classmate2]
|
88
86
|
|
89
|
-
#
|
87
|
+
# ePub app
|
90
88
|
ed_app = Caliper::Entities::Agent::SoftwareApplication.new
|
91
|
-
ed_app.id = 'https://
|
92
|
-
ed_app.name = '
|
93
|
-
ed_app.dateCreated =
|
94
|
-
ed_app.dateModified =
|
89
|
+
ed_app.id = 'https://example.com/viewer'
|
90
|
+
ed_app.name = 'ePub'
|
91
|
+
ed_app.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
92
|
+
ed_app.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
95
93
|
|
96
94
|
# LIS Course Offering
|
97
95
|
course = Caliper::Entities::LIS::CourseOffering.new
|
98
|
-
course.id = "https://
|
96
|
+
course.id = "https://example.edu/politicalScience/2015/american-revolution-101"
|
99
97
|
course.name = "Political Science 101: The American Revolution"
|
100
98
|
course.courseNumber = "POL101"
|
101
99
|
course.academicSession = "Fall-2015"
|
102
|
-
course.
|
103
|
-
course.
|
104
|
-
course.dateModified = '2015-09-02T11:30:00.000Z'
|
100
|
+
course.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
101
|
+
course.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
105
102
|
|
106
103
|
# LIS Course Section
|
107
104
|
section = Caliper::Entities::LIS::CourseSection.new
|
108
|
-
section.id = 'https://
|
105
|
+
section.id = 'https://example.edu/politicalScience/2015/american-revolution-101/section/001'
|
109
106
|
section.name = 'American Revolution 101'
|
110
107
|
section.courseNumber = "POL101"
|
111
108
|
section.academicSession = "Fall-2015"
|
112
|
-
section.category = nil
|
113
109
|
section.subOrganizationOf = course
|
114
|
-
section.dateCreated =
|
115
|
-
section.dateModified =
|
110
|
+
section.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
111
|
+
section.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
116
112
|
|
117
113
|
# LIS Group
|
118
114
|
group = Caliper::Entities::LIS::Group.new
|
119
|
-
group.id = "https://
|
115
|
+
group.id = "https://example.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
120
116
|
group.name = "Discussion Group 001"
|
121
117
|
group.subOrganizationOf = section
|
122
|
-
group.dateCreated =
|
123
|
-
group.dateModified = nil
|
118
|
+
group.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
124
119
|
|
125
120
|
membership = Caliper::Entities::LIS::Membership.new
|
126
|
-
membership.id = "https://
|
121
|
+
membership.id = "https://example.edu/politicalScience/2015/american-revolution-101/roster/554433"
|
127
122
|
membership.name = "American Revolution 101"
|
128
123
|
membership.description = "Roster entry"
|
129
|
-
membership.member = "https://
|
130
|
-
membership.organization = "https://
|
124
|
+
membership.member = "https://example.edu/user/554433"
|
125
|
+
membership.organization = "https://example.edu/politicalScience/2015/american-revolution-101/section/001"
|
131
126
|
membership.roles = [Caliper::Entities::LIS::Role::LEARNER]
|
132
127
|
membership.status = Caliper::Entities::LIS::Status::ACTIVE
|
133
|
-
membership.dateCreated =
|
134
|
-
membership.dateModified = nil
|
128
|
+
membership.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
135
129
|
|
136
130
|
# Create the Event
|
137
131
|
event = AnnotationEvent.new
|
138
132
|
event.actor = actor
|
139
133
|
event.action = action
|
140
134
|
event.object = obj
|
141
|
-
event.target = nil
|
142
135
|
event.generated = shared
|
143
|
-
event.
|
144
|
-
event.endedAtTime = nil
|
145
|
-
event.duration = nil
|
136
|
+
event.eventTime = Time.utc(2015,9,15,10,15,0).iso8601(3)
|
146
137
|
event.edApp = ed_app
|
147
138
|
event.group = group
|
148
139
|
event.membership = membership
|
149
|
-
# puts "Event JSON = #{event.to_json}'"
|
150
140
|
|
151
141
|
# Load JSON from caliper-common-fixtures for comparison
|
152
142
|
# 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/annotation_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/annotation/tag_annotation.rb'
|
30
|
-
require_all 'lib/caliper/
|
31
|
-
require_all 'lib/caliper/profiles/annotation_profile.rb'
|
31
|
+
require_all 'lib/caliper/events/annotation_event.rb'
|
32
32
|
require 'json_spec'
|
33
33
|
|
34
34
|
module Caliper
|
35
|
-
module
|
35
|
+
module Events
|
36
36
|
|
37
37
|
describe AnnotationEvent do
|
38
38
|
|
@@ -40,102 +40,92 @@ 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::AnnotationActions::TAGGED
|
49
49
|
|
50
50
|
# ePub parent volume
|
51
51
|
ePub = Caliper::Entities::Reading::EPubVolume.new
|
52
|
-
ePub.id = 'https://
|
52
|
+
ePub.id = 'https://example.com/viewer/book/34843#epubcfi(/4/3)'
|
53
53
|
ePub.name = 'The Glorious Cause: The American Revolution, 1763-1789 (Oxford History of the United States)'
|
54
54
|
ePub.version = '2nd ed.'
|
55
|
-
ePub.dateCreated =
|
56
|
-
ePub.dateModified =
|
55
|
+
ePub.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
56
|
+
ePub.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
57
57
|
|
58
58
|
# Object
|
59
59
|
obj = Caliper::Entities::Reading::Frame.new
|
60
|
-
obj.id = 'https://
|
60
|
+
obj.id = 'https://example.com/viewer/book/34843#epubcfi(/4/3/4)'
|
61
61
|
obj.name = 'The Stamp Act Crisis'
|
62
62
|
obj.isPartOf = ePub
|
63
63
|
obj.version = ePub.version
|
64
64
|
obj.index = 4
|
65
|
-
obj.dateCreated =
|
66
|
-
obj.dateModified =
|
65
|
+
obj.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
66
|
+
obj.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
67
67
|
|
68
68
|
# Generated annotation
|
69
69
|
tag = Caliper::Entities::Annotation::TagAnnotation.new
|
70
|
-
tag.id = 'https://
|
71
|
-
tag.
|
72
|
-
tag.
|
73
|
-
tag.
|
74
|
-
tag.dateModified = '2015-09-02T11:30:00.000Z'
|
75
|
-
tag.annotated = 'https://github.com/readium/readium-js-viewer/book/34843#epubcfi(/4/3/4)'
|
70
|
+
tag.id = 'https://example.edu/tags/7654'
|
71
|
+
tag.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
72
|
+
tag.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
73
|
+
tag.annotated = 'https://example.com/viewer/book/34843#epubcfi(/4/3/4)'
|
76
74
|
tag.tags = ["to-read", "1765", "shared-with-project-team"]
|
77
75
|
|
78
|
-
#
|
76
|
+
# ePub app
|
79
77
|
ed_app = Caliper::Entities::Agent::SoftwareApplication.new
|
80
|
-
ed_app.id = 'https://
|
81
|
-
ed_app.name = '
|
82
|
-
ed_app.dateCreated =
|
83
|
-
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)
|
84
82
|
|
85
83
|
# LIS Course Offering
|
86
84
|
course = Caliper::Entities::LIS::CourseOffering.new
|
87
|
-
course.id = "https://
|
85
|
+
course.id = "https://example.edu/politicalScience/2015/american-revolution-101"
|
88
86
|
course.name = "Political Science 101: The American Revolution"
|
89
87
|
course.courseNumber = "POL101"
|
90
88
|
course.academicSession = "Fall-2015"
|
91
|
-
course.
|
92
|
-
course.
|
93
|
-
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)
|
94
91
|
|
95
92
|
# LIS Course Section
|
96
93
|
section = Caliper::Entities::LIS::CourseSection.new
|
97
|
-
section.id = 'https://
|
94
|
+
section.id = 'https://example.edu/politicalScience/2015/american-revolution-101/section/001'
|
98
95
|
section.name = 'American Revolution 101'
|
99
96
|
section.courseNumber = "POL101"
|
100
97
|
section.academicSession = "Fall-2015"
|
101
|
-
section.category = nil
|
102
98
|
section.subOrganizationOf = course
|
103
|
-
section.dateCreated =
|
104
|
-
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)
|
105
101
|
|
106
102
|
# LIS Group
|
107
103
|
group = Caliper::Entities::LIS::Group.new
|
108
|
-
group.id = "https://
|
104
|
+
group.id = "https://example.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
109
105
|
group.name = "Discussion Group 001"
|
110
106
|
group.subOrganizationOf = section
|
111
|
-
group.dateCreated =
|
112
|
-
group.dateModified = nil
|
107
|
+
group.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
113
108
|
|
114
109
|
membership = Caliper::Entities::LIS::Membership.new
|
115
|
-
membership.id = "https://
|
110
|
+
membership.id = "https://example.edu/politicalScience/2015/american-revolution-101/roster/554433"
|
116
111
|
membership.name = "American Revolution 101"
|
117
112
|
membership.description = "Roster entry"
|
118
|
-
membership.member = "https://
|
119
|
-
membership.organization = "https://
|
113
|
+
membership.member = "https://example.edu/user/554433"
|
114
|
+
membership.organization = "https://example.edu/politicalScience/2015/american-revolution-101/section/001"
|
120
115
|
membership.roles = [Caliper::Entities::LIS::Role::LEARNER]
|
121
116
|
membership.status = Caliper::Entities::LIS::Status::ACTIVE
|
122
|
-
membership.dateCreated =
|
123
|
-
membership.dateModified = nil
|
117
|
+
membership.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
124
118
|
|
125
119
|
# Create the Event
|
126
120
|
event = AnnotationEvent.new
|
127
121
|
event.actor = actor
|
128
122
|
event.action = action
|
129
123
|
event.object = obj
|
130
|
-
event.target = nil
|
131
124
|
event.generated = tag
|
132
|
-
event.
|
133
|
-
event.endedAtTime = nil
|
134
|
-
event.duration = nil
|
125
|
+
event.eventTime = Time.utc(2015,9,15,10,15,0).iso8601(3)
|
135
126
|
event.edApp = ed_app
|
136
127
|
event.group = group
|
137
128
|
event.membership = membership
|
138
|
-
# puts "Event JSON = #{event.to_json}'"
|
139
129
|
|
140
130
|
# Load JSON from caliper-common-fixtures for comparison
|
141
131
|
# NOTE - sym link to caliper-common-fixtures needs to exist under spec/fixtures
|