ims_caliper 0.1.3 → 0.9.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 (131) hide show
  1. checksums.yaml +5 -13
  2. data/.gitignore +3 -0
  3. data/LICENSE +156 -58
  4. data/NOTICE +42 -8
  5. data/README.md +2 -2
  6. data/lib/caliper/defaults.rb +21 -1
  7. data/lib/caliper/entities/agent/organization.rb +37 -0
  8. data/lib/caliper/entities/agent/person.rb +38 -0
  9. data/lib/caliper/entities/agent/software_application.rb +39 -0
  10. data/lib/caliper/entities/annotation/annotation.rb +21 -11
  11. data/lib/caliper/entities/annotation/bookmark_annotation.rb +19 -9
  12. data/lib/caliper/entities/annotation/highlight_annotation.rb +19 -8
  13. data/lib/caliper/entities/annotation/shared_annotation.rb +19 -9
  14. data/lib/caliper/entities/annotation/tag_annotation.rb +19 -9
  15. data/lib/caliper/entities/assessment/assessment.rb +19 -9
  16. data/lib/caliper/entities/assessment/assessment_item.rb +19 -8
  17. data/lib/caliper/entities/assignable/assignable_digital_resource.rb +19 -11
  18. data/lib/caliper/entities/assignable/attempt.rb +21 -8
  19. data/lib/caliper/entities/digital_resource.rb +29 -18
  20. data/lib/caliper/entities/entity.rb +27 -13
  21. data/lib/caliper/entities/foaf/agent.rb +22 -3
  22. data/lib/caliper/entities/generatable.rb +21 -2
  23. data/lib/caliper/entities/jsonable.rb +17 -5
  24. data/lib/caliper/entities/learning_context.rb +30 -9
  25. data/lib/caliper/entities/learning_objective.rb +19 -12
  26. data/lib/caliper/entities/lis/course_offering.rb +23 -13
  27. data/lib/caliper/entities/lis/course_section.rb +20 -13
  28. data/lib/caliper/entities/lis/group.rb +23 -13
  29. data/lib/caliper/entities/lis/membership.rb +22 -16
  30. data/lib/caliper/entities/lis/roles.rb +18 -6
  31. data/lib/caliper/entities/lis/status.rb +18 -6
  32. data/lib/caliper/entities/media/audio_object.rb +21 -7
  33. data/lib/caliper/entities/media/image_object.rb +21 -7
  34. data/lib/caliper/entities/media/media_location.rb +19 -4
  35. data/lib/caliper/entities/media/media_object.rb +19 -8
  36. data/lib/caliper/entities/media/video_object.rb +21 -7
  37. data/lib/caliper/entities/outcome/result.rb +23 -2
  38. data/lib/caliper/entities/reading/epub_chapter.rb +23 -7
  39. data/lib/caliper/entities/reading/epub_part.rb +24 -8
  40. data/lib/caliper/entities/reading/epub_sub_chapter.rb +22 -5
  41. data/lib/caliper/entities/reading/epub_volume.rb +20 -12
  42. data/lib/caliper/entities/reading/frame.rb +22 -6
  43. data/lib/caliper/entities/reading/web_page.rb +37 -0
  44. data/lib/caliper/entities/response/fillin_blank_response.rb +21 -3
  45. data/lib/caliper/entities/response/multiple_choice_response.rb +20 -3
  46. data/lib/caliper/entities/response/multiple_response_response.rb +20 -3
  47. data/lib/caliper/entities/response/response.rb +24 -3
  48. data/lib/caliper/entities/response/response_type.rb +20 -0
  49. data/lib/caliper/entities/response/select_type_response.rb +23 -5
  50. data/lib/caliper/entities/response/true_false_response.rb +20 -3
  51. data/lib/caliper/entities/schemadotorg/creative_work.rb +22 -2
  52. data/lib/caliper/entities/schemadotorg/software_application.rb +22 -2
  53. data/lib/caliper/entities/schemadotorg/thing.rb +19 -0
  54. data/lib/caliper/entities/schemadotorg/web_page.rb +22 -2
  55. data/lib/caliper/entities/session/session.rb +44 -0
  56. data/lib/caliper/entities/targetable.rb +19 -3
  57. data/lib/caliper/entities/w3c/membership.rb +32 -0
  58. data/lib/caliper/entities/w3c/organization.rb +30 -0
  59. data/lib/caliper/entity_envelope.rb +20 -7
  60. data/lib/caliper/event/annotation_event.rb +21 -6
  61. data/lib/caliper/event/assessment_event.rb +22 -2
  62. data/lib/caliper/event/assessment_item_event.rb +22 -2
  63. data/lib/caliper/event/assignable_event.rb +22 -2
  64. data/lib/caliper/event/event.rb +23 -1
  65. data/lib/caliper/event/jsonable.rb +18 -6
  66. data/lib/caliper/event/media_event.rb +22 -2
  67. data/lib/caliper/event/navigation_event.rb +22 -3
  68. data/lib/caliper/event/outcome_event.rb +22 -3
  69. data/lib/caliper/event/session_event.rb +21 -7
  70. data/lib/caliper/event/view_event.rb +22 -8
  71. data/lib/caliper/event_envelope.rb +20 -8
  72. data/lib/caliper/jsonable.rb +24 -7
  73. data/lib/caliper/options.rb +21 -2
  74. data/lib/caliper/profiles/annotation_profile.rb +21 -3
  75. data/lib/caliper/profiles/assessment_item_profile.rb +48 -0
  76. data/lib/caliper/profiles/assessment_profile.rb +22 -23
  77. data/lib/caliper/profiles/assignable_profile.rb +21 -4
  78. data/lib/caliper/profiles/media_profile.rb +20 -3
  79. data/lib/caliper/profiles/profile.rb +20 -24
  80. data/lib/caliper/profiles/reading_profile.rb +21 -4
  81. data/lib/caliper/profiles/session_profile.rb +20 -2
  82. data/lib/caliper/request/event_store_envelope.rb +20 -2
  83. data/lib/caliper/request/event_store_requestor.rb +21 -2
  84. data/lib/caliper/request/http_requestor.rb +28 -9
  85. data/lib/caliper/sensor.rb +21 -11
  86. data/lib/caliper/stats/atomic_wrapper.rb +21 -4
  87. data/lib/caliper/stats/statistic.rb +21 -1
  88. data/lib/caliper/stats/statistics.rb +20 -2
  89. data/lib/caliper/stats/statistics_map.rb +20 -0
  90. data/lib/caliper/validators/error_message.rb +20 -0
  91. data/lib/caliper/validators/event_validator.rb +20 -0
  92. data/lib/caliper/validators/event_validator_context.rb +21 -1
  93. data/lib/caliper/validators/property_type_check.rb +23 -4
  94. data/lib/caliper/validators/session_login_event_validator.rb +39 -21
  95. data/lib/caliper/validators/session_logout_event_validator.rb +31 -13
  96. data/lib/caliper/validators/time_check.rb +20 -0
  97. data/lib/caliper/version.rb +22 -3
  98. data/lib/caliper.rb +18 -1
  99. data/spec/lib/entities/{lis → agent}/person_spec.rb +26 -6
  100. data/spec/lib/entities/{lis → agent}/student.json +0 -0
  101. data/spec/lib/entities/entity_spec.rb +19 -4
  102. data/spec/lib/event/annotation_event_bookmark_spec.rb +23 -8
  103. data/spec/lib/event/annotation_event_highlight_spec.rb +23 -8
  104. data/spec/lib/event/annotation_event_shared_spec.rb +25 -10
  105. data/spec/lib/event/annotation_event_tag_spec.rb +23 -8
  106. data/spec/lib/event/assessment_event_spec.rb +22 -8
  107. data/spec/lib/event/assessment_item_completed_event_spec.rb +24 -10
  108. data/spec/lib/event/assessment_item_started_event_spec.rb +24 -10
  109. data/spec/lib/event/assignable_event_spec.rb +225 -0
  110. data/spec/lib/event/media_event_spec.rb +22 -7
  111. data/spec/lib/event/navigated_event_spec.rb +26 -11
  112. data/spec/lib/event/session_event_login_spec.rb +26 -12
  113. data/spec/lib/event/session_event_logout_spec.rb +25 -12
  114. data/spec/lib/event/session_event_timeout_spec.rb +25 -12
  115. data/spec/lib/event/viewed_event_spec.rb +23 -8
  116. data/spec/lib/event_helper.rb +25 -9
  117. data/spec/lib/sensor_spec.rb +43 -13
  118. data/spec/spec_helper.rb +18 -3
  119. metadata +19 -22
  120. data/.idea/caliper-ruby.iml +0 -156
  121. data/.idea/encodings.xml +0 -5
  122. data/.idea/misc.xml +0 -5
  123. data/.idea/modules.xml +0 -9
  124. data/.idea/scopes/scope_settings.xml +0 -5
  125. data/.idea/vcs.xml +0 -7
  126. data/lib/caliper/entities/lis/organization.rb +0 -25
  127. data/lib/caliper/entities/lis/person.rb +0 -25
  128. data/lib/caliper/entities/session.rb +0 -34
  129. data/lib/caliper/entities/software_application.rb +0 -28
  130. data/lib/caliper/entities/web_page.rb +0 -15
  131. data/spec/lib/request/http_request_spec.rb +0 -216
