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
@@ -0,0 +1,23 @@
1
+ require_relative '../../entities/digital_resource'
2
+
3
+ #
4
+ # A time based location within a media object
5
+ #
6
+ module Caliper
7
+ module Entities
8
+ module Media
9
+
10
+ class MediaLocation < DigitalResource
11
+
12
+ attr_accessor :currentTime
13
+
14
+ def initialize
15
+ super
16
+ @type = DigitalResourceType::MEDIA_LOCATION
17
+ @currentTime = nil
18
+ end
19
+
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,38 @@
1
+ require_relative '../../entities/digital_resource'
2
+ require_relative '../../entities/schemadotorg/thing'
3
+
4
+ # An image, video, or audio object embedded in a web page. Note that a
5
+ # creative work may have many media objects associated with it on the
6
+ # same web page. For example, a page about a single song (MusicRecording)
7
+ # may have a music video (VideoObject), and a high and low bandwidth audio
8
+ # stream (2 AudioObject's).
9
+ #
10
+ # From https://schema.org/MediaObject
11
+
12
+ module Caliper
13
+ module Entities
14
+ module Media
15
+
16
+ module MediaType
17
+ AUDIO_OBJECT = 'http://purl.imsglobal.org/caliper/v1/AudioObject'
18
+ IMAGE_OBJECT = 'http://purl.imsglobal.org/caliper/v1/ImageObject'
19
+ VIDEO_OBJECT = 'http://purl.imsglobal.org/caliper/v1/VideoObject'
20
+ MEDIA_LOCATION = 'http://purl.imsglobal.org/caliper/v1/MediaLocation'
21
+ end
22
+
23
+ ## implement the interface Thing
24
+ class MediaObject < DigitalResource
25
+ include Caliper::Entities::SchemaDotOrg::Thing
26
+
27
+ attr_accessor :duration
28
+
29
+ def initialize
30
+ super
31
+ @type = DigitalResourceType::MEDIA_OBJECT
32
+ @duration = nil
33
+ end
34
+
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,21 @@
1
+ require_relative 'media_object'
2
+
3
+ # https://schema.org/VideoObject
4
+ #
5
+ # A video object embedded in a web page..
6
+
7
+ module Caliper
8
+ module Entities
9
+ module Media
10
+
11
+ class VideoObject < MediaObject
12
+
13
+ def initialize
14
+ super
15
+ @type = MediaType::VIDEO_OBJECT
16
+ end
17
+
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,19 +1,27 @@
1
- # Public: Representation of an EPUB 3 Volume
2
- # A component of a collection
3
- # http://www.idpf.org/epub/vocab/structure/#volume
4
-
5
1
  require_relative '../digital_resource'
6
- require_relative '../entity'
2
+ require_relative '../../entities/jsonable'
7
3
 
4
+ #
5
+ #
6
+ # @copyright @copyright ©2013 IMS Global Learning Consortium, Inc. All Rights Reserved.
7
+ # @license For license information contact, info@imsglobal.org
8
+ #
9
+ # Public: Representation of an EPUB 3 Volume
10
+ # A component of a collection
11
+ # http://www.idpf.org/epub/vocab/structure/#volume
12
+ #
8
13
  module Caliper
9
14
  module Entities
10
15
  module Reading
11
- class EpubVolume < Caliper::Entities::DigitalResource
16
+
17
+ class EPubVolume < Caliper::Entities::DigitalResource
18
+ include Caliper::Entities::Jsonable
19
+
12
20
  def initialize()
13
21
  super
14
- @id = ""
15
22
  @type = DigitalResourceType::EPUB_VOLUME
16
23
  end
24
+
17
25
  end
18
26
  end
19
27
  end
@@ -1,29 +1,21 @@
1
- require_relative '../digital_resource'
2
- require_relative '../targetable'
1
+ require_relative '../../entities/digital_resource'
2
+ require_relative '../../entities/targetable'
3
+ require_relative '../../entities/jsonable'
3
4
 
4
5
  module Caliper
5
6
  module Entities
6
7
  module Reading
8
+
7
9
  class Frame < DigitalResource
8
10
  include Targetable
11
+ include Caliper::Entities::Jsonable
9
12
 
