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.
Files changed (131) hide show
  1. checksums.yaml +8 -8
  2. data/.gitignore +37 -0
  3. data/.idea/caliper-ruby.iml +98 -0
  4. data/.idea/encodings.xml +5 -0
  5. data/.idea/misc.xml +5 -0
  6. data/.idea/modules.xml +9 -0
  7. data/.idea/scopes/scope_settings.xml +5 -0
  8. data/.idea/vcs.xml +7 -0
  9. data/Gemfile +12 -1
  10. data/Gemfile.lock +42 -1
  11. data/LICENSE +67 -0
  12. data/NOTICE +15 -0
  13. data/README.md +13 -5
  14. data/caliper.gemspec +2 -8
  15. data/lib/caliper/defaults.rb +4 -4
  16. data/lib/caliper/entities/annotation/annotation.rb +14 -4
  17. data/lib/caliper/entities/annotation/bookmark_annotation.rb +14 -4
  18. data/lib/caliper/entities/annotation/highlight_annotation.rb +14 -3
  19. data/lib/caliper/entities/annotation/shared_annotation.rb +12 -3
  20. data/lib/caliper/entities/annotation/tag_annotation.rb +13 -3
  21. data/lib/caliper/entities/assessment/assessment.rb +27 -0
  22. data/lib/caliper/entities/assessment/assessment_item.rb +26 -0
  23. data/lib/caliper/entities/assignable/assignable_digital_resource.rb +47 -0
  24. data/lib/caliper/entities/assignable/attempt.rb +32 -0
  25. data/lib/caliper/entities/digital_resource.rb +36 -35
  26. data/lib/caliper/entities/entity.rb +50 -36
  27. data/lib/caliper/entities/foaf/agent.rb +1 -1
  28. data/lib/caliper/entities/jsonable.rb +56 -0
  29. data/lib/caliper/entities/learning_objective.rb +26 -0
  30. data/lib/caliper/entities/lis/course_offering.rb +30 -0
  31. data/lib/caliper/entities/lis/course_section.rb +27 -15
  32. data/lib/caliper/entities/lis/group.rb +27 -0
  33. data/lib/caliper/entities/lis/membership.rb +32 -0
  34. data/lib/caliper/entities/lis/organization.rb +20 -17
  35. data/lib/caliper/entities/lis/person.rb +23 -10
  36. data/lib/caliper/entities/lis/roles.rb +77 -0
  37. data/lib/caliper/entities/lis/status.rb +19 -0
  38. data/lib/caliper/entities/media/audio_object.rb +21 -0
  39. data/lib/caliper/entities/media/image_object.rb +21 -0
  40. data/lib/caliper/entities/media/media_location.rb +23 -0
  41. data/lib/caliper/entities/media/media_object.rb +38 -0
  42. data/lib/caliper/entities/media/video_object.rb +21 -0
  43. data/lib/caliper/entities/reading/epub_volume.rb +15 -7
  44. data/lib/caliper/entities/reading/frame.rb +7 -15
  45. data/lib/caliper/entities/response/fillin_blank_response.rb +20 -0
  46. data/lib/caliper/entities/response/multiple_choice_response.rb +20 -0
  47. data/lib/caliper/entities/response/multiple_response_response.rb +20 -0
  48. data/lib/caliper/entities/response/response.rb +23 -0
  49. data/lib/caliper/entities/response/response_type.rb +13 -0
  50. data/lib/caliper/entities/response/select_type_response.rb +20 -0
  51. data/lib/caliper/entities/response/true_false_response.rb +21 -0
  52. data/lib/caliper/entities/schemadotorg/software_application.rb +8 -8
  53. data/lib/caliper/entities/session.rb +25 -17
  54. data/lib/caliper/entities/software_application.rb +16 -7
  55. data/lib/caliper/entities/web_page.rb +2 -0
  56. data/lib/caliper/entity_envelope.rb +21 -0
  57. data/lib/caliper/event/annotation_event.rb +10 -6
  58. data/lib/caliper/event/assessment_event.rb +19 -0
  59. data/lib/caliper/event/assessment_item_event.rb +19 -0
  60. data/lib/caliper/event/assignable_event.rb +19 -0
  61. data/lib/caliper/event/event.rb +70 -50
  62. data/lib/caliper/event/jsonable.rb +55 -0
  63. data/lib/caliper/event/navigation_event.rb +2 -7
  64. data/lib/caliper/event/outcome_event.rb +1 -1
  65. data/lib/caliper/event/session_event.rb +13 -14
  66. data/lib/caliper/event/view_event.rb +6 -7
  67. data/lib/caliper/event_envelope.rb +22 -0
  68. data/lib/caliper/jsonable.rb +53 -0
  69. data/lib/caliper/profiles/annotation_profile.rb +56 -53
  70. data/lib/caliper/profiles/assessment_profile.rb +48 -0
  71. data/lib/caliper/profiles/assignable_profile.rb +44 -0
  72. data/lib/caliper/profiles/media_profile.rb +54 -0
  73. data/lib/caliper/profiles/profile.rb +38 -38
  74. data/lib/caliper/profiles/reading_profile.rb +31 -28
  75. data/lib/caliper/profiles/session_profile.rb +17 -18
  76. data/lib/caliper/request/event_store_requestor.rb +26 -26
  77. data/lib/caliper/sensor.rb +46 -35
  78. data/lib/caliper/version.rb +1 -1
  79. data/spec/lib/entities/entity.json +9 -0
  80. data/spec/lib/entities/entity_spec.rb +37 -0
  81. data/spec/lib/entities/lis/person_spec.rb +37 -0
  82. data/spec/lib/entities/lis/student.json +11 -0
  83. data/spec/lib/event/annotation_event_bookmark_spec.rb +159 -0
  84. data/spec/lib/event/annotation_event_highlight_spec.rb +160 -0
  85. data/spec/lib/event/annotation_event_shared_spec.rb +172 -0
  86. data/spec/lib/event/annotation_event_tag_spec.rb +159 -0
  87. data/spec/lib/event/assessment_event_spec.rb +207 -0
  88. data/spec/lib/event/assessment_item_completed_event_spec.rb +223 -0
  89. data/spec/lib/event/assessment_item_started_event_spec.rb +207 -0
  90. data/spec/lib/event/media_event_spec.rb +157 -0
  91. data/spec/lib/event/navigated_event_spec.rb +160 -0
  92. data/spec/lib/event/session_event_login_spec.rb +160 -0
  93. data/spec/lib/event/session_event_logout_spec.rb +145 -0
  94. data/spec/lib/event/session_event_timeout_spec.rb +145 -0
  95. data/spec/lib/event/viewed_event_spec.rb +149 -0
  96. data/spec/lib/event_helper.rb +145 -0
  97. data/spec/lib/sensor_spec.rb +30 -0
  98. data/spec/spec_helper.rb +3 -2
  99. metadata +84 -61
  100. data/lib/caliper/client.rb +0 -33
  101. data/lib/caliper/consumer/base.rb +0 -46
  102. data/lib/caliper/consumer/queue.rb +0 -40
  103. data/lib/caliper/consumer/socket.rb +0 -132
  104. data/lib/caliper/entities/annotation/text_position_selector.rb +0 -14
  105. data/lib/caliper/entities/schemadotorg/audio_object.rb +0 -15
  106. data/lib/caliper/entities/schemadotorg/image_object.rb +0 -15
  107. data/lib/caliper/entities/schemadotorg/media_object.rb +0 -19
  108. data/lib/caliper/entities/schemadotorg/video_object.rb +0 -15
  109. data/lib/caliper/event/.shared.rb.swp +0 -0
  110. data/spec/lib/client_spec.rb +0 -35
  111. data/spec/lib/consumer/base_spec.rb +0 -28
  112. data/spec/lib/consumer/queue_spec.rb +0 -16
  113. data/spec/lib/event/annotation_spec.rb +0 -12
  114. data/spec/lib/event/bookmarked_spec.rb +0 -17
  115. data/spec/lib/event/commented_spec.rb +0 -19
  116. data/spec/lib/event/highlighted_spec.rb +0 -18
  117. data/spec/lib/event/navigation_spec.rb +0 -15
  118. data/spec/lib/event/shared_spec.rb +0 -18
  119. data/spec/lib/event/tagged_spec.rb +0 -17
  120. data/spec/lib/event/used_spec.rb +0 -15
  121. data/spec/lib/event/viewed_spec.rb +0 -15
  122. data/test/caliper/events/session_login_event_test.rb +0 -58
  123. data/test/caliper/events/session_logout_event_test.rb +0 -55
  124. data/test/caliper/events/session_timeout_event_test.rb +0 -55
  125. data/test/caliper/request/http_requestor_test.rb +0 -59
  126. data/test/caliper/test_event.rb +0 -53
  127. data/test/caliper/test_utils.rb +0 -198
  128. data/test/fixtures/caliper_session_login_event.json +0 -71
  129. data/test/fixtures/caliper_session_logout_event.json +0 -52
  130. data/test/fixtures/caliper_session_timeout_event.json +0 -52
  131. 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