@@ -1,14 +1,33 @@
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/.
1
17
 
2
- require_relative '../entities/lis/person'
3
- require_relative '../entities/schemadotorg/software_application'
18
+ require_relative '../agent/person'
19
+ require_relative '../schemadotorg/software_application'
20
+
21
+ #
22
+ # Type check.
23
+ #
4
24
  module Caliper
5
25
  module Validators
6
26
  class PropertyTypeCheck
7
-
8
27
  # whether the object is of wanted target class
9
28
  def is_object_of_type(object, targetClass)
10
29
  return !object.nil? && object.is_a?(targetClass)
11
30
  end
12
31
  end
13
32
  end
14
- end
33
+ end
@@ -1,15 +1,33 @@
1
- require_relative 'event_validator'
2
- require_relative 'error_message'
3
- require_relative 'property_type_check'
4
- require_relative 'time_check'
5
- require_relative '../event/event'
6
- require_relative '../profiles/profile'
7
- require_relative '../entities/lis/person'
8
- require_relative '../entities/digital_resource'
9
- require_relative '../entities/session'
10
- require_relative '../entities/schemadotorg/software_application'
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/.
11
17
 
18
+ require_relative './event_validator'
19
+ require_relative './error_message'
20
+ require_relative './property_type_check'
21
+ require_relative './time_check'
22
+ require_relative '../event/event'
23
+ require_relative '../agent/person'
24
+ require_relative '../digital_resource'
25
+ require_relative '../session/session'
26
+ require_relative '../schemadotorg/software_application'
12
27
 
