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.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -5
  3. data/lib/caliper/{profiles/annotation_profile.rb → actions/annotation_actions.rb} +3 -41
  4. data/lib/caliper/{profiles/assessment_profile.rb → actions/assessment_actions.rb} +3 -19
  5. data/lib/caliper/actions/assessment_item_actions.rb +31 -0
  6. data/lib/caliper/{profiles/assignable_profile.rb → actions/assignable_actions.rb} +3 -28
  7. data/lib/caliper/{profiles/media_profile.rb → actions/media_actions.rb} +4 -29
  8. data/lib/caliper/{event/view_event.rb → actions/navigation_actions.rb} +5 -11
  9. data/lib/caliper/{validators/event_validator_context.rb → actions/outcome_actions.rb} +7 -15
  10. data/lib/caliper/{event/navigation_event.rb → actions/reading_actions.rb} +6 -14
  11. data/lib/caliper/actions/session_actions.rb +30 -0
  12. data/lib/caliper/context/context.rb +31 -0
  13. data/lib/caliper/entities/agent/organization.rb +4 -3
  14. data/lib/caliper/entities/agent/person.rb +4 -3
  15. data/lib/caliper/entities/agent/software_application.rb +4 -3
  16. data/lib/caliper/entities/annotation/annotation.rb +4 -12
  17. data/lib/caliper/entities/annotation/annotation_type.rb +32 -0
  18. data/lib/caliper/entities/annotation/bookmark_annotation.rb +3 -1
  19. data/lib/caliper/entities/annotation/highlight_annotation.rb +4 -4
  20. data/lib/caliper/entities/annotation/shared_annotation.rb +3 -1
  21. data/lib/caliper/entities/annotation/tag_annotation.rb +3 -1
  22. data/lib/caliper/entities/assessment/assessment.rb +1 -1
  23. data/lib/caliper/entities/assessment/assessment_item.rb +2 -0
  24. data/lib/caliper/entities/assignable/assignable_digital_resource.rb +3 -13
  25. data/lib/caliper/{event/session_event.rb → entities/assignable/assignable_digital_resource_type.rb} +7 -11
  26. data/lib/caliper/entities/assignable/attempt.rb +8 -9
  27. data/lib/caliper/entities/digital_resource.rb +5 -22
  28. data/lib/caliper/entities/digital_resource_type.rb +33 -0
  29. data/lib/caliper/entities/entity.rb +7 -37
  30. data/lib/caliper/entities/{learning_context.rb → entity_base.rb} +19 -15
  31. data/lib/caliper/entities/entity_type.rb +39 -0
  32. data/lib/caliper/entities/foaf/agent.rb +0 -2
  33. data/lib/caliper/entities/jsonable.rb +14 -3
  34. data/lib/caliper/entities/learning_objective.rb +4 -3
  35. data/lib/caliper/entities/lis/course_offering.rb +9 -6
  36. data/lib/caliper/entities/lis/course_section.rb +3 -1
  37. data/lib/caliper/entities/lis/group.rb +5 -3
  38. data/lib/caliper/entities/lis/membership.rb +5 -7
  39. data/lib/caliper/entities/media/audio_object.rb +2 -1
  40. data/lib/caliper/entities/media/image_object.rb +2 -1
  41. data/lib/caliper/entities/media/media_location.rb +2 -1
  42. data/lib/caliper/entities/media/media_object.rb +2 -9
  43. data/lib/caliper/entities/media/media_object_type.rb +31 -0
  44. data/lib/caliper/entities/media/video_object.rb +2 -1
  45. data/lib/caliper/entities/outcome/result.rb +23 -16
  46. data/lib/caliper/entities/reading/epub_chapter.rb +2 -1
  47. data/lib/caliper/entities/reading/epub_part.rb +2 -1
  48. data/lib/caliper/entities/reading/epub_sub_chapter.rb +2 -1
  49. data/lib/caliper/entities/reading/epub_volume.rb +2 -1
  50. data/lib/caliper/entities/reading/frame.rb +4 -3
  51. data/lib/caliper/entities/reading/web_page.rb +3 -2
  52. data/lib/caliper/entities/response/fillin_blank_response.rb +3 -3
  53. data/lib/caliper/entities/response/multiple_choice_response.rb +3 -3
  54. data/lib/caliper/entities/response/multiple_response_response.rb +3 -3
  55. data/lib/caliper/entities/response/response.rb +8 -10
  56. data/lib/caliper/entities/response/response_type.rb +5 -5
  57. data/lib/caliper/entities/response/select_type_response.rb +3 -3
  58. data/lib/caliper/entities/response/true_false_response.rb +2 -3
  59. data/lib/caliper/entities/session/session.rb +8 -7
  60. data/lib/caliper/{event → events}/annotation_event.rb +11 -3
  61. data/lib/caliper/{event → events}/assessment_event.rb +11 -8
  62. data/lib/caliper/{event → events}/assessment_item_event.rb +11 -8
  63. data/lib/caliper/{event → events}/assignable_event.rb +11 -8
  64. data/lib/caliper/{profiles/profile.rb → events/event.rb} +15 -15
  65. data/lib/caliper/events/event_context.rb +24 -0
  66. data/lib/caliper/events/event_type.rb +33 -0
  67. data/lib/caliper/{event → events}/jsonable.rb +2 -2
  68. data/lib/caliper/{event → events}/media_event.rb +11 -8
  69. data/lib/caliper/events/navigation_event.rb +47 -0
  70. data/lib/caliper/events/outcome_event.rb +44 -0
  71. data/lib/caliper/{event/outcome_event.rb → events/reading_event.rb} +13 -10
  72. data/lib/caliper/events/session_event.rb +42 -0
  73. data/lib/caliper/events/view_event.rb +44 -0
  74. data/lib/caliper/request/envelope.rb +4 -15
  75. data/lib/caliper/request/event_store_requestor.rb +1 -1
  76. data/lib/caliper/request/{envelope_jsonable.rb → jsonable.rb} +9 -11
  77. data/lib/caliper/sensor.rb +1 -1
  78. data/lib/caliper/version.rb +1 -1
  79. data/lib/caliper.rb +1 -1
  80. data/spec/lib/entities/agent/{student.json → person.json} +4 -3
  81. data/spec/lib/entities/agent/person_spec.rb +5 -6
  82. data/spec/lib/entities/assessment/assessment.json +23 -0
  83. data/spec/lib/entities/assessment/assessment_spec.rb +54 -0
  84. data/spec/lib/event_helper.rb +33 -41
  85. data/spec/lib/{event/annotation_event_bookmark_spec.rb → events/annotation_bookmarked_event_spec.rb} +36 -46
  86. data/spec/lib/{event/annotation_event_highlight_spec.rb → events/annotation_highlighted_event_spec.rb} +36 -46
  87. data/spec/lib/{event/annotation_event_shared_spec.rb → events/annotation_shared_event_spec.rb} +42 -52
  88. data/spec/lib/{event/annotation_event_tag_spec.rb → events/annotation_tagged_event_spec.rb} +36 -46
  89. data/spec/lib/{event → events}/assessment_item_completed_event_spec.rb +41 -65
  90. data/spec/lib/{event → events}/assessment_item_started_event_spec.rb +38 -56
  91. data/spec/lib/{event/assessment_event_spec.rb → events/assessment_started_event_spec.rb} +36 -51
  92. data/spec/lib/{event/assignable_event_spec.rb → events/assignable_activated_event_spec.rb} +37 -52
  93. data/spec/lib/{event/media_event_spec.rb → events/media_paused_video_event_spec.rb} +33 -43
  94. data/spec/lib/{event/navigated_event_spec.rb → events/navigation_navigated_to_event_spec.rb} +36 -45
  95. data/spec/lib/events/outcome_graded_event_spec.rb +163 -0
  96. data/spec/lib/{event/session_event_login_spec.rb → events/session_logged_in_event_spec.rb} +38 -46
  97. data/spec/lib/{event/session_event_logout_spec.rb → events/session_logged_out-event_spec.rb} +28 -37
  98. data/spec/lib/{event/session_event_timeout_spec.rb → events/session_timed_out_event_spec.rb} +24 -34
  99. data/spec/lib/{event/viewed_event_spec.rb → events/view_viewed_event_spec.rb} +33 -41
  100. data/spec/lib/request/{http_requestor_spec.rb → http_requestor_single_event_spec.rb} +46 -47
  101. data/spec/lib/request/http_requestor_single_minimal_event_spec.rb +84 -0
  102. data/spec/lib/sensor_spec.rb +1 -1
  103. metadata +77 -70
  104. data/lib/caliper/event/event.rb +0 -114
  105. data/lib/caliper/profiles/assessment_item_profile.rb +0 -48
  106. data/lib/caliper/profiles/reading_profile.rb +0 -56
  107. data/lib/caliper/profiles/session_profile.rb +0 -46
  108. data/lib/caliper/validators/error_message.rb +0 -63
  109. data/lib/caliper/validators/event_validator.rb +0 -57
  110. data/lib/caliper/validators/property_type_check.rb +0 -33
  111. data/lib/caliper/validators/session_login_event_validator.rb +0 -121
  112. data/lib/caliper/validators/session_logout_event_validator.rb +0 -120
  113. data/lib/caliper/validators/time_check.rb +0 -50
  114. data/spec/lib/entities/entity.json +0 -9
  115. data/spec/lib/entities/entity_spec.rb +0 -52
