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.
- checksums.yaml +5 -13
- data/.gitignore +3 -0
- data/LICENSE +156 -58
- data/NOTICE +42 -8
- data/README.md +2 -2
- data/lib/caliper/defaults.rb +21 -1
- data/lib/caliper/entities/agent/organization.rb +37 -0
- data/lib/caliper/entities/agent/person.rb +38 -0
- data/lib/caliper/entities/agent/software_application.rb +39 -0
- data/lib/caliper/entities/annotation/annotation.rb +21 -11
- data/lib/caliper/entities/annotation/bookmark_annotation.rb +19 -9
- data/lib/caliper/entities/annotation/highlight_annotation.rb +19 -8
- data/lib/caliper/entities/annotation/shared_annotation.rb +19 -9
- data/lib/caliper/entities/annotation/tag_annotation.rb +19 -9
- data/lib/caliper/entities/assessment/assessment.rb +19 -9
- data/lib/caliper/entities/assessment/assessment_item.rb +19 -8
- data/lib/caliper/entities/assignable/assignable_digital_resource.rb +19 -11
- data/lib/caliper/entities/assignable/attempt.rb +21 -8
- data/lib/caliper/entities/digital_resource.rb +29 -18
- data/lib/caliper/entities/entity.rb +27 -13
- data/lib/caliper/entities/foaf/agent.rb +22 -3
- data/lib/caliper/entities/generatable.rb +21 -2
- data/lib/caliper/entities/jsonable.rb +17 -5
- data/lib/caliper/entities/learning_context.rb +30 -9
- data/lib/caliper/entities/learning_objective.rb +19 -12
- data/lib/caliper/entities/lis/course_offering.rb +23 -13
- data/lib/caliper/entities/lis/course_section.rb +20 -13
- data/lib/caliper/entities/lis/group.rb +23 -13
- data/lib/caliper/entities/lis/membership.rb +22 -16
- data/lib/caliper/entities/lis/roles.rb +18 -6
- data/lib/caliper/entities/lis/status.rb +18 -6
- data/lib/caliper/entities/media/audio_object.rb +21 -7
- data/lib/caliper/entities/media/image_object.rb +21 -7
- data/lib/caliper/entities/media/media_location.rb +19 -4
- data/lib/caliper/entities/media/media_object.rb +19 -8
- data/lib/caliper/entities/media/video_object.rb +21 -7
- data/lib/caliper/entities/outcome/result.rb +23 -2
- data/lib/caliper/entities/reading/epub_chapter.rb +23 -7
- data/lib/caliper/entities/reading/epub_part.rb +24 -8
- data/lib/caliper/entities/reading/epub_sub_chapter.rb +22 -5
- data/lib/caliper/entities/reading/epub_volume.rb +20 -12
- data/lib/caliper/entities/reading/frame.rb +22 -6
- data/lib/caliper/entities/reading/web_page.rb +37 -0
- data/lib/caliper/entities/response/fillin_blank_response.rb +21 -3
- data/lib/caliper/entities/response/multiple_choice_response.rb +20 -3
- data/lib/caliper/entities/response/multiple_response_response.rb +20 -3
- data/lib/caliper/entities/response/response.rb +24 -3
- data/lib/caliper/entities/response/response_type.rb +20 -0
- data/lib/caliper/entities/response/select_type_response.rb +23 -5
- data/lib/caliper/entities/response/true_false_response.rb +20 -3
- data/lib/caliper/entities/schemadotorg/creative_work.rb +22 -2
- data/lib/caliper/entities/schemadotorg/software_application.rb +22 -2
- data/lib/caliper/entities/schemadotorg/thing.rb +19 -0
- data/lib/caliper/entities/schemadotorg/web_page.rb +22 -2
- data/lib/caliper/entities/session/session.rb +44 -0
- data/lib/caliper/entities/targetable.rb +19 -3
- data/lib/caliper/entities/w3c/membership.rb +32 -0
- data/lib/caliper/entities/w3c/organization.rb +30 -0
- data/lib/caliper/entity_envelope.rb +20 -7
- data/lib/caliper/event/annotation_event.rb +21 -6
- data/lib/caliper/event/assessment_event.rb +22 -2
- data/lib/caliper/event/assessment_item_event.rb +22 -2
- data/lib/caliper/event/assignable_event.rb +22 -2
- data/lib/caliper/event/event.rb +23 -1
- data/lib/caliper/event/jsonable.rb +18 -6
- data/lib/caliper/event/media_event.rb +22 -2
- data/lib/caliper/event/navigation_event.rb +22 -3
- data/lib/caliper/event/outcome_event.rb +22 -3
- data/lib/caliper/event/session_event.rb +21 -7
- data/lib/caliper/event/view_event.rb +22 -8
- data/lib/caliper/event_envelope.rb +20 -8
- data/lib/caliper/jsonable.rb +24 -7
- data/lib/caliper/options.rb +21 -2
- data/lib/caliper/profiles/annotation_profile.rb +21 -3
- data/lib/caliper/profiles/assessment_item_profile.rb +48 -0
- data/lib/caliper/profiles/assessment_profile.rb +22 -23
- data/lib/caliper/profiles/assignable_profile.rb +21 -4
- data/lib/caliper/profiles/media_profile.rb +20 -3
- data/lib/caliper/profiles/profile.rb +20 -24
- data/lib/caliper/profiles/reading_profile.rb +21 -4
- data/lib/caliper/profiles/session_profile.rb +20 -2
- data/lib/caliper/request/event_store_envelope.rb +20 -2
- data/lib/caliper/request/event_store_requestor.rb +21 -2
- data/lib/caliper/request/http_requestor.rb +28 -9
- data/lib/caliper/sensor.rb +21 -11
- data/lib/caliper/stats/atomic_wrapper.rb +21 -4
- data/lib/caliper/stats/statistic.rb +21 -1
- data/lib/caliper/stats/statistics.rb +20 -2
- data/lib/caliper/stats/statistics_map.rb +20 -0
- data/lib/caliper/validators/error_message.rb +20 -0
- data/lib/caliper/validators/event_validator.rb +20 -0
- data/lib/caliper/validators/event_validator_context.rb +21 -1
- data/lib/caliper/validators/property_type_check.rb +23 -4
- data/lib/caliper/validators/session_login_event_validator.rb +39 -21
- data/lib/caliper/validators/session_logout_event_validator.rb +31 -13
- data/lib/caliper/validators/time_check.rb +20 -0
- data/lib/caliper/version.rb +22 -3
- data/lib/caliper.rb +18 -1
- data/spec/lib/entities/{lis → agent}/person_spec.rb +26 -6
- data/spec/lib/entities/{lis → agent}/student.json +0 -0
- data/spec/lib/entities/entity_spec.rb +19 -4
- data/spec/lib/event/annotation_event_bookmark_spec.rb +23 -8
- data/spec/lib/event/annotation_event_highlight_spec.rb +23 -8
- data/spec/lib/event/annotation_event_shared_spec.rb +25 -10
- data/spec/lib/event/annotation_event_tag_spec.rb +23 -8
- data/spec/lib/event/assessment_event_spec.rb +22 -8
- data/spec/lib/event/assessment_item_completed_event_spec.rb +24 -10
- data/spec/lib/event/assessment_item_started_event_spec.rb +24 -10
- data/spec/lib/event/assignable_event_spec.rb +225 -0
- data/spec/lib/event/media_event_spec.rb +22 -7
- data/spec/lib/event/navigated_event_spec.rb +26 -11
- data/spec/lib/event/session_event_login_spec.rb +26 -12
- data/spec/lib/event/session_event_logout_spec.rb +25 -12
- data/spec/lib/event/session_event_timeout_spec.rb +25 -12
- data/spec/lib/event/viewed_event_spec.rb +23 -8
- data/spec/lib/event_helper.rb +25 -9
- data/spec/lib/sensor_spec.rb +43 -13
- data/spec/spec_helper.rb +18 -3
- metadata +19 -22
- data/.idea/caliper-ruby.iml +0 -156
- data/.idea/encodings.xml +0 -5
- data/.idea/misc.xml +0 -5
- data/.idea/modules.xml +0 -9
- data/.idea/scopes/scope_settings.xml +0 -5
- data/.idea/vcs.xml +0 -7
- data/lib/caliper/entities/lis/organization.rb +0 -25
- data/lib/caliper/entities/lis/person.rb +0 -25
- data/lib/caliper/entities/session.rb +0 -34
- data/lib/caliper/entities/software_application.rb +0 -28
- data/lib/caliper/entities/web_page.rb +0 -15
- data/spec/lib/request/http_request_spec.rb +0 -216
@@ -1,23 +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_relative './profile'
|
2
19
|
|
20
|
+
#
|
21
|
+
# Assessment Profile.
|
22
|
+
#
|
3
23
|
module Caliper
|
4
24
|
module Profiles
|
5
|
-
|
6
25
|
module AssessmentActions
|
7
26
|
PAUSED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Paused"
|
8
27
|
RESTARTED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Restarted"
|
9
28
|
STARTED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Started"
|
10
29
|
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
30
|
end
|
22
31
|
|
23
32
|
class AssessmentProfile < Caliper::Profiles::Profile
|
@@ -30,19 +39,9 @@ module Caliper
|
|
30
39
|
if (object.is_a? DigitalResource)
|
31
40
|
return object
|
32
41
|
else
|
33
|
-
fail 'Object must
|
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'
|
42
|
+
fail 'Object must be of type DigitalResource'
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
47
46
|
end
|
48
|
-
end
|
47
|
+
end
|
@@ -1,8 +1,27 @@
|
|
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 './profile'
|
2
19
|
|
20
|
+
#
|
21
|
+
# Assignable Profile.
|
22
|
+
#
|
3
23
|
module Caliper
|
4
24
|
module Profiles
|
5
|
-
|
6
25
|
module AssignableActions
|
7
26
|
ABANDONED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Abandoned"
|
8
27
|
ACTIVATED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Activated"
|
@@ -13,7 +32,6 @@ module Caliper
|
|
13
32
|
SHOWED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Showed"
|
14
33
|
STARTED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Started"
|
15
34
|
SUBMITTED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Submitted"
|
16
|
-
NAVIGATED_TO = "http://purl.imsglobal.org/vocab/caliper/v1/action#NavigatedTo"
|
17
35
|
end
|
18
36
|
|
19
37
|
class AssignableProfile < Caliper::Profiles::Profile
|
@@ -39,6 +57,5 @@ module Caliper
|
|
39
57
|
end
|
40
58
|
end
|
41
59
|
end
|
42
|
-
|
43
60
|
end
|
44
|
-
end
|
61
|
+
end
|
@@ -1,8 +1,27 @@
|
|
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 './profile'
|
2
19
|
|
20
|
+
#
|
21
|
+
# Media Profile.
|
22
|
+
#
|
3
23
|
module Caliper
|
4
24
|
module Profiles
|
5
|
-
|
6
25
|
module MediaActions
|
7
26
|
CHANGED_RESOLUTION = "http://purl.imsglobal.org/vocab/caliper/v1/action#ChangedResolution"
|
8
27
|
CHANGED_SIZE = "http://purl.imsglobal.org/vocab/caliper/v1/action#ChangedSize"
|
@@ -23,7 +42,6 @@ module Caliper
|
|
23
42
|
REWOUND = "http://purl.imsglobal.org/vocab/caliper/v1/action#Rewound"
|
24
43
|
STARTED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Started"
|
25
44
|
UNMUTED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Unmuted"
|
26
|
-
NAVIGATED_TO = "http://purl.imsglobal.org/vocab/caliper/v1/action#NavigatedTo"
|
27
45
|
end
|
28
46
|
|
29
47
|
class MediaProfile < Caliper::Profiles::Profile
|
@@ -49,6 +67,5 @@ module Caliper
|
|
49
67
|
end
|
50
68
|
end
|
51
69
|
end
|
52
|
-
|
53
70
|
end
|
54
71
|
end
|
@@ -1,33 +1,29 @@
|
|
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
18
|
require 'i18n'
|
3
19
|
|
20
|
+
#
|
21
|
+
# Base Profile.
|
22
|
+
#
|
4
23
|
module Caliper
|
5
24
|
module Profiles
|
6
25
|
module ProfileActions
|
7
|
-
|
8
|
-
UPLOADED = "item.uploaded"
|
9
|
-
LOGGED_IN = "session.loggedIn"
|
10
|
-
LOGGED_OUT = "session.loggedOut"
|
11
|
-
NAVIGATED_TO = "navigation.navigatedTo"
|
12
|
-
end
|
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"
|
26
|
+
NAVIGATED_TO = "http://purl.imsglobal.org/vocab/caliper/v1/action#NavigatedTo"
|
31
27
|
end
|
32
28
|
|
33
29
|
class Profile
|
@@ -1,14 +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_relative './profile'
|
2
19
|
require_relative '../entities/digital_resource'
|
3
20
|
require_relative '../entities/reading/frame'
|
4
21
|
|
22
|
+
#
|
23
|
+
# Reading Profile.
|
24
|
+
#
|
5
25
|
module Caliper
|
6
26
|
module Profiles
|
7
|
-
|
8
27
|
module ReadingActions
|
9
28
|
SEARCHED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Searched"
|
10
29
|
VIEWED = "http://purl.imsglobal.org/vocab/caliper/v1/action#Viewed"
|
11
|
-
NAVIGATED_TO = "http://purl.imsglobal.org/vocab/caliper/v1/action#NavigatedTo"
|
12
30
|
end
|
13
31
|
|
14
32
|
class ReadingProfile < Caliper::Profiles::Profile
|
@@ -34,6 +52,5 @@ module Caliper
|
|
34
52
|
end
|
35
53
|
end
|
36
54
|
end
|
37
|
-
|
38
55
|
end
|
39
|
-
end
|
56
|
+
end
|
@@ -1,9 +1,28 @@
|
|
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
18
|
require_relative './profile'
|
3
19
|
require_relative '../entities/digital_resource'
|
4
20
|
require_relative '../entities/annotation/annotation'
|
5
21
|
require_relative '../entities/reading/frame'
|
6
22
|
|
23
|
+
#
|
24
|
+
# Session Profile.
|
25
|
+
#
|
7
26
|
module Caliper
|
8
27
|
module Profiles
|
9
28
|
module SessionActions
|
@@ -22,7 +41,6 @@ module Caliper
|
|
22
41
|
def validate_event (event)
|
23
42
|
|
24
43
|
end
|
25
|
-
|
26
44
|
end
|
27
45
|
end
|
28
|
-
end
|
46
|
+
end
|
@@ -1,9 +1,27 @@
|
|
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
|
-
#
|
18
|
+
#
|
19
|
+
# Event store envelope. Contains event info.
|
20
|
+
#
|
3
21
|
module Caliper
|
4
22
|
module Request
|
5
23
|
class EventStoreEnvelope
|
6
24
|
attr_accessor :id, :type, :time, :data
|
7
25
|
end
|
8
26
|
end
|
9
|
-
end
|
27
|
+
end
|
@@ -1,11 +1,30 @@
|
|
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 'securerandom'
|
2
|
-
require_relative 'event_store_envelope'
|
19
|
+
require_relative './event_store_envelope'
|
3
20
|
|
21
|
+
#
|
22
|
+
# Event store requestor.
|
23
|
+
#
|
4
24
|
module Caliper
|
5
25
|
module Request
|
6
26
|
class EventStoreRequestor
|
7
27
|
|
8
|
-
|
9
28
|
def get_payload_json(caliper_event, id, send_time)
|
10
29
|
|
11
30
|
list_payload = Array.new
|
@@ -1,7 +1,24 @@
|
|
1
|
-
|
2
|
-
|
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
|
+
|
3
18
|
require "net/http"
|
4
19
|
require "uri"
|
20
|
+
require_relative './event_store_requestor'
|
21
|
+
require_relative './event_store_envelope'
|
5
22
|
|
6
23
|
module Caliper
|
7
24
|
module Request
|
@@ -16,13 +33,15 @@ module Caliper
|
|
16
33
|
def send(event)
|
17
34
|
status = false
|
18
35
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
36
|
+
raise ArgumentError, "Expecting Caliper::Event but got #{event.class.to_s}" unless event.is_a?(Caliper::Event::Event)
|
37
|
+
|
38
|
+
envelope = EventEnvelope.new
|
39
|
+
envelope.apiKey = @options['apiKey']
|
40
|
+
envelope.sensorId = @options['sensorId']
|
41
|
+
envelope.event = event
|
42
|
+
|
43
|
+
RestClient.post @options['host'], envelope.to_json, :content_type => :json, :accept => :json
|
23
44
|
|
24
|
-
response = http.request request # Net::HTTPResponse object
|
25
|
-
end
|
26
45
|
|
27
46
|
if (response.code != 200)
|
28
47
|
status_code = response.code
|
@@ -39,4 +58,4 @@ module Caliper
|
|
39
58
|
end
|
40
59
|
end
|
41
60
|
end
|
42
|
-
end
|
61
|
+
end
|
data/lib/caliper/sensor.rb
CHANGED
@@ -1,18 +1,29 @@
|
|
1
|
-
require 'rest-client'
|
2
|
-
require_relative "options"
|
3
|
-
require_relative "event_envelope"
|
4
|
-
require_relative "entity_envelope"
|
5
|
-
|
6
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.
|
7
10
|
#
|
8
|
-
#
|
9
|
-
#
|
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.
|
10
14
|
#
|
11
|
-
#
|
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 'rest_client'
|
19
|
+
require_relative "./options"
|
20
|
+
require_relative "./event_envelope"
|
21
|
+
require_relative "./entity_envelope"
|
22
|
+
|
12
23
|
#
|
24
|
+
# Caliper Sensor.
|
13
25
|
#
|
14
26
|
module Caliper
|
15
|
-
|
16
27
|
class Sensor
|
17
28
|
|
18
29
|
def initialize(options)
|
@@ -43,6 +54,5 @@ module Caliper
|
|
43
54
|
RestClient.post @options['host'], envelope.to_json, :content_type => :json, :accept => :json
|
44
55
|
|
45
56
|
end
|
46
|
-
|
47
57
|
end
|
48
|
-
end
|
58
|
+
end
|
@@ -1,11 +1,29 @@
|
|
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 'atomic'
|
2
19
|
|
3
|
-
#
|
20
|
+
#
|
21
|
+
# Extends the atomic class with several new functions.
|
22
|
+
#
|
4
23
|
module Caliper
|
5
24
|
module Stats
|
6
25
|
class AtomicWrapper < Atomic
|
7
26
|
|
8
|
-
|
9
27
|
def initialize(value)
|
10
28
|
super.initialize(value)
|
11
29
|
end
|
@@ -80,7 +98,6 @@ module Caliper
|
|
80
98
|
def to_string()
|
81
99
|
return @value.to_s
|
82
100
|
end
|
83
|
-
|
84
101
|
end
|
85
102
|
end
|
86
|
-
end
|
103
|
+
end
|
@@ -1,6 +1,26 @@
|
|
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 'atomic'
|
2
19
|
require 'math'
|
3
20
|
|
21
|
+
#
|
22
|
+
# Statistic.
|
23
|
+
#
|
4
24
|
module Caliper
|
5
25
|
module Stats
|
6
26
|
class Statistic
|
@@ -101,4 +121,4 @@ module Caliper
|
|
101
121
|
end
|
102
122
|
end
|
103
123
|
end
|
104
|
-
end
|
124
|
+
end
|
@@ -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
|
+
# Statistics.
|
20
|
+
#
|
1
21
|
module Caliper
|
2
22
|
module Stats
|
3
23
|
class Statistics < StatisticsMap
|
@@ -38,8 +58,6 @@ module Caliper
|
|
38
58
|
def update_failed
|
39
59
|
update(FAILED_KEY, val)
|
40
60
|
end
|
41
|
-
|
42
|
-
|
43
61
|
end
|
44
62
|
end
|
45
63
|
end
|
@@ -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
|
+
# Statistics map.
|
20
|
+
#
|
1
21
|
module Caliper
|
2
22
|
module Stats
|
3
23
|
class StatisticsMap < Hash
|
@@ -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
|
+
# Error Message.
|
20
|
+
#
|
1
21
|
module Caliper
|
2
22
|
module Validators
|
3
23
|
class ErrorMessage
|
@@ -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
|
+
# Event Validator.
|
20
|
+
#
|
1
21
|
module Caliper
|
2
22
|
module Validators
|
3
23
|
module EventValidator
|
@@ -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
|
+
# Event Validator context.
|
20
|
+
#
|
1
21
|
module Caliper
|
2
22
|
module Validators
|
3
23
|
class EventValidatorContext
|
@@ -13,4 +33,4 @@ module Caliper
|
|
13
33
|
end
|
14
34
|
end
|
15
35
|
end
|
16
|
-
end
|
36
|
+
end
|