28
+ #
29
+ # Session Login validator
30
+ #
13
31
  module Caliper
14
32
  module Validators
15
33
  class SessionLoginEventValidator
@@ -43,52 +61,52 @@ module Caliper
43
61
  else
44
62
  # is event context of Session
45
63
  if (!event.context.equal?(EventType::SESSION))
46
- error_message.append_text(event.context + " " + ProfileConformance::CONTEXT_ERROR)
64
+ error_message.append_text(event.context + " " + Conformance::CONTEXT_ERROR)
47
65
  end
48
66
 
49
67
  # is event type of Session
50
68
  if (!event.type.equal?(EventType::SESSION))
51
- error_message.append_text(event.type + " " + ProfileConformance::TYPE_ERROR)
69
+ error_message.append_text(event.type + " " + Conformance::TYPE_ERROR)
52
70
  end
53
71
 
54
72
  # is event actor a Person
55
73
  if (!property_check.is_object_of_type(event.actor, Person.class))
56
- error_message.append_text(event.actor.class + " " + ProfileConformance::ACTOR_NOT_PERSON)
74
+ error_message.append_text(event.actor.class + " " + Conformance::ACTOR_NOT_PERSON)
57
75
  end
58
76
 
59
77
  # is event object a SoftwareApplication
60
78
  if (!property_check.is_object_of_type(event.object, SoftwareApplication.class))
61
- error_message.append_text(event.object.class + " " + ProfileConformance::OBJECT_NOT_SOFTWAREAPP)
79
+ error_message.append_text(event.object.class + " " + Conformance::OBJECT_NOT_SOFTWAREAPP)
62
80
  end
63
81
 
64
82
  # is event target a DigitalResource