@@ -1,50 +0,0 @@
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
- #
19
- # Time check.
20
- #
21
- module Caliper
22
- module Validators
23
- module TimeCheck
24
-
25
- # validate startedAtTime
26
- def check_started_at_time(started_at_time)
27
- return started_at_time > 0
28
- end
29
-
30
- # Event ended_at_time is an optional setting.
31
- # If both a started_at_time and ended_at_aime are specified
32
- # check that startedAtTime precedes endedAtTime. If not return false.
33
- def check_ended_at_time(started_at_time, ended_at_time)
34
- if (check_started_at_time(started_at_time))
35
- return ended_at_time >= started_at_time
36
- else
37
- return true
38
- end
39
- end
40
-
41
- def check_duration(duration)
42
- if (!duration.nil? && !duration.length == 0)
43
- return true
44
- else
45
- return false
46
- end
47
- end
48
- end
49
- end
50
- end
@@ -1,9 +0,0 @@
1
- {
2
- "@id": "https://some-university.edu/politicalScience/2014/american-revolution-101/assessment1",
3
- "@type": "http://purl.imsglobal.org/caliper/v1/Entity",
4
- "name": "test",
5
- "description": "description",
6
- "extensions": {"customProp":42},
7
- "dateCreated": "2015-03-15T23:09:11.000Z",
8
- "dateModified": "2015-03-15T23:09:11.000Z"
9
- }
@@ -1,52 +0,0 @@
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/entity.rb'
22
-
23
- module Caliper
24
- module Entities
25
-
26
- describe Entity do
27
-
28
- it "should ensure that a base entity is correctly created and serialized" do
29
- entity = Entity.new
30
- entity.id = 'https://some-university.edu/politicalScience/2014/american-revolution-101/assessment1'
31
- entity.name = 'test'
32
- entity.description = 'description'
33
- entity.extensions = {'customProp' => 42}
34
- entity.dateCreated = '2015-03-15T23:09:11.000Z'
35
- entity.dateModified = '2015-03-15T23:09:11.000Z'
36
- # puts "Entity JSON = #{entity.to_json}"
37
-
38
- # Compare JSON ouput
39
- file = File.read('spec/lib/entities/entity.json')
40
- data_hash = JSON.parse(file)
41
- expected_json = data_hash.to_json # convert hash back to JSON string after parse
42
- expect(entity.to_json).to be_json_eql(expected_json)#.excluding("@class")
43
-
44
- # Compare Deserialized JSON to desired Entity
45
- des_entity = Entity.new
46
- des_entity.from_json data_hash
47
- # puts "Object from JSON = #{des_entity.to_json}"
48
- expect(entity).to eql(des_entity)
49
- end
50
- end
51
- end
52
- end