10
- attr_accessor :id,
11
- :type,
12
- :name,
13
- :description,
14
- :object_type,
15
- :aligned_learning_objective,
16
- :keywords,
17
- :is_part_of,
18
- :properties,
19
- :date_created,
20
- :date_modified,
21
- :date_published,
22
- :index
13
+ attr_accessor :index
23
14
 
24
15
  def initialize
25
16
  super
26
17
  @type = DigitalResourceType::FRAME
18
+ @index = 0
27
19
  end
28
20
 
29
21
  end
@@ -0,0 +1,20 @@
1
+ require "require_all"
2
+ require_all 'lib/caliper/entities/response/response_type.rb'
3
+ #
4
+ # Represents response text or integer/decimal/scientific numbers that completes a question
5
+ # designed with one or more "fill in the blank" option prompts.
6
+
7
+ module Caliper
8
+ module Entities
9
+ module Response
10
+ class FillinBlankResponse < Response
11
+ attr_accessor :type,
12
+ :values
13
+
14
+ def initialize
15
+ @type = ResponseType::FILLINBLANK
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require "require_all"
2
+ require_all 'lib/caliper/entities/response/response_type.rb'
3
+ #
4
+ # Represents a response to a multiple choice question that permits a single option to be selected
5
+ #
6
+
7
+ module Caliper
8
+ module Entities
9
+ module Response
10
+ class MultipleChoiceResponse < Response
11
+ attr_accessor :type,
12
+ :values
13
+
14
+ def initialize
15
+ @type = ResponseType::MULTIPLECHOICE
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require "require_all"
2
+ require_all 'lib/caliper/entities/response/response_type.rb'
3
+ #
4
+ # Representation of a response to a multiple choice question that permits one or more options to be selected.
5
+ #
6
+
7
+ module Caliper
8
+ module Entities
9
+ module Response
10
+ class MultipleResponseResponse < Response
11
+ attr_accessor :type,
12
+ :values
13
+
14
+ def initialize
15
+ @type = ResponseType::MULTIPLERESPONSE
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,23 @@
1
+ require "require_all"
2
+ require_all 'lib/caliper/entities/generatable.rb'
3
+
4
+ module Caliper
5
+ module Entities
6
+ module Response
7
+ class Response < Entity
8
+ include Generatable
9
+ attr_accessor :type,
10
+ :assignable,
11
+ :actor,
12
+ :attempt,
13
+ :startedAtTime,
14
+ :endedAtTime,
15
+ :duration
16
+
17
+ def initialize
18
+ @type = EntityType::RESPONSE
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,13 @@
1
+ module Caliper
2
+ module Entities
3
+ module Response
4
+ module ResponseType
5
+ FILLINBLANK = "http://purl.imsglobal.org/caliper/v1/Response/FillinBlank"
6
+ MULTIPLECHOICE = "http://purl.imsglobal.org/caliper/v1/Response/MultipleChoice"
7
+ MULTIPLERESPONSE = "http://purl.imsglobal.org/caliper/v1/Response/MultipleResponse"
8
+ SELECTTEXT = "http://purl.imsglobal.org/caliper/v1/Response/SelectText"
9
+ TRUEFALSE = "http://purl.imsglobal.org/caliper/v1/Response/TrueFalse"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,20 @@
1
+ require "require_all"
2
+ require_all 'lib/caliper/entities/response/response_type.rb'
3
+ #
4
+ # Represents a response that identifies text from a presented paragraph or list.
5
+ # The response is the identified string or a mapping to a logical identifier;
6
+
7
+ module Caliper
8
+ module Entities
9
+ module Response
10
+ class SelectTextResponse < Response
11
+ attr_accessor :type,
12
+ :values
13
+
14
+ def initialize
15
+ @type = ResponseType::SELECTTEXT
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,21 @@
1
+ require "require_all"
2
+ require_all 'lib/caliper/entities/response/response_type.rb'
3
+ #
4
+ # Represents response to a multiple choice question that limits options to either 'true or false',
5
+ # 'agree or disagree', etc.
6
+ #
7
+
8
+ module Caliper
9
+ module Entities
10
+ module Response
11
+ class TrueFalseResponse < Response
12
+ attr_accessor :type,
13
+ :values
14
+
15
+ def initialize
16
+ @type = ResponseType::TRUEFALSE
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,11 +1,11 @@
1
1
  require_relative 'creative_work'