65
83
  if (!property_check.is_object_of_type(event.target, DigitalResource.class))
66
- error_message.append_text(event.object.class + " " + ProfileConformance::TARGET_NOT_DIGITALRESOURCE)
84
+ error_message.append_text(event.object.class + " " + Conformance::TARGET_NOT_DIGITALRESOURCE)
67
85
  end
68
86
 
69
87
  if (property_check.is_object_of_type(event.generated, Session.class))
70
88
  if (event.generated.started_at_time == 0)
71
- error_message.append_text(context + " " + ProfileConformance::STARTEDATTIME_IS_NULL)
89
+ error_message.append_text(context + " " + Conformance::STARTEDATTIME_IS_NULL)
72
90
  elsif (event.generated.end_at_time != 0)
73
- error_message.append_text(context + " " + ProfileConformance::ENDEDATTIME_SET)
91
+ error_message.append_text(context + " " + Conformance::ENDEDATTIME_SET)
74
92
  end
75
93
  else
76
- error_message.append_text(ProfileConformance::GENERATED_NOT_SESSION)
94
+ error_message.append_text(Conformance::GENERATED_NOT_SESSION)
77
95
  end
78
96
 
79
97
  # start time set for event
80
98
  if (!check_started_at_time(event.started_at_time))
81
- error_message.append_text(ProfileConformance::STARTEDATTIME_IS_NULL)
99
+ error_message.append_text(Conformance::STARTEDATTIME_IS_NULL)
82
100
  end
83
101
 
84
102
  # also check the event end time
85
103
  if (!check_ended_at_time(event.started_at_time, event.ended_at_time))
86
- error_message.append_text(ProfileConformance::TIME_ERROR)
104
+ error_message.append_text(Conformance::TIME_ERROR)
87
105
  end
88
106
 
89
107
  # check duration value
90
108
  if (check_duration(event.duration))
91
- error_message.append_text(ProfileConformance::DURATION_INVALID)
109
+ error_message.append_text(Conformance::DURATION_INVALID)
92
110
  end
93
111
 
94
112
  if (error_message.length() > 0)
@@ -1,15 +1,33 @@
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
+
1
18
  require_relative 'event_validator'
2
19
  require_relative 'error_message'
3
20
  require_relative 'property_type_check'
4
21
  require_relative 'time_check'
5
22
  require_relative '../event/event'
6
- require_relative '../profiles/profile'
7
- require_relative '../entities/lis/person'
23
+ require_relative '../entities/agent/person'
8
24
  require_relative '../entities/digital_resource'
9
- require_relative '../entities/session'
25
+ require_relative '../entities/session/session'
10
26
  require_relative '../entities/schemadotorg/software_application'
11
27
 
12
-
28
+ #
29
+ # Session logout validator.
30
+ #
13
31
  module Caliper
14
32
  module Validators
15
33
  class SessionLogoutEventValidator
@@ -47,47 +65,47 @@ module Caliper
47
65
  else
48
66
  # is event context of Session
49
67
  if (!event.context.equal?(EventType::SESSION))
50
- error_message.append_text(event.context + " " + ProfileConformance::CONTEXT_ERROR)
68
+ error_message.append_text(event.context + " " + Conformance::CONTEXT_ERROR)
51
69
  end
52
70
 
53
71
  # is event type of Session
54
72
  if (!event.type.equal?(EventType::SESSION))
55
- error_message.append_text(event.type + " " + ProfileConformance::TYPE_ERROR)
73
+ error_message.append_text(event.type + " " + Conformance::TYPE_ERROR)
56
74
  end
57
75
 
58
76
  # is event actor a Person
59
77
  if (!property_check.is_object_of_type(event.actor, Person.class))
60
- error_message.append_text(event.actor.class + " " + ProfileConformance::ACTOR_NOT_PERSON)
78
+ error_message.append_text(event.actor.class + " " + Conformance::ACTOR_NOT_PERSON)
61
79
  end
62
80
 
63
81
  # is event object a SoftwareApplication
64
82
  if (!property_check.is_object_of_type(event.object, SoftwareApplication.class))