- module Profiles
9
- module AnnotationActions
10
- ATTACHED = "annotation.attached"
11
- BOOKMARKED = "annotation.bookmarked"
12
- CLASSIFIED = "annotation.classified"
13
- COMMENTED = "annotation.commented"
14
- DESCRIBED = "annotation.described"
15
- HIGHLIGHTED = "annotation.highlighted"
16
- IDENTIFIED = "annotation.identified"
17
- LIKED = "annotation.liked"
18
- LINKED = "annotation.linked"
19
- RANKED = "annotation.ranked"
20
- QUESTIONED = "annotation.questioned"
21
- RECOMMENDED = "annotation.recommended"
22
- REPLIED = "annotation.replied"
23
- SHARED = "annotation.shared"
24
- SUBSCRIBED = "annotation.subscribed"
25
- TAGGED = "annotation.tagged"
26
- end
27
- class ReadingProfile < Profile
28
- include AnnotationActions
29
- attr_accessor :key, # String
30
- :lookup # hash of ReadingActions
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
- # whether object if of type DigitalResource
33
- def validate_object (object)
34
- if (object.is_a? AnnotationType::BOOKMARK_ANNOTATION)
35
- ## TODO check required properties
36
- return object
37
- elsif (object.is_a? AnnotationType::HIGHLIGHT_ANNOTATION)
38
- ## TODO check required properties
39
- return object
40
- elsif (object.is_a? AnnotationType::SHARED_ANNOTATION)
41
- ## TODO check required properties
42
- return object
43
- elsif (object.is_a? AnnotationType::TAG_ANNOTATION)
44
- ## TODO check required properties
45
- return object
46
- else
47
- fail "Object must be of type Annotation"
48
- end
49
- end
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
- # whether target is of type Frame
52
- def validate_target(target)
53
- if (target is_a? Frame)
54
- return target
55
- else
56
- fail "Target must be of type Frame."
57
- end
58
- end
59
- end
60
- end
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
- 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
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
- 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
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
- class Profile
34
- include ProfileActions
33
+ class Profile
34
+ include ProfileActions
35
35
 