2
2
 
3
3
  module Caliper
4
- module Entities
5
- module SchemaDotOrg
6
- module SoftwareApplication
7
- include CreativeWork
8
- end
9
- end
10
- end
11
- end
4
+ module Entities
5
+ module SchemaDotOrg
6
+ module SoftwareApplication
7
+ include CreativeWork
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,26 +1,34 @@
1
-
2
1
  require_relative 'entity'
3
2
  require_relative 'generatable'
4
3
  require_relative 'targetable'
4
+ require_relative './jsonable'
5
5
 
6
-
6
+ #
7
+ #
8
+ # @copyright @copyright ©2013 IMS Global Learning Consortium, Inc. All Rights Reserved.
9
+ # @license For license information contact, info@imsglobal.org
10
+ #
11
+ #
12
+ # Session Entity
13
+ #
7
14
  module Caliper
8
- module Entities
9
- class Session < Entity
10
- include Generatable
11
- include Targetable
15
+ module Entities
16
+
17
+ class Session < Entity
18
+ include Generatable
19
+ include Targetable
20
+ include Caliper::Entities::Jsonable
12
21
 
13
- attr_accessor :type, # String
14
- :actor, # Agent
15
- :started_at_time,
16
- :ended_at_time,
17
- :duration # String
22
+ attr_accessor :actor,
23
+ :startedAtTime,
24
+ :endedAtTime,
25
+ :duration
18
26
 
19
- def initialize
20
- super
21
- @type = EntityType::SESSION
22
- end
27
+ def initialize
28
+ super
29
+ @type = EntityType::SESSION
30
+ end
23
31
 
24
- end
25
- end
32
+ end
33
+ end
26
34
  end
@@ -2,18 +2,27 @@ require "json"
2
2
  require_relative '../entities/entity'
3
3
  require_relative '../entities/foaf/agent'
4
4
  require_relative '../entities/schemadotorg/software_application'
5
+ require_relative '../entities/lis/organization'
5
6
 
7
+ #
8
+ #
9
+ # @copyright @copyright ©2013 IMS Global Learning Consortium, Inc. All Rights Reserved.
10
+ # @license For license information contact, info@imsglobal.org
11
+ #
12
+ #
13
+ # Software Application (from schema.org)
14
+ #
6
15
  module Caliper
7
16
  module Entities
8
- class SoftwareApplication < Entity
9
- include Caliper::Entities::FOAF::Agent
10
- include Caliper::Entities::SchemaDotOrg::SoftwareApplication
17
+ class SoftwareApplication < Caliper::Entities::LIS::Organization
18
+ include Caliper::Entities::FOAF::Agent
19
+ include Caliper::Entities::SchemaDotOrg::SoftwareApplication
11
20
 
12
- attr_accessor :type
21
+ def initialize()
22
+ super
23
+ @type=EntityType::SOFTWARE_APPLICATION
24
+ end
13
25
 
14
- def initialize()
15
- @type=EntityType::SOFTWARE_APPLICATION
16
- end
17
26
  end
18
27
  end
19
28
  end
@@ -2,8 +2,10 @@ require_relative "../entities/digital_resource"
2
2
  require_relative "../entities/schemadotorg/web_page"
3
3
  module Caliper
4
4
  module Entities
5
+
5
6
  class WebPage < DigitalResource
6
7
  include Caliper::Entities::SchemaDotOrg::WebPage
8
+
7
9
  def initialize()
8
10
  super
9
11
  @type = Caliper::Entities::DigitalResourceType::WEB_PAGE
@@ -0,0 +1,21 @@
1
+ require 'rest_client'
2
+ require_relative "options"
3
+ require_relative 'jsonable'
4
+ ##
5
+ #
6
+ # @copyright @copyright ©2013 IMS Global Learning Consortium, Inc. All Rights Reserved.
7
+ # @license For license information contact, info@imsglobal.org
8
+ #
9
+ # Caliper Sensor Entity Envelope
10
+ #
11
+ #
12
+ module Caliper
13
+
14
+ class EntityEnvelope
15
+ include Caliper::Jsonable
16
+
17
+ attr_accessor :apiKey,
18
+ :sensorId,
19
+ :entity
20
+ end
21
+ end