65
- error_message.append_text(event.object.class + " " + ProfileConformance::OBJECT_NOT_SOFTWAREAPP)
83
+ error_message.append_text(event.object.class + " " + Conformance::OBJECT_NOT_SOFTWAREAPP)
66
84
  end
67
85
 
68
86
  # is event target a DigitalResource
69
87
  if (!property_check.is_object_of_type(event.target, Session.class))
70
- error_message.append_text(event.object.class + " " + ProfileConformance::TARGET_NOT_SESSION)
88
+ error_message.append_text(event.object.class + " " + Conformance::TARGET_NOT_SESSION)
71
89
  end
72
90
 
73
91
  # should not be generated
74
92
  if (event.generated)
75
- message.appendText(Profile.Conformance.GENERATED_NOT_NULL.violation());
93
+ message.appendText(Conformance::GENERATED_NOT_NULL);
76
94
  end
77
95
 
78
96
  # start time set for event
79
97
  if (!check_started_at_time(event.started_at_time))
80
- error_message.append_text(ProfileConformance::STARTEDATTIME_IS_NULL)
98
+ error_message.append_text(Conformance::STARTEDATTIME_IS_NULL)
81
99
  end
82
100
 
83
101
  # also check the event end time
84
102
  if (!check_ended_at_time(event.started_at_time, event.ended_at_time))
85
- error_message.append_text(ProfileConformance::TIME_ERROR)
103
+ error_message.append_text(Conformance::TIME_ERROR)
86
104
  end
87
105
 
88
106
  # check duration value
89
107
  if (check_duration(event.duration))
90
- error_message.append_text(ProfileConformance::DURATION_INVALID)
108
+ error_message.append_text(Conformance::DURATION_INVALID)
91
109
  end
92
110
 
93
111
  if (error_message.length > 0)
@@ -1,3 +1,23 @@
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
+ #
1
21
  module Caliper
2
22
  module Validators
3
23
  module TimeCheck
@@ -1,4 +1,23 @@
1
- module Caliper
2
- VERSION = "0.1.3"
3
- end
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/.
4
17
 
18
+ #
19
+ # Version.
20
+ #
21
+ module Caliper
22
+ VERSION = "0.9.0"
23
+ end
data/lib/caliper.rb CHANGED
@@ -1,3 +1,20 @@
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
+
1
18
  module Caliper
2
19
  autoload :Client, "caliper/client"
3
20
 
@@ -14,4 +31,4 @@ module Caliper
14
31
  module Entities
15
32
  autoload :Base, "caliper/entity/base"
16
33
  end
17
- end
34
+ end
@@ -1,11 +1,32 @@
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
+
1
18
  # require 'spec_helper.rb'
2
19
  require 'require_all'
3
- require_all 'lib/caliper/entities/*.rb'
4
- require_all 'lib/caliper/entities/lis/*.rb'
20
+ require 'json_spec'
21
+ require_all 'lib/caliper/entities/agent/person.rb'
5
22
 
23
+ #
24
+ # Test Person.
25
+ #
6
26
  module Caliper
7
27
  module Entities
8
- module LIS
28
+ module Agent
29
+
9
30
  describe Person do
10
31
 
11
32
  it "should ensure that a Person is correctly created and serialized" do
@@ -19,7 +40,7 @@ module Caliper
19
40
  # puts "new student = #{student.to_json}"
20
41
 
21
42
  # Compare JSON ouput
22
- file = File.read('spec/lib/entities/lis/student.json')
43
+ file = File.read('spec/lib/entities/agent/student.json')
23
44
  data_hash = JSON.parse(file)
24
45
  expected_json = data_hash.to_json # convert hash back to JSON string after parse
25
46
  student.to_json.should be_json_eql(expected_json)
@@ -30,8 +51,7 @@ module Caliper
30
51
 
31
52
  expect(student).to eql(des_student)
32
53
  end
33
-
34
54
  end
35
55
  end
36
56
  end
37
- end
57
+ end
File without changes
@@ -1,3 +1,20 @@
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
+
1
18
  # require 'spec_helper.rb'
2
19
  require 'require_all'
3
20
  require 'json_spec'
@@ -10,9 +27,9 @@ module Caliper
10
27
 
11
28
  it "should ensure that a base entity is correctly created and serialized" do
12
29
  entity = Entity.new
