scorm_engine 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/lib/scorm_engine/api/endpoints/dispatches.rb +1 -0
  3. data/lib/scorm_engine/api/endpoints/registrations.rb +5 -5
  4. data/lib/scorm_engine/configuration.rb +3 -2
  5. data/lib/scorm_engine/faraday/connection.rb +1 -1
  6. data/lib/scorm_engine/models/course.rb +35 -6
  7. data/lib/scorm_engine/models/course_configuration.rb +3 -3
  8. data/lib/scorm_engine/models/course_import.rb +22 -6
  9. data/lib/scorm_engine/models/destination.rb +9 -4
  10. data/lib/scorm_engine/models/dispatch.rb +44 -5
  11. data/lib/scorm_engine/models/dispatch_zip.rb +20 -2
  12. data/lib/scorm_engine/models/learner.rb +14 -4
  13. data/lib/scorm_engine/models/registration.rb +67 -22
  14. data/lib/scorm_engine/models/registration_activity_detail.rb +21 -11
  15. data/lib/scorm_engine/models/registration_configuration.rb +3 -3
  16. data/lib/scorm_engine/models/registration_launch_history.rb +46 -13
  17. data/lib/scorm_engine/models/registration_runtime_interaction.rb +58 -11
  18. data/lib/scorm_engine/version.rb +1 -1
  19. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/fails_given_an_invalid_id.yml +3 -3
  20. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/fails_given_an_invalid_type.yml +3 -3
  21. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works.yml +6 -6
  22. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works_when_type_is_AICC.yml +6 -6
  23. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works_when_type_is_SCORM12.yml +6 -6
  24. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works_when_type_is_SCORM2004-3RD.yml +6 -6
  25. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_delete_registration/is_failure_when_registration_does_not_exist.yml +3 -5
  26. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_delete_registration/is_successful_when_registration_exists.yml +3 -5
  27. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_exists/is_false_when_registration_does_not_exist.yml +3 -5
  28. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_exists/is_true_when_registration_exists.yml +3 -5
  29. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_instances/includes_results_we_expect.yml +6 -8
  30. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_instances/is_successful.yml +6 -8
  31. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_instances/returns_an_array_of_registrations.yml +6 -8
  32. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_launch_link/fails_when_id_is_invalid.yml +3 -5
  33. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_launch_link/is_successful.yml +3 -5
  34. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_launch_link/results/returns_a_URL_string.yml +3 -5
  35. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_progress/detail/does_not_return_activity_details_by_default.yml +5 -7
  36. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_progress/detail/returns_activity_details_if_requested.yml +5 -7
  37. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_progress/fails_when_registration_does_not_exist.yml +3 -5
  38. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_progress/returns_a_registration_when_it_exists.yml +5 -7
  39. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/filtering_by_course_id/excludes_results.yml +3 -5
  40. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/filtering_by_course_id/includes_results.yml +6 -9
  41. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/filtering_by_learner_id/excludes_results.yml +3 -5
  42. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/filtering_by_learner_id/includes_results.yml +5 -7
  43. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/includes_results_we_expect.yml +6 -9
  44. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/is_successful.yml +6 -9
  45. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/returns_an_array_of_registrations.yml +6 -9
  46. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_post_registration/fails_if_course_id_is_invalid.yml +6 -6
  47. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_post_registration/fails_if_registration_id_already_exists.yml +6 -6
  48. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_post_registration/is_successful.yml +9 -11
  49. data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_post_registration/is_successful_even_when_given_a_UTF8/slashed_username.yml +9 -47
  50. data/spec/scorm_engine/api/endpoints/dispatches_spec.rb +1 -1
  51. data/spec/scorm_engine/api/endpoints/registrations_spec.rb +8 -1
  52. data/spec/scorm_engine/configuration_spec.rb +22 -0
  53. data/spec/scorm_engine/models/course_import_spec.rb +2 -2
  54. data/spec/scorm_engine/models/course_spec.rb +2 -2
  55. data/spec/scorm_engine/models/dispatch_zip_spec.rb +1 -1
  56. data/spec/scorm_engine/models/registration_runtime_interaction_spec.rb +7 -0
  57. data/spec/scorm_engine/models/registration_spec.rb +7 -0
  58. metadata +1 -1
