ims_caliper 0.1.1 → 0.1.2
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 +8 -8
- data/.gitignore +37 -0
- data/.idea/caliper-ruby.iml +98 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/misc.xml +5 -0
- data/.idea/modules.xml +9 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vcs.xml +7 -0
- data/Gemfile +12 -1
- data/Gemfile.lock +42 -1
- data/LICENSE +67 -0
- data/NOTICE +15 -0
- data/README.md +13 -5
- data/caliper.gemspec +2 -8
- data/lib/caliper/defaults.rb +4 -4
- data/lib/caliper/entities/annotation/annotation.rb +14 -4
- data/lib/caliper/entities/annotation/bookmark_annotation.rb +14 -4
- data/lib/caliper/entities/annotation/highlight_annotation.rb +14 -3
- data/lib/caliper/entities/annotation/shared_annotation.rb +12 -3
- data/lib/caliper/entities/annotation/tag_annotation.rb +13 -3
- data/lib/caliper/entities/assessment/assessment.rb +27 -0
- data/lib/caliper/entities/assessment/assessment_item.rb +26 -0
- data/lib/caliper/entities/assignable/assignable_digital_resource.rb +47 -0
- data/lib/caliper/entities/assignable/attempt.rb +32 -0
- data/lib/caliper/entities/digital_resource.rb +36 -35
- data/lib/caliper/entities/entity.rb +50 -36
- data/lib/caliper/entities/foaf/agent.rb +1 -1
- data/lib/caliper/entities/jsonable.rb +56 -0
- data/lib/caliper/entities/learning_objective.rb +26 -0
- data/lib/caliper/entities/lis/course_offering.rb +30 -0
- data/lib/caliper/entities/lis/course_section.rb +27 -15
- data/lib/caliper/entities/lis/group.rb +27 -0
- data/lib/caliper/entities/lis/membership.rb +32 -0
- data/lib/caliper/entities/lis/organization.rb +20 -17
- data/lib/caliper/entities/lis/person.rb +23 -10
- data/lib/caliper/entities/lis/roles.rb +77 -0
- data/lib/caliper/entities/lis/status.rb +19 -0
- data/lib/caliper/entities/media/audio_object.rb +21 -0
- data/lib/caliper/entities/media/image_object.rb +21 -0
- data/lib/caliper/entities/media/media_location.rb +23 -0
- data/lib/caliper/entities/media/media_object.rb +38 -0
- data/lib/caliper/entities/media/video_object.rb +21 -0
- data/lib/caliper/entities/reading/epub_volume.rb +15 -7
- data/lib/caliper/entities/reading/frame.rb +7 -15
- data/lib/caliper/entities/response/fillin_blank_response.rb +20 -0
- data/lib/caliper/entities/response/multiple_choice_response.rb +20 -0
- data/lib/caliper/entities/response/multiple_response_response.rb +20 -0
- data/lib/caliper/entities/response/response.rb +23 -0
- data/lib/caliper/entities/response/response_type.rb +13 -0
- data/lib/caliper/entities/response/select_type_response.rb +20 -0
- data/lib/caliper/entities/response/true_false_response.rb +21 -0
- data/lib/caliper/entities/schemadotorg/software_application.rb +8 -8
- data/lib/caliper/entities/session.rb +25 -17
- data/lib/caliper/entities/software_application.rb +16 -7
- data/lib/caliper/entities/web_page.rb +2 -0
- data/lib/caliper/entity_envelope.rb +21 -0
- data/lib/caliper/event/annotation_event.rb +10 -6
- data/lib/caliper/event/assessment_event.rb +19 -0
- data/lib/caliper/event/assessment_item_event.rb +19 -0
- data/lib/caliper/event/assignable_event.rb +19 -0
- data/lib/caliper/event/event.rb +70 -50
- data/lib/caliper/event/jsonable.rb +55 -0
- data/lib/caliper/event/navigation_event.rb +2 -7
- data/lib/caliper/event/outcome_event.rb +1 -1
- data/lib/caliper/event/session_event.rb +13 -14
- data/lib/caliper/event/view_event.rb +6 -7
- data/lib/caliper/event_envelope.rb +22 -0
- data/lib/caliper/jsonable.rb +53 -0
- data/lib/caliper/profiles/annotation_profile.rb +56 -53
- data/lib/caliper/profiles/assessment_profile.rb +48 -0
- data/lib/caliper/profiles/assignable_profile.rb +44 -0
- data/lib/caliper/profiles/media_profile.rb +54 -0
- data/lib/caliper/profiles/profile.rb +38 -38
- data/lib/caliper/profiles/reading_profile.rb +31 -28
- data/lib/caliper/profiles/session_profile.rb +17 -18
- data/lib/caliper/request/event_store_requestor.rb +26 -26
- data/lib/caliper/sensor.rb +46 -35
- data/lib/caliper/version.rb +1 -1
- data/spec/lib/entities/entity.json +9 -0
- data/spec/lib/entities/entity_spec.rb +37 -0
- data/spec/lib/entities/lis/person_spec.rb +37 -0
- data/spec/lib/entities/lis/student.json +11 -0
- data/spec/lib/event/annotation_event_bookmark_spec.rb +159 -0
- data/spec/lib/event/annotation_event_highlight_spec.rb +160 -0
- data/spec/lib/event/annotation_event_shared_spec.rb +172 -0
- data/spec/lib/event/annotation_event_tag_spec.rb +159 -0
- data/spec/lib/event/assessment_event_spec.rb +207 -0
- data/spec/lib/event/assessment_item_completed_event_spec.rb +223 -0
- data/spec/lib/event/assessment_item_started_event_spec.rb +207 -0
- data/spec/lib/event/media_event_spec.rb +157 -0
- data/spec/lib/event/navigated_event_spec.rb +160 -0
- data/spec/lib/event/session_event_login_spec.rb +160 -0
- data/spec/lib/event/session_event_logout_spec.rb +145 -0
- data/spec/lib/event/session_event_timeout_spec.rb +145 -0
- data/spec/lib/event/viewed_event_spec.rb +149 -0
- data/spec/lib/event_helper.rb +145 -0
- data/spec/lib/sensor_spec.rb +30 -0
- data/spec/spec_helper.rb +3 -2
- metadata +84 -61
- data/lib/caliper/client.rb +0 -33
- data/lib/caliper/consumer/base.rb +0 -46
- data/lib/caliper/consumer/queue.rb +0 -40
- data/lib/caliper/consumer/socket.rb +0 -132
- data/lib/caliper/entities/annotation/text_position_selector.rb +0 -14
- data/lib/caliper/entities/schemadotorg/audio_object.rb +0 -15
- data/lib/caliper/entities/schemadotorg/image_object.rb +0 -15
- data/lib/caliper/entities/schemadotorg/media_object.rb +0 -19
- data/lib/caliper/entities/schemadotorg/video_object.rb +0 -15
- data/lib/caliper/event/.shared.rb.swp +0 -0
- data/spec/lib/client_spec.rb +0 -35
- data/spec/lib/consumer/base_spec.rb +0 -28
- data/spec/lib/consumer/queue_spec.rb +0 -16
- data/spec/lib/event/annotation_spec.rb +0 -12
- data/spec/lib/event/bookmarked_spec.rb +0 -17
- data/spec/lib/event/commented_spec.rb +0 -19
- data/spec/lib/event/highlighted_spec.rb +0 -18
- data/spec/lib/event/navigation_spec.rb +0 -15
- data/spec/lib/event/shared_spec.rb +0 -18
- data/spec/lib/event/tagged_spec.rb +0 -17
- data/spec/lib/event/used_spec.rb +0 -15
- data/spec/lib/event/viewed_spec.rb +0 -15
- data/test/caliper/events/session_login_event_test.rb +0 -58
- data/test/caliper/events/session_logout_event_test.rb +0 -55
- data/test/caliper/events/session_timeout_event_test.rb +0 -55
- data/test/caliper/request/http_requestor_test.rb +0 -59
- data/test/caliper/test_event.rb +0 -53
- data/test/caliper/test_utils.rb +0 -198
- data/test/fixtures/caliper_session_login_event.json +0 -71
- data/test/fixtures/caliper_session_logout_event.json +0 -52
- data/test/fixtures/caliper_session_timeout_event.json +0 -52
- data/test/fixtures/event_store_payload.json +0 -85
@@ -1,61 +1,64 @@
|
|
1
|
-
|
2
1
|
require_relative './profile'
|
3
2
|
require_relative '../entities/digital_resource'
|
4
3
|
require_relative '../entities/annotation/annotation'
|
5
4
|
require_relative '../entities/reading/frame'
|
6
5
|
|
7
6
|
module Caliper
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
7
|
+
module Profiles
|
8
|
+
|
9
|
+
module AnnotationActions
|
10
|
+
ATTACHED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Attached"
|
11
|
+
BOOKMARKED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Bookmarked"
|
12
|
+
CLASSIFIED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Classified"
|
13
|
+
COMMENTED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Commented"
|
14
|
+
DESCRIBED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Described"
|
15
|
+
DISLIKED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Disliked"
|
16
|
+
HIGHLIGHTED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Highlighted"
|
17
|
+
IDENTIFIED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Identified"
|
18
|
+
LIKED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Liked"
|
19
|
+
LINKED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Linked"
|
20
|
+
RANKED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Ranked"
|
21
|
+
QUESTIONED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Questioned"
|
22
|
+
RECOMMENDED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Recommended"
|
23
|
+
REPLIED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Replied"
|
24
|
+
SHARED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Shared"
|
25
|
+
SUBSCRIBED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Subscribed"
|
26
|
+
TAGGED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Tagged"
|
27
|
+
NAVIGATED_TO = "http://purl.imsglobal.org/vocab/caliper/v1/action#NavigatedTo"
|
28
|
+
end
|
29
|
+
|
30
|
+
class ReadingProfile < Profile
|
31
|
+
include AnnotationActions
|
32
|
+
attr_accessor :key, # String
|
33
|
+
:lookup # hash of ReadingActions
|
31
34
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
35
|
+
# whether object if of type DigitalResource
|
36
|
+
def validate_object (object)
|
37
|
+
if (object.is_a? AnnotationType::BOOKMARK_ANNOTATION)
|
38
|
+
## TODO check required properties
|
39
|
+
return object
|
40
|
+
elsif (object.is_a? AnnotationType::HIGHLIGHT_ANNOTATION)
|
41
|
+
## TODO check required properties
|
42
|
+
return object
|
43
|
+
elsif (object.is_a? AnnotationType::SHARED_ANNOTATION)
|
44
|
+
## TODO check required properties
|
45
|
+
return object
|
46
|
+
elsif (object.is_a? AnnotationType::TAG_ANNOTATION)
|
47
|
+
## TODO check required properties
|
48
|
+
return object
|
49
|
+
else
|
50
|
+
fail "Object must be of type Annotation"
|
51
|
+
end
|
52
|
+
end
|
50
53
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
end
|
54
|
+
# whether target is of type Frame
|
55
|
+
def validate_target(target)
|
56
|
+
if (target is_a? Frame)
|
57
|
+
return target
|
58
|
+
else
|
59
|
+
fail "Target must be of type Frame."
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require_relative './profile'
|
2
|
+
|
3
|
+
module Caliper
|
4
|
+
module Profiles
|
5
|
+
|
6
|
+
module AssessmentActions
|
7
|
+
PAUSED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Paused"
|
8
|
+
RESTARTED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Restarted"
|
9
|
+
STARTED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Started"
|
10
|
+
SUBMITTED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Submitted"
|
11
|
+
NAVIGATED_TO = "http://purl.imsglobal.org/vocab/caliper/v1/action#NavigatedTo"
|
12
|
+
end
|
13
|
+
|
14
|
+
module AssessmentItemActions
|
15
|
+
COMPLETED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Completed"
|
16
|
+
REVIEWED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Reviewed"
|
17
|
+
SKIPPED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Skipped"
|
18
|
+
STARTED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Started"
|
19
|
+
VIEWED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Viewed"
|
20
|
+
NAVIGATED_TO = "http://purl.imsglobal.org/vocab/caliper/v1/action#NavigatedTo"
|
21
|
+
end
|
22
|
+
|
23
|
+
class AssessmentProfile < Caliper::Profiles::Profile
|
24
|
+
|
25
|
+
attr_accessor :key, # String
|
26
|
+
:lookup # hash of AssessmentActions
|
27
|
+
|
28
|
+
# whether object if of type DigitalResource
|
29
|
+
def validate_object(object)
|
30
|
+
if (object.is_a? DigitalResource)
|
31
|
+
return object
|
32
|
+
else
|
33
|
+
fail 'Object must e of type DigitalResource'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# whether target is of type Frame
|
38
|
+
def validate_target(target)
|
39
|
+
if (target is_a? frame)
|
40
|
+
return target
|
41
|
+
else
|
42
|
+
fail 'Target must be of type Frame'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require_relative './profile'
|
2
|
+
|
3
|
+
module Caliper
|
4
|
+
module Profiles
|
5
|
+
|
6
|
+
module AssignableActions
|
7
|
+
ABANDONED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Abandoned"
|
8
|
+
ACTIVATED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Activated"
|
9
|
+
COMPLETED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Completed"
|
10
|
+
DEACTIVATED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Deactivated"
|
11
|
+
HID = "http://purl.imsglobal.org/vocab/caliper/v1/action#Hid"
|
12
|
+
REVIEWED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Reviewed"
|
13
|
+
SHOWED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Showed"
|
14
|
+
STARTED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Started"
|
15
|
+
SUBMITTED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Submitted"
|
16
|
+
NAVIGATED_TO = "http://purl.imsglobal.org/vocab/caliper/v1/action#NavigatedTo"
|
17
|
+
end
|
18
|
+
|
19
|
+
class AssignableProfile < Caliper::Profiles::Profile
|
20
|
+
|
21
|
+
attr_accessor :key, # String
|
22
|
+
:lookup # hash of AssignableActions
|
23
|
+
|
24
|
+
# whether object if of type DigitalResource
|
25
|
+
def validate_object(object)
|
26
|
+
if (object.is_a? DigitalResource)
|
27
|
+
return object
|
28
|
+
else
|
29
|
+
fail 'Object must e of type DigitalResource'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# whether target is of type Frame
|
34
|
+
def validate_target(target)
|
35
|
+
if (target is_a? frame)
|
36
|
+
return target
|
37
|
+
else
|
38
|
+
fail 'Target must be of type Frame'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require_relative './profile'
|
2
|
+
|
3
|
+
module Caliper
|
4
|
+
module Profiles
|
5
|
+
|
6
|
+
module MediaActions
|
7
|
+
CHANGED_RESOLUTION = "http://purl.imsglobal.org/vocab/caliper/v1/action#ChangedResolution"
|
8
|
+
CHANGED_SIZE = "http://purl.imsglobal.org/vocab/caliper/v1/action#ChangedSize"
|
9
|
+
CHANGED_SPEED = "http://purl.imsglobal.org/vocab/caliper/v1/action#ChangedSpeed"
|
10
|
+
CHANGED_VOLUME = "http://purl.imsglobal.org/vocab/caliper/v1/action#ChangedVolume"
|
11
|
+
CLOSED_POPOUT = "http://purl.imsglobal.org/vocab/caliper/v1/action#ClosedPopout"
|
12
|
+
DISABLED_CLOSED_CAPTIONING = "http://purl.imsglobal.org/vocab/caliper/v1/action#DisabledCloseCaptioning"
|
13
|
+
ENABLED_CLOSE_CAPTIONING = "http://purl.imsglobal.org/vocab/caliper/v1/action#EnabledCloseCaptioning"
|
14
|
+
ENDED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Ended"
|
15
|
+
ENTERED_FULLSCREEN = "http://purl.imsglobal.org/vocab/caliper/v1/action#EnteredFullScreen"
|
16
|
+
EXITED_FULLSCREEN = "http://purl.imsglobal.org/vocab/caliper/v1/action#ExitedFullScreen"
|
17
|
+
FORWARDED_TO = "http://purl.imsglobal.org/vocab/caliper/v1/action#ForwardedTo"
|
18
|
+
JUMPED_TO = "http://purl.imsglobal.org/vocab/caliper/v1/action#JumpedTo"
|
19
|
+
MUTED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Muted"
|
20
|
+
OPENED_POPOUT = "http://purl.imsglobal.org/vocab/caliper/v1/action#OpenedPopout"
|
21
|
+
PAUSED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Paused"
|
22
|
+
RESUMED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Resumed"
|
23
|
+
REWOUND = "http://purl.imsglobal.org/vocab/caliper/v1/action#Rewound"
|
24
|
+
STARTED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Started"
|
25
|
+
UNMUTED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Unmuted"
|
26
|
+
NAVIGATED_TO = "http://purl.imsglobal.org/vocab/caliper/v1/action#NavigatedTo"
|
27
|
+
end
|
28
|
+
|
29
|
+
class MediaProfile < Caliper::Profiles::Profile
|
30
|
+
|
31
|
+
attr_accessor :key, # String
|
32
|
+
:lookup # hash of MediaActions
|
33
|
+
|
34
|
+
# whether object if of type DigitalResource
|
35
|
+
def validate_object(object)
|
36
|
+
if (object.is_a? DigitalResource)
|
37
|
+
return object
|
38
|
+
else
|
39
|
+
fail "Object must e of type DigitalResource"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# whether target is of type Frame
|
44
|
+
def validate_target(target)
|
45
|
+
if (target is_a? frame)
|
46
|
+
return target
|
47
|
+
else
|
48
|
+
fail "Target must be of type Frame."
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
@@ -2,45 +2,45 @@
|
|
2
2
|
require 'i18n'
|
3
3
|
|
4
4
|
module Caliper
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
module Profiles
|
6
|
+
module ProfileActions
|
7
|
+
DOWNLOADED = "item.downloaded"
|
8
|
+
UPLOADED = "item.uploaded"
|
9
|
+
LOGGED_IN = "session.loggedIn"
|
10
|
+
LOGGED_OUT = "session.loggedOut"
|
11
|
+
NAVIGATED_TO = "navigation.navigatedTo"
|
12
|
+
end
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
14
|
+
module ProfileConformance
|
15
|
+
ACTION_IS_NULL = "an action must be specified."
|
16
|
+
ACTION_UNRECOGNIZED = "unrecognized action."
|
17
|
+
ACTOR_NOT_PERSON = "actor must be of type Person"
|
18
|
+
ACTOR_NOT_SOFTWAREAPP = "actor must be of type SoftwareApplication"
|
19
|
+
CONTEXT_ERROR = "context URI must be specified"
|
20
|
+
DURATION_INVALID = "duration format is invalid"
|
21
|
+
ENDEDATTIME_SET = "endedAtTime must not be specified"
|
22
|
+
EVENT_ILLEGAL_STATE = "event constructed in an illegal state."
|
23
|
+
GENERATED_NOT_NULL = "a generated object is not required."
|
24
|
+
GENERATED_NOT_SESSION = "generated object must be of type Session"
|
25
|
+
OBJECT_NOT_SOFTWAREAPP = "object must be of type SoftwareApplication"
|
26
|
+
STARTEDATTIME_IS_NULL = "startedAtTime must be specified."
|
27
|
+
TARGET_NOT_DIGITALRESOURCE = "target must be of type DigitalResource"
|
28
|
+
TARGET_NOT_SESSION = "target must be of type Session"
|
29
|
+
TIME_ERROR = "end time must be greater than start time."
|
30
|
+
TYPE_ERROR = "type URI must be specified"
|
31
|
+
end
|
32
32
|
|
33
|
-
|
34
|
-
|
33
|
+
class Profile
|
34
|
+
include ProfileActions
|
35
35
|
|
36
|
-
|
37
|
-
|
36
|
+
def initialize()
|
37
|
+
end
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
39
|
+
def get_navigated_to_action_from_bundle(key)
|
40
|
+
if key.equal? ProfileActions::NAVIGATED_TO
|
41
|
+
return I18n.translate :action
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -1,36 +1,39 @@
|
|
1
|
-
|
2
1
|
require_relative './profile'
|
3
2
|
require_relative '../entities/digital_resource'
|
4
3
|
require_relative '../entities/reading/frame'
|
5
4
|
|
6
5
|
module Caliper
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
module Profiles
|
7
|
+
|
8
|
+
module ReadingActions
|
9
|
+
SEARCHED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Searched"
|
10
|
+
VIEWED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Viewed"
|
11
|
+
NAVIGATED_TO = "http://purl.imsglobal.org/vocab/caliper/v1/action#NavigatedTo"
|
12
|
+
end
|
13
|
+
|
14
|
+
class ReadingProfile < Caliper::Profiles::Profile
|
15
|
+
|
16
|
+
attr_accessor :key, # String
|
17
|
+
:lookup # hash of ReadingActions
|
13
18
|
|
14
|
-
|
15
|
-
|
19
|
+
# whether object if of type DigitalResource
|
20
|
+
def validate_object(object)
|
21
|
+
if (object.is_a? DigitalResource)
|
22
|
+
return object
|
23
|
+
else
|
24
|
+
fail "Object must e of type DigitalResource"
|
25
|
+
end
|
26
|
+
end
|
16
27
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
28
|
+
# whether target is of type Frame
|
29
|
+
def validate_target(target)
|
30
|
+
if (target is_a? frame)
|
31
|
+
return target
|
32
|
+
else
|
33
|
+
fail "Target must be of type Frame."
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
25
37
|
|
26
|
-
|
27
|
-
|
28
|
-
if (target is_a? frame)
|
29
|
-
return target
|
30
|
-
else
|
31
|
-
fail "Target must be of type Frame."
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
38
|
+
end
|
39
|
+
end
|
@@ -5,25 +5,24 @@ require_relative '../entities/annotation/annotation'
|
|
5
5
|
require_relative '../entities/reading/frame'
|
6
6
|
|
7
7
|
module Caliper
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
include SessionActions
|
8
|
+
module Profiles
|
9
|
+
module SessionActions
|
10
|
+
LOGGED_IN = 'http://purl.imsglobal.org/vocab/caliper/v1/action#LoggedIn'
|
11
|
+
LOGGED_OUT = 'http://purl.imsglobal.org/vocab/caliper/v1/action#LoggedOut'
|
12
|
+
TIMED_OUT = 'http://purl.imsglobal.org/vocab/caliper/v1/action#TimedOut'
|
13
|
+
end
|
14
|
+
class SessionProfile < Profile
|
15
|
+
include SessionActions
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
def initialize
|
18
|
+
super
|
19
|
+
end
|
21
20
|
|
22
|
-
|
23
|
-
|
21
|
+
# whether object if of type DigitalResource
|
22
|
+
def validate_event (event)
|
24
23
|
|
25
|
-
|
24
|
+
end
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|