30
+ entity.id = 'https://some-university.edu/politicalScience/2014/american-revolution-101/assessment1'
13
31
  entity.name = 'test'
14
32
  entity.description = 'description'
15
- entity.id = 'https://some-university.edu/politicalScience/2014/american-revolution-101/assessment1'
16
33
  entity.extensions = {'customProp' => 42}
17
34
  entity.dateCreated = '2015-03-15T23:09:11.000Z'
18
35
  entity.dateModified = '2015-03-15T23:09:11.000Z'
@@ -29,9 +46,7 @@ module Caliper
29
46
  des_entity.from_json data_hash
30
47
  # puts "Object from JSON = #{des_entity.to_json}"
31
48
  expect(entity).to eql(des_entity)
32
-
33
49
  end
34
-
35
50
  end
36
51
  end
37
- end
52
+ end
@@ -1,7 +1,24 @@
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
+
1
18
  require 'require_all'
2
19
  require_all 'lib/caliper/entities/entity.rb'
3
- require_all 'lib/caliper/entities/software_application.rb'
4
- require_all 'lib/caliper/entities/lis/person.rb'
20
+ require_all 'lib/caliper/entities/agent/software_application.rb'
21
+ require_all 'lib/caliper/entities/agent/person.rb'
5
22
  require_all 'lib/caliper/entities/lis/membership.rb'
6
23
  require_all 'lib/caliper/entities/lis/roles.rb'
7
24
  require_all 'lib/caliper/entities/lis/status.rb'
@@ -19,10 +36,10 @@ module Caliper
19
36
 
20
37
  describe AnnotationEvent do
21
38
 
22
- it 'should ensure that a AnnotationEvent (Bookmarked) is correctly created and serialized' do
39
+ it 'should ensure that a Bookmarked AnnotationEvent is correctly created and serialized' do
23
40
 
24
41
  # The Actor (Person/Student))
25
- student = Caliper::Entities::LIS::Person.new
42
+ student = Caliper::Entities::Agent::Person.new
26
43
  student.id = 'https://some-university.edu/user/554433'
27
44
  membership1 = Caliper::Entities::LIS::Membership.new
28
45
  membership1.id = "https://some-university.edu/membership/001"
@@ -84,7 +101,7 @@ module Caliper
84
101
  bookmark.bookmarkNotes = 'The Intolerable Acts (1774)--bad idea Lord North'
85
102
 
86
103
  # The course that is part of the Learning Context (edApp)
87
- edApp = Caliper::Entities::SoftwareApplication.new
104
+ edApp = Caliper::Entities::Agent::SoftwareApplication.new
88
105
  edApp.id = 'https://github.com/readium/readium-js-viewer'
89
106
  edApp.name = 'Readium'
90
107
  edApp.hasMembership = []
@@ -151,9 +168,7 @@ module Caliper
151
168
 
152
169
  # Ensure that the deserialized bookmark event object conforms
153
170
  expect(annotation_event).to eql(deser_annotation_event)
154
-
155
171
  end
156
-
157
172
  end
158
173
  end
159
- end
174
+ end
@@ -1,7 +1,24 @@
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
+
1
18
  require 'require_all'
2
19
  require_all 'lib/caliper/entities/entity.rb'
3
- require_all 'lib/caliper/entities/software_application.rb'
4
- require_all 'lib/caliper/entities/lis/person.rb'
20
+ require_all 'lib/caliper/entities/agent/software_application.rb'
21
+ require_all 'lib/caliper/entities/agent/person.rb'
5
22
  require_all 'lib/caliper/entities/lis/membership.rb'
6
23
  require_all 'lib/caliper/entities/lis/roles.rb'
7
24
  require_all 'lib/caliper/entities/lis/status.rb'
@@ -19,10 +36,10 @@ module Caliper
19
36
 
20
37
  describe AnnotationEvent do
21
38
 
22
- it 'should ensure that a AnnotationEvent (Highlight) is correctly created and serialized' do
39
+ it 'should ensure that a Highlighted AnnotationEvent is correctly created and serialized' do
23
40
 
24
41
  # The Actor (Person/Student))
25
- student = Caliper::Entities::LIS::Person.new
42
+ student = Caliper::Entities::Agent::Person.new
26
43
  student.id = 'https://some-university.edu/user/554433'