@@ -1,7 +1,7 @@
1
1
  RSpec.describe ScormEngine::Models::CourseImport do
2
2
  describe ".new_from_api" do
3
3
  describe "when :importResult is present" do
4
- let(:subject) { described_class.new_from_api("result" => "id123", "importResult" => { "status" => "RUNNING", "parserWarnings" => "watch out" }) }
4
+ let(:subject) { described_class.new_from_api("result" => "id123", "importResult" => { "status" => "running", "parserWarnings" => "watch out" }) }
5
5
 
6
6
  it "sets the id" do
7
7
  expect(subject.id).to eq "id123"
@@ -78,7 +78,7 @@ RSpec.describe ScormEngine::Models::CourseImport do
78
78
  expect(subject.complete?).to eq true
79
79
  end
80
80
 
81
- it "is false when status is not COMPLETTE" do
81
+ it "is false when status is not COMPLETE" do
82
82
  subject = described_class.new_from_api("status" => "OOPS")
83
83
  expect(subject.complete?).to eq false
84
84
  end
@@ -90,9 +90,9 @@ RSpec.describe ScormEngine::Models::Course do
90
90
  end
91
91
 
92
92
  describe ":course_learning_standard" do
93
- it "is set properly" do
93
+ it "is set properly as uppercase" do
94
94
  course = described_class.new_from_api(
95
- "courseLearningStandard" => "SCORM_2004_4TH_EDITION"
95
+ "courseLearningStandard" => "scorm_2004_4th_edition"
96
96
  )
97
97
  expect(course.course_learning_standard).to eq "SCORM_2004_4TH_EDITION"
98
98
  end
@@ -3,7 +3,7 @@ RSpec.describe ScormEngine::Models::DispatchZip do
3
3
  it "set the attributes correctly" do
4
4
  dispatch_zip = described_class.new(
5
5
  dispatch_id: 123,
6
- type: "SCORM12",
6
+ type: "scorm12",
7
7
  filename: "dispatch.zip",
8
8
  body: "raw zip string",
9
9
  )
@@ -1,6 +1,7 @@
1
1
  RSpec.describe ScormEngine::Models::RegistrationRuntimeInteraction do
2
2
  describe ".new_from_api" do
3
3
  let(:options) { {
4
+ "type" => "TrueFalse",
4
5
  "id" => "interaction-123",
5
6
  "description" => " foo \t bar \n baz ",
6
7
  "timestampUtc" => "2018-05-24T00:01:02.00Z",
@@ -13,6 +14,12 @@ RSpec.describe ScormEngine::Models::RegistrationRuntimeInteraction do
13
14
 
14
15
  let(:interaction) { described_class.new_from_api(options) }
15
16
 
17
+ describe ":type" do
18
+ it "is set properly" do
19
+ expect(interaction.type).to eq "TRUEFALSE"
20
+ end
21
+ end
22
+
16
23
  describe ":id" do
17
24
  it "is set properly" do
18
25
  expect(interaction.id).to eq "interaction-123"
@@ -15,6 +15,7 @@ RSpec.describe ScormEngine::Models::Registration do
15
15
  "firstName" => "Bobby",
16
16
  "lastName" => "Jones",
17
17
  },
18
+ "totalSecondsTracked" => "456",
18
19
  } }
19
20
 
20
21
  let(:registration) { described_class.new_from_api(options) }
@@ -79,6 +80,12 @@ RSpec.describe ScormEngine::Models::Registration do
79
80
  end
80
81
  end
81
82
 
83
+ describe ":total_seconds_tracked" do
84
+ it "is set properly" do
85
+ expect(registration.total_seconds_tracked).to eq 456
86
+ end
87
+ end
88
+
82
89
  describe "#complete?" do
83
90
  it "is nil when completion is UNKNOWN" do
84
91
  registration = described_class.new_from_api("registrationCompletion" => "UNKNOWN")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scorm_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Hallstrom