scorm_engine 0.6.2 → 0.6.3
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 +4 -4
- data/lib/scorm_engine/api/endpoints/dispatches.rb +1 -0
- data/lib/scorm_engine/api/endpoints/registrations.rb +5 -5
- data/lib/scorm_engine/configuration.rb +3 -2
- data/lib/scorm_engine/faraday/connection.rb +1 -1
- data/lib/scorm_engine/models/course.rb +35 -6
- data/lib/scorm_engine/models/course_configuration.rb +3 -3
- data/lib/scorm_engine/models/course_import.rb +22 -6
- data/lib/scorm_engine/models/destination.rb +9 -4
- data/lib/scorm_engine/models/dispatch.rb +44 -5
- data/lib/scorm_engine/models/dispatch_zip.rb +20 -2
- data/lib/scorm_engine/models/learner.rb +14 -4
- data/lib/scorm_engine/models/registration.rb +67 -22
- data/lib/scorm_engine/models/registration_activity_detail.rb +21 -11
- data/lib/scorm_engine/models/registration_configuration.rb +3 -3
- data/lib/scorm_engine/models/registration_launch_history.rb +46 -13
- data/lib/scorm_engine/models/registration_runtime_interaction.rb +58 -11
- data/lib/scorm_engine/version.rb +1 -1
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/fails_given_an_invalid_id.yml +3 -3
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/fails_given_an_invalid_type.yml +3 -3
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works.yml +6 -6
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works_when_type_is_AICC.yml +6 -6
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works_when_type_is_SCORM12.yml +6 -6
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works_when_type_is_SCORM2004-3RD.yml +6 -6
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_delete_registration/is_failure_when_registration_does_not_exist.yml +3 -5
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_delete_registration/is_successful_when_registration_exists.yml +3 -5
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_exists/is_false_when_registration_does_not_exist.yml +3 -5
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_exists/is_true_when_registration_exists.yml +3 -5
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_instances/includes_results_we_expect.yml +6 -8
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_instances/is_successful.yml +6 -8
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_instances/returns_an_array_of_registrations.yml +6 -8
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_launch_link/fails_when_id_is_invalid.yml +3 -5
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_launch_link/is_successful.yml +3 -5
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_launch_link/results/returns_a_URL_string.yml +3 -5
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_progress/detail/does_not_return_activity_details_by_default.yml +5 -7
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_progress/detail/returns_activity_details_if_requested.yml +5 -7
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_progress/fails_when_registration_does_not_exist.yml +3 -5
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_progress/returns_a_registration_when_it_exists.yml +5 -7
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/filtering_by_course_id/excludes_results.yml +3 -5
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/filtering_by_course_id/includes_results.yml +6 -9
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/filtering_by_learner_id/excludes_results.yml +3 -5
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/filtering_by_learner_id/includes_results.yml +5 -7
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/includes_results_we_expect.yml +6 -9
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/is_successful.yml +6 -9
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/returns_an_array_of_registrations.yml +6 -9
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_post_registration/fails_if_course_id_is_invalid.yml +6 -6
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_post_registration/fails_if_registration_id_already_exists.yml +6 -6
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_post_registration/is_successful.yml +9 -11
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_post_registration/is_successful_even_when_given_a_UTF8/slashed_username.yml +9 -47
- data/spec/scorm_engine/api/endpoints/dispatches_spec.rb +1 -1
- data/spec/scorm_engine/api/endpoints/registrations_spec.rb +8 -1
- data/spec/scorm_engine/configuration_spec.rb +22 -0
- data/spec/scorm_engine/models/course_import_spec.rb +2 -2
- data/spec/scorm_engine/models/course_spec.rb +2 -2
- data/spec/scorm_engine/models/dispatch_zip_spec.rb +1 -1
- data/spec/scorm_engine/models/registration_runtime_interaction_spec.rb +7 -0
- data/spec/scorm_engine/models/registration_spec.rb +7 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84dbb575f6c280c28cdd591bed82b4d5f208f0a2f8a0d505b2fbbdbb46f37311
|
4
|
+
data.tar.gz: b60cd4cd6e1f823c9da3105e06391d322002230fe42c3e1479a7a7a34ea6d2b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a908341227a9c67ee3c65b58c2bd0dd2232e9ce014146f866e2c238a404bda7da36c97086211f38a59e274d1d077ca96e599e4880afd9b40156df30f15f4180f
|
7
|
+
data.tar.gz: 89ef5d20c1d7bc5b5652fc2735609e9ed5160fc37cd0d8ff26189f0cf439eff3eda64ba0e4328818850caed8917788bfd6282573c060cfcbc817ba67cd704cd7
|
@@ -242,11 +242,11 @@ module ScormEngine
|
|
242
242
|
# The password to be used in authorizing the postback of data to the
|
243
243
|
# URL specified by postback url.
|
244
244
|
#
|
245
|
-
# @option options [String] :post_back/:results_format ("
|
245
|
+
# @option options [String] :post_back/:results_format ("COURSE")
|
246
246
|
# This parameter allows you to specify a level of detail in the
|
247
247
|
# information that is posted back while the course is being taken. It
|
248
|
-
# may be one of three values: '
|
249
|
-
# (activity summary), or '
|
248
|
+
# may be one of three values: 'COURSE' (course summary), 'ACTIVITY'
|
249
|
+
# (activity summary), or 'FULL' (full detail), and is set to 'COURSE'
|
250
250
|
# by default. The information will be posted as JSON using the same
|
251
251
|
# schema as what is returned in the /progress and /progress/detail
|
252
252
|
# endpoints.
|
@@ -271,10 +271,10 @@ module ScormEngine
|
|
271
271
|
if options[:post_back]
|
272
272
|
body[:postBack] = {
|
273
273
|
url: options[:post_back][:url],
|
274
|
-
authType: options[:post_back][:auth_type],
|
274
|
+
authType: options[:post_back][:auth_type]&.upcase,
|
275
275
|
userName: options[:post_back][:user_name],
|
276
276
|
password: options[:post_back][:password],
|
277
|
-
resultsFormat: options[:post_back][:results_format],
|
277
|
+
resultsFormat: options[:post_back][:results_format]&.upcase,
|
278
278
|
}.reject { |_k, v| v.nil? }
|
279
279
|
end
|
280
280
|
|
@@ -11,7 +11,7 @@ module ScormEngine
|
|
11
11
|
|
12
12
|
class Configuration
|
13
13
|
# http://rustici-docs.s3.amazonaws.com/engine/2017.1.x/api.html
|
14
|
-
attr_accessor :host, :path_prefix
|
14
|
+
attr_accessor :protocol, :host, :path_prefix
|
15
15
|
|
16
16
|
# http://rustici-docs.s3.amazonaws.com/engine/2017.1.x/Architecture-API.html#api-authentication
|
17
17
|
attr_accessor :username, :password
|
@@ -25,8 +25,9 @@ module ScormEngine
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def reset
|
28
|
+
@protocol = ENV.fetch("SCORM_ENGINE_PROTOCOL", "https")
|
28
29
|
@host = ENV["SCORM_ENGINE_HOST"]
|
29
|
-
@path_prefix = "/ScormEngineInterface/api/v1/"
|
30
|
+
@path_prefix = ENV.fetch("SCORM_ENGINE_PATH_PREFIX", "/ScormEngineInterface/api/v1/")
|
30
31
|
|
31
32
|
@username = ENV["SCORM_ENGINE_USERNAME"]
|
32
33
|
@password = ENV["SCORM_ENGINE_PASSWORD"]
|
@@ -7,7 +7,7 @@ module ScormEngine
|
|
7
7
|
|
8
8
|
def base_uri
|
9
9
|
uri = URI("")
|
10
|
-
uri.scheme =
|
10
|
+
uri.scheme = ScormEngine.configuration.protocol
|
11
11
|
uri.host = ScormEngine.configuration.host
|
12
12
|
uri.path = ScormEngine.configuration.path_prefix
|
13
13
|
URI(uri.to_s) # convert URI::Generic to URI:HTTPS
|
@@ -3,11 +3,40 @@ require "time"
|
|
3
3
|
module ScormEngine
|
4
4
|
module Models
|
5
5
|
class Course < Base
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
attr_accessor :id
|
10
|
-
|
6
|
+
# @attr
|
7
|
+
# The external identification of this course.
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :id
|
10
|
+
|
11
|
+
# @attr
|
12
|
+
# The version of this course.
|
13
|
+
# @return [Integer]
|
14
|
+
attr_accessor :version
|
15
|
+
|
16
|
+
# @attr
|
17
|
+
# The title of this course.
|
18
|
+
# @return [String]
|
19
|
+
attr_accessor :title
|
20
|
+
|
21
|
+
# @attr
|
22
|
+
#
|
23
|
+
# @return [Integer]
|
24
|
+
attr_accessor :registration_count
|
25
|
+
|
26
|
+
# @attr
|
27
|
+
#
|
28
|
+
# @return [Time]
|
29
|
+
attr_accessor :updated
|
30
|
+
|
31
|
+
# @attr
|
32
|
+
# The description of this course.
|
33
|
+
# @return [String]
|
34
|
+
attr_accessor :description
|
35
|
+
|
36
|
+
# @attr
|
37
|
+
# The score required of a learner to pass this course.
|
38
|
+
# @return [Integer]
|
39
|
+
attr_accessor :scaled_passing_score
|
11
40
|
|
12
41
|
# @attr
|
13
42
|
# The course's learning standard.
|
@@ -32,7 +61,7 @@ module ScormEngine
|
|
32
61
|
this.updated = Time.parse(options["updated"]) if options.key?("updated")
|
33
62
|
this.description = options.fetch("metadata", {})["description"]
|
34
63
|
this.scaled_passing_score = get_scaled_passing_score_from_api(options)
|
35
|
-
this.course_learning_standard = options["courseLearningStandard"]
|
64
|
+
this.course_learning_standard = options["courseLearningStandard"]&.upcase
|
36
65
|
this.web_path = options["webPath"]
|
37
66
|
|
38
67
|
this
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module ScormEngine
|
2
2
|
module Models
|
3
3
|
class CourseConfiguration < Base
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
4
|
+
# @attr
|
5
|
+
#
|
6
|
+
# @return [Hash]
|
7
7
|
attr_accessor :settings
|
8
8
|
|
9
9
|
def self.new_from_api(options = {})
|
@@ -1,10 +1,26 @@
|
|
1
1
|
module ScormEngine
|
2
2
|
module Models
|
3
3
|
class CourseImport < Base
|
4
|
-
|
5
|
-
#
|
6
|
-
#
|
7
|
-
|
4
|
+
|
5
|
+
# @attr
|
6
|
+
# The ID of this course import (not the course id)
|
7
|
+
# @return [String]
|
8
|
+
attr_accessor :id
|
9
|
+
|
10
|
+
# @attr
|
11
|
+
#
|
12
|
+
# @return [String] (RUNNING, COMPLETE, ERROR)
|
13
|
+
attr_accessor :status
|
14
|
+
|
15
|
+
# @attr
|
16
|
+
#
|
17
|
+
# @return [Array<String>]
|
18
|
+
attr_accessor :parser_warnings
|
19
|
+
|
20
|
+
# @attr
|
21
|
+
#
|
22
|
+
# @return [ScormEngine::Models::Course]
|
23
|
+
attr_accessor :course
|
8
24
|
|
9
25
|
def self.new_from_api(options = {})
|
10
26
|
this = new
|
@@ -12,11 +28,11 @@ module ScormEngine
|
|
12
28
|
|
13
29
|
if options.key?("importResult")
|
14
30
|
this.id = options["result"]
|
15
|
-
this.status = options.fetch("importResult", {})["status"]
|
31
|
+
this.status = options.fetch("importResult", {})["status"]&.upcase
|
16
32
|
this.parser_warnings = options.fetch("importResult", {})["parserWarnings"]
|
17
33
|
else
|
18
34
|
this.id = options["jobId"]
|
19
|
-
this.status = options["status"]
|
35
|
+
this.status = options["status"]&.upcase
|
20
36
|
this.course = Course.new_from_api(options["course"]) if options.key?("course") # unavailable in error states
|
21
37
|
end
|
22
38
|
|
@@ -1,10 +1,15 @@
|
|
1
1
|
module ScormEngine
|
2
2
|
module Models
|
3
3
|
class Destination < Base
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
attr_accessor :id
|
4
|
+
# @attr
|
5
|
+
# The ID of this destination.
|
6
|
+
# @return [String]
|
7
|
+
attr_accessor :id
|
8
|
+
|
9
|
+
# @attr
|
10
|
+
# The name of this destination.
|
11
|
+
# @return [String]
|
12
|
+
attr_accessor :name
|
8
13
|
|
9
14
|
def self.new_from_api(options = {})
|
10
15
|
this = new
|
@@ -3,11 +3,50 @@ require "date"
|
|
3
3
|
module ScormEngine
|
4
4
|
module Models
|
5
5
|
class Dispatch < Base
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
attr_accessor :id
|
10
|
-
|
6
|
+
# @attr
|
7
|
+
# The external identification of this dispatch.
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :id
|
10
|
+
|
11
|
+
# @attr
|
12
|
+
# The external identification of the destination.
|
13
|
+
# @return [String]
|
14
|
+
attr_accessor :destination_id
|
15
|
+
|
16
|
+
# @attr
|
17
|
+
# The external identification of the course.
|
18
|
+
# @return [String]
|
19
|
+
attr_accessor :course_id
|
20
|
+
|
21
|
+
# @attr
|
22
|
+
# If true, then new registrations can be created for this dispatch.
|
23
|
+
# @return [Boolean]
|
24
|
+
attr_accessor :allow_new_registrations
|
25
|
+
|
26
|
+
# @attr
|
27
|
+
# If true, then a new registration instance will be created if the client
|
28
|
+
# LMS doesn't provide launch data for an existing one. Otherwise, the
|
29
|
+
# same instance will always be used for the given cmi.learner_id.
|
30
|
+
# @return [Boolean]
|
31
|
+
attr_accessor :instanced
|
32
|
+
|
33
|
+
# @attr
|
34
|
+
# The maximum number of registrations that can be created for this
|
35
|
+
# dispatch, where '0' means 'unlimited registrations'.
|
36
|
+
# @return [Integer]
|
37
|
+
attr_accessor :registration_cap
|
38
|
+
|
39
|
+
# @attr
|
40
|
+
# The date after which this dispatch will be disabled as an ISO 8601
|
41
|
+
# string, or "none" for no expiration date.
|
42
|
+
# @return [Time]
|
43
|
+
attr_accessor :expiration_date
|
44
|
+
|
45
|
+
# @attr
|
46
|
+
# Serialized external configuration information to include when launching
|
47
|
+
# the dispatched package.
|
48
|
+
# @return [String]
|
49
|
+
attr_accessor :external_config
|
11
50
|
|
12
51
|
def self.new_from_api(options = {})
|
13
52
|
this = new
|
@@ -1,12 +1,30 @@
|
|
1
1
|
module ScormEngine
|
2
2
|
module Models
|
3
3
|
class DispatchZip < Base
|
4
|
-
|
4
|
+
# @attr
|
5
|
+
# The external identification of the dispatch.
|
6
|
+
# @return [String]
|
7
|
+
attr_accessor :dispatch_id
|
8
|
+
|
9
|
+
# @attr
|
10
|
+
# The type of ZIP package to generate.
|
11
|
+
# @return [String] (SCORM12, SCORM2004-3RD, AICC)
|
12
|
+
attr_accessor :type
|
13
|
+
|
14
|
+
# @attr
|
15
|
+
#
|
16
|
+
# @return [String]
|
17
|
+
attr_accessor :filename
|
18
|
+
|
19
|
+
# @attr
|
20
|
+
#
|
21
|
+
# @return [String]
|
22
|
+
attr_accessor :body
|
5
23
|
|
6
24
|
def initialize(options = {})
|
7
25
|
@options = options.dup
|
8
26
|
@dispatch_id = options[:dispatch_id]
|
9
|
-
@type = options[:type]
|
27
|
+
@type = options[:type]&.upcase
|
10
28
|
@filename = options[:filename]
|
11
29
|
@body = options[:body]
|
12
30
|
end
|
@@ -1,10 +1,20 @@
|
|
1
1
|
module ScormEngine
|
2
2
|
module Models
|
3
3
|
class Learner < Base
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
attr_accessor :id
|
4
|
+
# @attr
|
5
|
+
# The external identification of the learner.
|
6
|
+
# @return [String]
|
7
|
+
attr_accessor :id
|
8
|
+
|
9
|
+
# @attr
|
10
|
+
# The learner's first name.
|
11
|
+
# @return [String]
|
12
|
+
attr_accessor :first_name
|
13
|
+
|
14
|
+
# @attr
|
15
|
+
# The learner's last name.
|
16
|
+
# @return [String]
|
17
|
+
attr_accessor :last_name
|
8
18
|
|
9
19
|
def self.new_from_api(options = {})
|
10
20
|
this = new
|
@@ -1,21 +1,10 @@
|
|
1
|
-
#
|
2
|
-
# TODO: Incorporate all the activity props from:
|
3
|
-
# http://rustici-docs.s3.amazonaws.com/engine/2017.1.x/api.html#tenant__registrations__registrationId__progress_get
|
4
|
-
# http://rustici-docs.s3.amazonaws.com/engine/2017.1.x/api.html#tenant__registrations__registrationId__progress_detail_get
|
5
|
-
#
|
6
|
-
# TODO: Confirmed they are the only values. Integrate them into the model.
|
7
|
-
# registrationCompletion: ["COMPLETED", "INCOMPLETE", "UNKNOWN"]
|
8
|
-
# registrationSuccess: ["Unknown", "Passed", "Failed"]
|
9
|
-
#
|
10
1
|
module ScormEngine
|
11
2
|
module Models
|
12
3
|
class Registration < Base
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
attr_accessor :id
|
17
|
-
:total_seconds_tracked, :score, :course, :learner, :activity_details,
|
18
|
-
:first_access_date, :last_access_date, :completed_date, :created_date
|
4
|
+
# @attr
|
5
|
+
# The external identification of the registration.
|
6
|
+
# @return [String]
|
7
|
+
attr_accessor :id
|
19
8
|
|
20
9
|
# @attr
|
21
10
|
# Has this registration been completed?
|
@@ -37,6 +26,62 @@ module ScormEngine
|
|
37
26
|
# @return [Float] (Unknown Passed Failed)
|
38
27
|
attr_accessor :registration_completion_amount
|
39
28
|
|
29
|
+
# @attr
|
30
|
+
# Instance of this registration (typically used for reoccurring training), starts at 0.
|
31
|
+
|
32
|
+
# @return [String]
|
33
|
+
attr_accessor :instance
|
34
|
+
|
35
|
+
# @attr
|
36
|
+
#
|
37
|
+
# @return [Time]
|
38
|
+
attr_accessor :updated
|
39
|
+
|
40
|
+
# @attr
|
41
|
+
# How long the learner spent taking this registration, in seconds.
|
42
|
+
# @return [Integer]
|
43
|
+
attr_accessor :total_seconds_tracked
|
44
|
+
|
45
|
+
# @attr
|
46
|
+
# Scaled score between 0 and 100.
|
47
|
+
# @return [Float]
|
48
|
+
attr_accessor :score
|
49
|
+
|
50
|
+
# @attr
|
51
|
+
#
|
52
|
+
# @return [ScormEngine::Models::Course]
|
53
|
+
attr_accessor :course
|
54
|
+
|
55
|
+
# @attr
|
56
|
+
#
|
57
|
+
# @return [ScormEngine::Models::Learner]
|
58
|
+
attr_accessor :learner
|
59
|
+
|
60
|
+
# @attr
|
61
|
+
#
|
62
|
+
# @return [ScormEngine::Models::RegistrationActivityDetail]
|
63
|
+
attr_accessor :activity_details
|
64
|
+
|
65
|
+
# @attr
|
66
|
+
# Time of the learner's first interaction with this registration.
|
67
|
+
# @return [Time]
|
68
|
+
attr_accessor :first_access_date
|
69
|
+
|
70
|
+
# @attr
|
71
|
+
# Time of the learner's last interaction with this registration.
|
72
|
+
# @return [Time]
|
73
|
+
attr_accessor :last_access_date
|
74
|
+
|
75
|
+
# @attr
|
76
|
+
# Time of the learner's first completion of this registration.
|
77
|
+
# @return [Time]
|
78
|
+
attr_accessor :completed_date
|
79
|
+
|
80
|
+
# @attr
|
81
|
+
# Time of the creation of this registration.
|
82
|
+
# @return [Time]
|
83
|
+
attr_accessor :created_date
|
84
|
+
|
40
85
|
def self.new_from_api(options = {})
|
41
86
|
this = new
|
42
87
|
|
@@ -44,9 +89,9 @@ module ScormEngine
|
|
44
89
|
this.id = options["id"]
|
45
90
|
this.instance = options["instance"]
|
46
91
|
this.updated = Time.parse(options["updated"]) if options.key?("updated")
|
47
|
-
this.registration_completion = options["registrationCompletion"]
|
48
|
-
this.registration_success = options["registrationSuccess"]
|
49
|
-
this.total_seconds_tracked = options["totalSecondsTracked"]
|
92
|
+
this.registration_completion = options["registrationCompletion"]&.upcase
|
93
|
+
this.registration_success = options["registrationSuccess"]&.upcase
|
94
|
+
this.total_seconds_tracked = options["totalSecondsTracked"]&.to_i
|
50
95
|
this.first_access_date = Time.parse(options["firstAccessDate"]) if options.key?("firstAccessDate")
|
51
96
|
this.last_access_date = Time.parse(options["lastAccessDate"]) if options.key?("lastAccessDate")
|
52
97
|
this.created_date = Time.parse(options["createdDate"]) if options.key?("createdDate")
|
@@ -92,8 +137,8 @@ module ScormEngine
|
|
92
137
|
# Returns true, false or nil if success status is unknown.
|
93
138
|
#
|
94
139
|
def passed?
|
95
|
-
return nil if registration_success == "
|
96
|
-
registration_success == "
|
140
|
+
return nil if registration_success == "UNKNOWN"
|
141
|
+
registration_success == "PASSED"
|
97
142
|
end
|
98
143
|
|
99
144
|
#
|
@@ -103,8 +148,8 @@ module ScormEngine
|
|
103
148
|
# Returns true, false or nil if success status is unknown.
|
104
149
|
#
|
105
150
|
def failed?
|
106
|
-
return nil if registration_success == "
|
107
|
-
registration_success == "
|
151
|
+
return nil if registration_success == "UNKNOWN"
|
152
|
+
registration_success == "FAILED"
|
108
153
|
end
|
109
154
|
|
110
155
|
#
|