27
44
  membership1 = Caliper::Entities::LIS::Membership.new
28
45
  membership1.id = "https://some-university.edu/membership/001"
@@ -85,7 +102,7 @@ module Caliper
85
102
  highlight.selection = { 'start' => '455', 'end' => '489'}
86
103
 
87
104
  # The course that is part of the Learning Context (edApp)
88
- edApp = Caliper::Entities::SoftwareApplication.new
105
+ edApp = Caliper::Entities::Agent::SoftwareApplication.new
89
106
  edApp.id = 'https://github.com/readium/readium-js-viewer'
90
107
  edApp.name = 'Readium'
91
108
  edApp.hasMembership = []
@@ -152,9 +169,7 @@ module Caliper
152
169
 
153
170
  # Ensure that the deserialized highlight event object conforms
154
171
  expect(annotation_event).to eql(deser_annotation_event)
155
-
156
172
  end
157
-
158
173
  end
159
174
  end
160
- end
175
+ end
@@ -1,7 +1,24 @@
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
+
1
18
  require 'require_all'
2
19
  require_all 'lib/caliper/entities/entity.rb'
3
- require_all 'lib/caliper/entities/software_application.rb'
4
- require_all 'lib/caliper/entities/lis/person.rb'
20
+ require_all 'lib/caliper/entities/agent/software_application.rb'
21
+ require_all 'lib/caliper/entities/agent/person.rb'
5
22
  require_all 'lib/caliper/entities/lis/membership.rb'
6
23
  require_all 'lib/caliper/entities/lis/roles.rb'
7
24
  require_all 'lib/caliper/entities/lis/status.rb'
@@ -19,10 +36,10 @@ module Caliper
19
36
 
20
37
  describe AnnotationEvent do
21
38
 
22
- it 'should ensure that a AnnotationEvent (Shared) is correctly created and serialized' do
39
+ it 'should ensure that a Shared AnnotationEvent is correctly created and serialized' do
23
40
 
24
41
  # The Actor (Person/Student))
25
- student = Caliper::Entities::LIS::Person.new
42
+ student = Caliper::Entities::Agent::Person.new
26
43
  student.id = 'https://some-university.edu/user/554433'
27
44
  membership1 = Caliper::Entities::LIS::Membership.new
28
45
  membership1.id = "https://some-university.edu/membership/001"
@@ -82,13 +99,13 @@ module Caliper
82
99
  shared.dateModified = '2015-09-02T11:30:00.000Z'
83
100
  shared.annotated = 'https://github.com/readium/readium-js-viewer/book/34843#epubcfi(/4/3/3)'
84
101
 
85
- classmate1 = Caliper::Entities::LIS::Person.new
102
+ classmate1 = Caliper::Entities::Agent::Person.new
86
103
  classmate1.id = 'https://some-university.edu/students/657585'
87
104
  classmate1.hasMembership = []
88
105
  classmate1.dateCreated = '2015-08-01T06:00:00.000Z'
89
106
  classmate1.dateModified = '2015-09-02T11:30:00.000Z'
90
107
 
91
- classmate2 = Caliper::Entities::LIS::Person.new
108
+ classmate2 = Caliper::Entities::Agent::Person.new
92
109
  classmate2.id = 'https://some-university.edu/students/667788'
93
110
  classmate2.hasMembership = []
94
111
  classmate2.dateCreated = '2015-08-01T06:00:00.000Z'
@@ -97,7 +114,7 @@ module Caliper
97
114
  shared.withAgents = [classmate1, classmate2]
98
115
 
99
116
  # The course that is part of the Learning Context (edApp)
100
- edApp = Caliper::Entities::SoftwareApplication.new
117
+ edApp = Caliper::Entities::Agent::SoftwareApplication.new
101
118
  edApp.id = 'https://github.com/readium/readium-js-viewer'
102
119
  edApp.name = 'Readium'
103
120
  edApp.hasMembership = []
@@ -164,9 +181,7 @@ module Caliper
164
181
 
165
182
  # Ensure that the deserialized shared event object conforms
166
183
  expect(annotation_event).to eql(deser_annotation_event)
167
-
168
184
  end
169
-
170
185
  end
171
186
  end
172
- end
187
+ end