36
- def initialize()
37
- end
36
+ def initialize()
37
+ end
38
38
 
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
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
- module Profiles
8
- module ReadingActions
9
- SEARCHED = "reading.searched"
10
- VIEWED = "reading.viewed"
11
- end
12
- class ReadingProfile < Caliper::Profiles::Profile
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
- attr_accessor :key, # String
15
- :lookup # hash of ReadingActions
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
- # whether object if of type DigitalResource
18
- def validate_object(object)
19
- if (object.is_a? DigitalResource)
20
- return object
21
- else
22
- fail "Object must e of type DigitalResource"
23
- end
24
- end
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
- # whether target is of type Frame
27
- def validate_target(target)
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
- module Profiles
9
- module SessionActions
10
- LOGGED_IN = "session.loggedIn"
11
- LOGGED_OUT = "session.loggedOut"
12
- TIMEOUT = "session.timeOut"
13
- UNRECOGNIZED = "action.unrecognized"
14
- end
15
- class SessionProfile < Profile
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
- def initialize
19
- super
20
- end
17
+ def initialize
18
+ super
19
+ end
21
20
 
22
- # whether object if of type DigitalResource
23
- def validate_event (event)
21
+ # whether object if of type DigitalResource
22
+ def validate_event (event)
24
23
 
25
- end
24
+ end
26
25
 
27
- end
28
- end
29
- end
26
+ end
27
+ end
28
+ end