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
data/lib/caliper/version.rb
CHANGED
data/lib/caliper.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
{
|
2
|
-
"@
|
2
|
+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1/Context",
|
3
|
+
"@id": "https://example.edu/user/123456789",
|
3
4
|
"@type": "http://purl.imsglobal.org/caliper/v1/lis/Person",
|
4
|
-
"name":
|
5
|
-
"description": "A
|
5
|
+
"name": null,
|
6
|
+
"description": "A bright individual",
|
6
7
|
"extensions": {
|
7
8
|
"customProp": 42
|
8
9
|
},
|
@@ -30,22 +30,21 @@ module Caliper
|
|
30
30
|
describe Person do
|
31
31
|
|
32
32
|
it "should ensure that a Person is correctly created and serialized" do
|
33
|
-
student = Person.new
|
34
|
-
student.id = 'https://
|
35
|
-
student.
|
36
|
-
student.description = 'A super bright individual'
|
33
|
+
student = Caliper::Entities::Agent::Person.new
|
34
|
+
student.id = 'https://example.edu/user/123456789'
|
35
|
+
student.description = 'A bright individual'
|
37
36
|
student.extensions = {'customProp' => 42}
|
38
37
|
student.dateCreated = '2015-03-15T23:09:11.000Z'
|
39
38
|
student.dateModified = '2015-03-15T23:09:11.000Z'
|
40
39
|
# puts "new student = #{student.to_json}"
|
41
40
|
|
42
41
|
# Compare JSON ouput
|
43
|
-
file = File.read('spec/lib/entities/agent/
|
42
|
+
file = File.read('spec/lib/entities/agent/person.json')
|
44
43
|
data_hash = JSON.parse(file)
|
45
44
|
expected_json = data_hash.to_json # convert hash back to JSON string after parse
|
46
45
|
expect(student.to_json).to be_json_eql(expected_json)
|
47
46
|
|
48
|
-
des_student = Person.new
|
47
|
+
des_student = Caliper::Entities::Agent::Person.new
|
49
48
|
des_student.from_json data_hash
|
50
49
|
# puts "Object from JSON = #{des_student.to_json}"
|
51
50
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"@context": "http://purl.imsglobal.org/ctx/caliper/v1/Context",
|
3
|
+
"@id": "https://example.edu/politicalScience/2014/american-revolution-101/assessment/001",
|
4
|
+
"@type": "http://purl.imsglobal.org/caliper/v1/Assessment",
|
5
|
+
"name": "Assessment 001",
|
6
|
+
"description": "description",
|
7
|
+
"objectType": [],
|
8
|
+
"alignedLearningObjective": [],
|
9
|
+
"keywords": [],
|
10
|
+
"isPartOf": null,
|
11
|
+
"extensions": {"isPracticeTest": true},
|
12
|
+
"dateCreated": "2015-03-15T23:09:11.000Z",
|
13
|
+
"dateModified": "2015-03-15T23:09:11.000Z",
|
14
|
+
"datePublished": null,
|
15
|
+
"version": null,
|
16
|
+
"dateToActivate": null,
|
17
|
+
"dateToShow": null,
|
18
|
+
"dateToStartOn": null,
|
19
|
+
"dateToSubmit": null,
|
20
|
+
"maxAttempts": null,
|
21
|
+
"maxScore": null,
|
22
|
+
"maxSubmits": null
|
23
|
+
}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
##
|
2
|
+
# This file is part of IMS Caliper Analytics™ and is licensed to
|
3
|
+
# IMS Global Learning Consortium, Inc. (http://www.imsglobal.org)
|
4
|
+
# under one or more contributor license agreements. See the NOTICE
|
5
|
+
# file distributed with this work for additional information.
|
6
|
+
#
|
7
|
+
# IMS Caliper is free software: you can redistribute it and/or modify it under
|
8
|
+
# the terms of the GNU Lesser General Public License as published by the Free
|
9
|
+
# Software Foundation, version 3 of the License.
|
10
|
+
#
|
11
|
+
# IMS Caliper is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
13
|
+
# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public License along
|
16
|
+
# with this program. If not, see http://www.gnu.org/licenses/.
|
17
|
+
|
18
|
+
# require 'spec_helper.rb'
|
19
|
+
require 'require_all'
|
20
|
+
require 'json_spec'
|
21
|
+
require_all 'lib/caliper/entities/assessment/assessment.rb'
|
22
|
+
|
23
|
+
module Caliper
|
24
|
+
module Entities
|
25
|
+
module Assessment
|
26
|
+
|
27
|
+
describe Assessment do
|
28
|
+
|
29
|
+
it "should ensure that a base entity is correctly created and serialized" do
|
30
|
+
entity = Caliper::Entities::Assessment::Assessment.new
|
31
|
+
entity.id = 'https://example.edu/politicalScience/2014/american-revolution-101/assessment/001'
|
32
|
+
entity.name = 'Assessment 001'
|
33
|
+
entity.description = 'description'
|
34
|
+
entity.extensions = {'isPracticeTest' => true}
|
35
|
+
entity.dateCreated = '2015-03-15T23:09:11.000Z'
|
36
|
+
entity.dateModified = '2015-03-15T23:09:11.000Z'
|
37
|
+
# puts "Entity JSON = #{entity.to_json}"
|
38
|
+
|
39
|
+
# Compare JSON ouput
|
40
|
+
file = File.read('spec/lib/entities/assessment/assessment.json')
|
41
|
+
data_hash = JSON.parse(file)
|
42
|
+
expected_json = data_hash.to_json # convert hash back to JSON string after parse
|
43
|
+
expect(entity.to_json).to be_json_eql(expected_json)#.excluding("@class")
|
44
|
+
|
45
|
+
# Compare Deserialized JSON to desired Entity
|
46
|
+
des_entity = Caliper::Entities::Assessment::Assessment.new
|
47
|
+
des_entity.from_json data_hash
|
48
|
+
# puts "Object from JSON = #{des_entity.to_json}"
|
49
|
+
expect(entity).to eql(des_entity)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/spec/lib/event_helper.rb
CHANGED
@@ -16,7 +16,7 @@
|
|
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/entities/
|
19
|
+
require_all 'lib/caliper/entities/entity_base.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'
|
@@ -28,8 +28,7 @@ require_all 'lib/caliper/entities/lis/group.rb'
|
|
28
28
|
require_all 'lib/caliper/entities/reading/epub_volume.rb'
|
29
29
|
require_all 'lib/caliper/entities/reading/frame.rb'
|
30
30
|
require_all 'lib/caliper/entities/session/session.rb'
|
31
|
-
require_all 'lib/caliper/
|
32
|
-
require_all 'lib/caliper/profiles/session_profile.rb'
|
31
|
+
require_all 'lib/caliper/events/session_event.rb'
|
33
32
|
|
34
33
|
module Helper
|
35
34
|
|
@@ -37,101 +36,94 @@ module Helper
|
|
37
36
|
|
38
37
|
# Edapp
|
39
38
|
ed_app = Caliper::Entities::Agent::SoftwareApplication.new
|
40
|
-
ed_app.id = 'https://
|
41
|
-
ed_app.name = '
|
42
|
-
ed_app.dateCreated =
|
43
|
-
ed_app.dateModified =
|
39
|
+
ed_app.id = 'https://example.com/viewer'
|
40
|
+
ed_app.name = 'ePub'
|
41
|
+
ed_app.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
42
|
+
ed_app.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
44
43
|
|
45
44
|
# Actor
|
46
45
|
actor = Caliper::Entities::Agent::Person.new
|
47
|
-
actor.id = 'https://
|
48
|
-
actor.dateCreated =
|
49
|
-
actor.dateModified =
|
46
|
+
actor.id = 'https://example.edu/user/554433'
|
47
|
+
actor.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
48
|
+
actor.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
50
49
|
|
51
50
|
# Action
|
52
|
-
action = Caliper::
|
51
|
+
action = Caliper::Actions::SessionActions::LOGGED_IN;
|
53
52
|
|
54
53
|
# Object
|
55
54
|
obj = ed_app
|
56
55
|
|
57
56
|
# ePub parent (frame.isPartOf)
|
58
57
|
ePub = Caliper::Entities::Reading::EPubVolume.new
|
59
|
-
ePub.id = 'https://
|
58
|
+
ePub.id = 'https://example.com/viewer/book/34843#epubcfi(/4/3)'
|
60
59
|
ePub.name = 'The Glorious Cause: The American Revolution, 1763-1789 (Oxford History of the United States)'
|
61
60
|
ePub.version = '2nd ed.'
|
62
|
-
ePub.dateCreated =
|
63
|
-
ePub.dateModified =
|
61
|
+
ePub.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
62
|
+
ePub.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
64
63
|
|
65
64
|
# Target frame
|
66
65
|
target = Caliper::Entities::Reading::Frame.new
|
67
|
-
target.id = 'https://
|
66
|
+
target.id = 'https://example.com/viewer/book/34843#epubcfi(/4/3/1)'
|
68
67
|
target.name = 'Key Figures: George Washington'
|
69
68
|
target.isPartOf = ePub
|
70
69
|
target.version = ePub.version
|
71
70
|
target.index = 1
|
72
|
-
target.dateCreated =
|
73
|
-
target.dateModified =
|
71
|
+
target.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
72
|
+
target.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
74
73
|
|
75
74
|
# Generated session
|
76
75
|
generated = Caliper::Entities::Session::Session.new
|
77
|
-
generated.id = 'https://
|
76
|
+
generated.id = 'https://example.com/viewer/session-123456789'
|
78
77
|
generated.name = 'session-123456789'
|
79
|
-
generated.description = nil
|
80
78
|
generated.actor = actor
|
81
79
|
generated.startedAtTime = '2015-09-15T10:15:00.000Z'
|
82
|
-
generated.
|
83
|
-
generated.
|
84
|
-
generated.dateCreated = '2015-08-01T06:00:00.000Z'
|
85
|
-
generated.dateModified = '2015-09-02T11:30:00.000Z'
|
80
|
+
generated.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
81
|
+
generated.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
86
82
|
|
87
83
|
# LIS Course Offering
|
88
84
|
course = Caliper::Entities::LIS::CourseOffering.new
|
89
|
-
course.id = "https://
|
85
|
+
course.id = "https://example.edu/politicalScience/2015/american-revolution-101"
|
90
86
|
course.name = "Political Science 101: The American Revolution"
|
91
87
|
course.courseNumber = "POL101"
|
92
88
|
course.academicSession = "Fall-2015"
|
93
|
-
course.
|
94
|
-
course.
|
95
|
-
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)
|
96
91
|
|
97
92
|
# LIS Course Section
|
98
93
|
section = Caliper::Entities::LIS::CourseSection.new
|
99
|
-
section.id = 'https://
|
94
|
+
section.id = 'https://example.edu/politicalScience/2015/american-revolution-101/section/001'
|
100
95
|
section.name = 'American Revolution 101'
|
101
96
|
section.courseNumber = "POL101"
|
102
97
|
section.academicSession = "Fall-2015"
|
103
|
-
section.category = nil
|
104
98
|
section.subOrganizationOf = course
|
105
|
-
section.dateCreated =
|
106
|
-
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)
|
107
101
|
|
108
102
|
# LIS Group
|
109
103
|
group = Caliper::Entities::LIS::Group.new
|
110
|
-
group.id = "https://
|
104
|
+
group.id = "https://example.edu/politicalScience/2015/american-revolution-101/section/001/group/001"
|
111
105
|
group.name = "Discussion Group 001"
|
112
106
|
group.subOrganizationOf = section
|
113
|
-
group.dateCreated =
|
114
|
-
group.dateModified = nil
|
107
|
+
group.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
115
108
|
|
116
109
|
membership = Caliper::Entities::LIS::Membership.new
|
117
|
-
membership.id = "https://
|
110
|
+
membership.id = "https://example.edu/politicalScience/2015/american-revolution-101/roster/554433"
|
118
111
|
membership.name = "American Revolution 101"
|
119
112
|
membership.description = "Roster entry"
|
120
|
-
membership.member = "https://
|
121
|
-
membership.organization = "https://
|
113
|
+
membership.member = "https://example.edu/user/554433"
|
114
|
+
membership.organization = "https://example.edu/politicalScience/2015/american-revolution-101/section/001"
|
122
115
|
membership.roles = [Caliper::Entities::LIS::Role::LEARNER]
|
123
116
|
membership.status = Caliper::Entities::LIS::Status::ACTIVE
|
124
|
-
membership.dateCreated =
|
125
|
-
membership.dateModified = nil
|
117
|
+
membership.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
126
118
|
|
127
119
|
# Create the Event
|
128
|
-
event = Caliper::
|
120
|
+
event = Caliper::Events::SessionEvent.new
|
129
121
|
event.actor = actor
|
130
122
|
event.action = action
|
131
123
|
event.object = obj
|
132
124
|
event.target = target
|
133
125
|
event.generated = generated
|
134
|
-
event.
|
126
|
+
event.eventTime = Time.utc(2015,9,15,10,15,0).iso8601(3)
|
135
127
|
event.edApp = ed_app
|
136
128
|
event.group = course
|
137
129
|
event.membership = membership
|
data/spec/lib/{event/annotation_event_bookmark_spec.rb → events/annotation_bookmarked_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/bookmark_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::BOOKMARKED
|
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/2)'
|
61
61
|
obj.name = 'Key Figures: Lord North'
|
62
62
|
obj.isPartOf = ePub
|
63
63
|
obj.version = ePub.version
|
64
64
|
obj.index = 2
|
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
|
bookmark = Caliper::Entities::Annotation::BookmarkAnnotation.new
|
70
|
-
bookmark.id = 'https://
|
71
|
-
bookmark.
|
72
|
-
bookmark.
|
73
|
-
bookmark.
|
74
|
-
bookmark.dateModified = '2015-09-02T11:30:00.000Z'
|
75
|
-
bookmark.annotated = 'https://github.com/readium/readium-js-viewer/book/34843#epubcfi(/4/3/2)'
|
70
|
+
bookmark.id = 'https://example.edu/bookmarks/00001'
|
71
|
+
bookmark.dateCreated = Time.utc(2015,8,1,6,0,0).iso8601(3)
|
72
|
+
bookmark.dateModified = Time.utc(2015,9,2,11,30,0).iso8601(3)
|
73
|
+
bookmark.annotated = 'https://example.com/viewer/book/34843#epubcfi(/4/3/2)'
|
76
74
|
bookmark.bookmarkNotes = 'The Intolerable Acts (1774)--bad idea Lord North'
|
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 = bookmark
|
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
|