scorm_engine 0.7.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/scorm_engine/api/endpoints.rb +4 -0
- data/lib/scorm_engine/api/endpoints/configuration.rb +94 -0
- data/lib/scorm_engine/api/endpoints/courses/configuration.rb +1 -1
- data/lib/scorm_engine/api/endpoints/registrations/configuration.rb +1 -1
- data/lib/scorm_engine/api/endpoints/tenants/configuration.rb +108 -0
- data/lib/scorm_engine/configuration.rb +4 -2
- data/lib/scorm_engine/faraday/connection.rb +10 -4
- data/lib/scorm_engine/faraday/request.rb +19 -4
- data/lib/scorm_engine/models.rb +1 -0
- data/lib/scorm_engine/models/tenant_configuration.rb +34 -0
- data/lib/scorm_engine/version.rb +1 -1
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_About/_get_about/is_successful.yml +24 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_About/_get_about/knows_the_platform.yml +24 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_About/_get_about/knows_the_version.yml +24 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_About/_get_about_user_count/accepts_before_option.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_About/_get_about_user_count/accepts_since_option.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_About/_get_about_user_count/is_successful.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_About/_get_about_user_count/tracks_combined_counts.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_About/_get_about_user_count/tracks_per_tenantcounts.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Configuration/_delete_app_configuration/fails_when_settings_are_invalid.yml +46 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Configuration/_delete_app_configuration/is_successful.yml +42 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Configuration/_get_app_configuration/includeMetadata/is_successful.yml +931 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Configuration/_get_app_configuration/includeMetadata/returns_metadata_in_raw_response_when_included_in_options.yml +931 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Configuration/_get_app_configuration/is_successful.yml +64 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Configuration/_get_app_configuration/returns_settings_and_values.yml +64 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Configuration/_post_app_configuration/fails_when_settings_are_invalid.yml +48 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Configuration/_post_app_configuration/is_successful.yml +44 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Configuration/_post_app_configuration/persists_the_settings.yml +207 -0
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses/_delete_course/fails_when_id_is_invalid.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses/_delete_course/works.yml +19 -9
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses/_get_course_detail/fails_when_id_is_invalid.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses/_get_course_detail/is_successful.yml +24 -16
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses/_get_course_detail/results/sucessfully_creates_the_Course_attributes.yml +24 -16
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses/_get_course_preview/fails_when_id_is_invalid.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses/_get_course_preview/is_successful.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses/_get_course_preview/results/returns_a_URL_string.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses/_get_courses/_course_id_option/fetches_a_single_course_but_perhaps_multiple_versions.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses/_get_courses/_course_id_option/returns_404_when_ID_is_invalid.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses/_get_courses/_more_option_pagination_/returns_all_the_courses.yml +65 -45
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses/_get_courses/_more_option_pagination_/returns_the_more_key_in_the_raw_response.yml +32 -24
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses/_get_courses/_since_option/fails_when_passed_an_invalid_value.yml +20 -10
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses/_get_courses/_since_option/works.yml +42 -19
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses/_get_courses/is_successful.yml +32 -19
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses/_get_courses/results/is_an_enumerator_of_Course_models.yml +32 -19
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses/_get_courses/results/sucessfully_creates_the_Course_attributes.yml +32 -19
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses_Configuration/_get_course_configuration/fails_when_id_is_invalid.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses_Configuration/_get_course_configuration/is_successful.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses_Configuration/_get_course_configuration/results/makes_settings_available_as_key/value_pairs.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses_Configuration/_get_course_configuration_setting/fails_when_course_id_is_invalid.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses_Configuration/_get_course_configuration_setting/fails_when_setting_id_is_invalid.yml +20 -10
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses_Configuration/_get_course_configuration_setting/is_successful.yml +41 -19
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses_Configuration/_get_course_configuration_setting/results/returns_the_value_as_a_string.yml +41 -19
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses_Configuration/_post_course_configuration/fails_when_id_is_invalid.yml +25 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses_Configuration/_post_course_configuration/fails_when_settings_are_invalid.yml +24 -12
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses_Configuration/_post_course_configuration/is_successful.yml +21 -9
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses_Configuration/_post_course_configuration/persists_the_settings.yml +88 -48
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses_Configuration/_put_course_configuration_setting/fails_when_course_id_is_invalid.yml +25 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses_Configuration/_put_course_configuration_setting/fails_when_setting_id_is_invalid.yml +20 -10
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses_Configuration/_put_course_configuration_setting/is_successful.yml +41 -19
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses_Configuration/_put_course_configuration_setting/results/persists_the_changes.yml +61 -29
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses_Import/_get_course_import/successful_imports/works.yml +102 -95
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses_Import/_get_course_import/unsuccessful_imports/fails_to_import_given_an_invalid_url.yml +73 -294
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Courses_Import/_post_course_import/unsuccessful_imports/fails_to_import_a_previously_existing_course.yml +21 -9
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_delete_destination/returns_success_even_when_id_is_invalid.yml +19 -9
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_delete_destination/works.yml +19 -9
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destination/fails_when_id_is_invalid.yml +22 -14
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destination/is_successful.yml +22 -14
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destination/results/sucessfully_creates_the_destination_attributes.yml +22 -14
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destination_dispatches_registration_count/fails_when_invalid.yml +22 -14
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destination_dispatches_registration_count/works.yml +20 -10
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destinations/_more_option_pagination_/returns_all_the_destinations.yml +48 -31
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destinations/_more_option_pagination_/returns_the_more_key_in_the_raw_response.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destinations/_since_option/fails_when_passed_an_invalid_value.yml +22 -13
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destinations/_since_option/works.yml +24 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destinations/is_successful.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destinations/results/is_an_enumerator_of_Destination_models.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_get_destinations/results/sucessfully_creates_the_Destination_attributes.yml +65 -13
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_post_destination/is_successful.yml +40 -18
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_post_destination/is_successful_even_if_the_destination_id_is_not_unique.yml +21 -9
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_post_destination_dispatches_enabled/fails_when_invalid.yml +24 -12
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_post_destination_dispatches_enabled/works_when_false.yml +21 -9
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_post_destination_dispatches_enabled/works_when_true.yml +21 -9
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_post_destination_dispatches_registration_instancing/fails_when_invalid.yml +24 -12
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_post_destination_dispatches_registration_instancing/works_when_false.yml +21 -9
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_post_destination_dispatches_registration_instancing/works_when_true.yml +21 -9
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_put_destination/is_successful.yml +21 -9
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_put_destination/results/sucessfully_creates_the_destination_attributes.yml +43 -23
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_delete_dispatch/returns_success_even_when_id_is_invalid.yml +19 -7
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_delete_dispatch/works.yml +19 -7
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_delete_dispatch_registration_count/is_successful.yml +19 -7
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_delete_dispatch_registration_count/succeeds_even_when_id_is_invalid.yml +19 -7
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch/fails_when_id_is_invalid.yml +22 -12
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch/is_successful.yml +23 -13
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch/results/sucessfully_creates_the_dispatch_attributes.yml +23 -13
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_enabled/is_false_when_disabled.yml +39 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_enabled/is_true_when_enabled.yml +39 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_registration_count/fails_when_id_is_invalid.yml +41 -19
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_registration_count/is_successful.yml +42 -20
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_registration_count/results/sucessfully_creates_the_dispatch_attributes.yml +42 -20
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/fails_given_an_invalid_id.yml +22 -12
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/fails_given_an_invalid_type.yml +20 -8
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works.yml +24 -12
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works_when_type_is_AICC.yml +24 -12
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works_when_type_is_SCORM12.yml +24 -12
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works_when_type_is_SCORM2004-3RD.yml +23 -11
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/_more_option_pagination_/returns_all_the_dispatches.yml +47 -27
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/_more_option_pagination_/returns_the_more_key_in_the_raw_response.yml +23 -13
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/_since_option/fails_when_passed_an_invalid_value.yml +20 -8
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/_since_option/works.yml +23 -13
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/is_successful.yml +23 -13
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/results/is_an_enumerator_of_dispatch_models.yml +23 -13
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatches/results/sucessfully_creates_the_dispatch_attributes.yml +21 -44
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_post_dispatch/is_successful.yml +38 -14
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_post_dispatch/updates_if_same_dispatch_id.yml +65 -33
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_put_dispatch/is_successful.yml +19 -7
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_put_dispatch/results/sucessfully_creates_the_dispatch_attributes.yml +42 -20
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_put_dispatch_enabled/fails_when_invalid.yml +22 -10
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_put_dispatch_enabled/works_when_false.yml +19 -7
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_put_dispatch_enabled/works_when_true.yml +19 -7
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Ping/_get_ping/is_successful.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Ping/_get_ping/reports_the_api_is_up.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Ping/_get_ping/with_invalid_password/is_unsuccessful.yml +25 -17
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Ping/_get_ping/with_invalid_password/returns_status_403.yml +25 -17
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_delete_registration/is_failure_when_registration_does_not_exist.yml +23 -13
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_delete_registration/is_successful_when_registration_exists.yml +19 -7
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_exists/is_false_when_registration_does_not_exist.yml +23 -13
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_exists/is_true_when_registration_exists.yml +20 -8
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_instances/includes_results_we_expect.yml +26 -14
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_instances/is_successful.yml +26 -14
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_instances/returns_an_array_of_registrations.yml +26 -14
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_launch_link/fails_when_id_is_invalid.yml +23 -13
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_launch_link/is_successful.yml +23 -13
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_launch_link/results/returns_a_URL_string.yml +23 -13
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_progress/detail/does_not_return_activity_details_by_default.yml +24 -14
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_progress/detail/returns_activity_details_if_requested.yml +24 -14
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_progress/fails_when_registration_does_not_exist.yml +23 -13
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_progress/returns_a_registration_when_it_exists.yml +24 -14
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/filtering_by_course_id/excludes_results.yml +22 -12
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/filtering_by_course_id/includes_results.yml +26 -14
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/filtering_by_learner_id/excludes_results.yml +22 -12
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/filtering_by_learner_id/includes_results.yml +26 -14
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/includes_results_we_expect.yml +26 -14
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/is_successful.yml +26 -14
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/returns_an_array_of_registrations.yml +26 -14
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_post_registration/fails_if_course_id_is_invalid.yml +22 -10
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_post_registration/fails_if_registration_id_already_exists.yml +20 -8
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_post_registration/is_successful.yml +38 -14
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_post_registration/is_successful_even_when_given_a_UTF8/slashed_username.yml +38 -14
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations_Configuration/_get_registration_configuration/fails_when_id_is_invalid.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations_Configuration/_get_registration_configuration/is_successful.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations_Configuration/_get_registration_configuration/results/makes_settings_available_as_key/value_pairs.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations_Configuration/_get_registration_configuration_setting/fails_when_registration_id_is_invalid.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations_Configuration/_get_registration_configuration_setting/fails_when_setting_id_is_invalid.yml +20 -10
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations_Configuration/_get_registration_configuration_setting/is_successful.yml +41 -19
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations_Configuration/_get_registration_configuration_setting/results/returns_the_value_as_a_string.yml +41 -19
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations_Configuration/_post_registration_configuration/fails_when_id_is_invalid.yml +25 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations_Configuration/_post_registration_configuration/fails_when_settings_are_invalid.yml +24 -12
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations_Configuration/_post_registration_configuration/is_successful.yml +21 -9
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations_Configuration/_post_registration_configuration/persists_the_settings.yml +88 -48
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations_Configuration/_put_registration_configuration_setting/fails_when_registration_id_is_invalid.yml +25 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations_Configuration/_put_registration_configuration_setting/fails_when_setting_id_is_invalid.yml +20 -10
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations_Configuration/_put_registration_configuration_setting/is_successful.yml +41 -19
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations_Configuration/_put_registration_configuration_setting/results/persists_the_changes.yml +61 -29
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations_LaunchHistory/_get_registration_launch_history/fails_when_registration_does_not_exist.yml +23 -15
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations_LaunchHistory/_get_registration_launch_history/is_successful.yml +23 -31
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations_LaunchHistory/_get_registration_launch_history/returns_an_array_of_registration_launch_histories.yml +23 -31
- data/spec/scorm_engine/api/endpoints/about_spec.rb +1 -1
- data/spec/scorm_engine/api/endpoints/configuration_spec.rb +82 -0
- data/spec/scorm_engine/api/endpoints/courses/configuration_spec.rb +5 -5
- data/spec/scorm_engine/api/endpoints/courses_spec.rb +6 -6
- data/spec/scorm_engine/api/endpoints/destinations_spec.rb +2 -2
- data/spec/scorm_engine/api/endpoints/dispatches_spec.rb +1 -1
- data/spec/scorm_engine/api/endpoints/registrations/configuration_spec.rb +5 -5
- data/spec/scorm_engine/api/endpoints/registrations_spec.rb +2 -2
- data/spec/scorm_engine/api/endpoints/tenants/configuration_spec.rb +126 -0
- data/spec/scorm_engine/faraday/connection_spec.rb +23 -5
- data/spec/scorm_engine/models/tenant_configuration_spec.rb +16 -0
- data/spec/support/vcr.rb +1 -0
- metadata +28 -13
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Destinations/_delete_destination/raises_ArgumentError_when_destination_id_is_missing.yml +0 -32
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_registration_count/when_dispatch_has_registrations/knows_it_s_registration_count.yml +0 -63
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6dc07764b79c2b24e72ebd15d39f1deb301eb268e2d5ac10eb1771057847e39
|
4
|
+
data.tar.gz: 747ccf82b2a4f489f9aa89fb4b9ac2831aa0771465f58dd8ff5ac314dff722a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2de6d2331954d65d497165150282dff1a0d7c604464001713ef4610b7f47e7c7f44ab4e40f17b141b6ea78173ea598b4ff636f8300462731a0538bd0fe2ffe24
|
7
|
+
data.tar.gz: 25d76985d84f9150114e2dcbf38de35fdcf5a51e397b64d6df59762fa7495dca52367a8e53e5029ced8822cefeafbc5a506cd6343dae1efcfe93851e125bcaec
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative "endpoints/about"
|
2
|
+
require_relative "endpoints/configuration"
|
2
3
|
require_relative "endpoints/courses"
|
3
4
|
require_relative "endpoints/courses/configuration"
|
4
5
|
require_relative "endpoints/courses/import"
|
@@ -8,11 +9,13 @@ require_relative "endpoints/ping"
|
|
8
9
|
require_relative "endpoints/registrations"
|
9
10
|
require_relative "endpoints/registrations/configuration"
|
10
11
|
require_relative "endpoints/registrations/launch_history"
|
12
|
+
require_relative "endpoints/tenants/configuration"
|
11
13
|
|
12
14
|
module ScormEngine
|
13
15
|
module Api
|
14
16
|
module Endpoints
|
15
17
|
include About
|
18
|
+
include Configuration
|
16
19
|
include Courses
|
17
20
|
include Courses::Configuration
|
18
21
|
include Courses::Import
|
@@ -22,6 +25,7 @@ module ScormEngine
|
|
22
25
|
include Registrations
|
23
26
|
include Registrations::Configuration
|
24
27
|
include Registrations::LaunchHistory
|
28
|
+
include Tenants::Configuration
|
25
29
|
|
26
30
|
private
|
27
31
|
|
@@ -0,0 +1,94 @@
|
|
1
|
+
module ScormEngine
|
2
|
+
module Api
|
3
|
+
module Endpoints
|
4
|
+
module Configuration
|
5
|
+
#
|
6
|
+
# Get the application settings currently configured in Engine.
|
7
|
+
#
|
8
|
+
# @see http://rustici-docs.s3.amazonaws.com/engine/20.1.x/api/apiV2.html#/appManagement/GetApplicationConfiguration
|
9
|
+
#
|
10
|
+
# @param [Hash] options
|
11
|
+
#
|
12
|
+
# @option options [Boolean] :for_tenant
|
13
|
+
# Indicates whether the configuration effective for the current tenant should be fetched.
|
14
|
+
# If false or not specified, will return configuration settings for the application in general.
|
15
|
+
#
|
16
|
+
# @return [ScormEngine::Response]
|
17
|
+
#
|
18
|
+
def get_app_configuration(options = {})
|
19
|
+
api_v2(without_tenant: !options.fetch(:for_tenant, false)) do
|
20
|
+
options.delete(:for_tenant)
|
21
|
+
|
22
|
+
response = get("appManagement/configuration", options)
|
23
|
+
|
24
|
+
result = OpenStruct.new
|
25
|
+
|
26
|
+
response.body["settingItems"].each do |setting|
|
27
|
+
result[setting["id"]] = setting["effectiveValue"]
|
28
|
+
end
|
29
|
+
|
30
|
+
Response.new(raw_response: response, result: result)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
#
|
35
|
+
# Set one or more application settings in Engine.
|
36
|
+
#
|
37
|
+
# @see http://rustici-docs.s3.amazonaws.com/engine/20.1.x/api/apiV2.html#/appManagement/SetApplicationConfiguration
|
38
|
+
#
|
39
|
+
# @param [Hash] options
|
40
|
+
#
|
41
|
+
# @option [Hash] settings
|
42
|
+
# The configuration settings to be updated.
|
43
|
+
#
|
44
|
+
# @option options [Boolean] :for_tenant
|
45
|
+
# Indicates whether the configuration should be set for the current tenant.
|
46
|
+
# If false or not specified, will update configuration settings for the application in general.
|
47
|
+
#
|
48
|
+
# @return [ScormEngine::Response]
|
49
|
+
#
|
50
|
+
def post_app_configuration(options = {})
|
51
|
+
require_options(options, :settings)
|
52
|
+
|
53
|
+
api_v2(without_tenant: !options.fetch(:for_tenant, false)) do
|
54
|
+
settings = options.delete(:settings)
|
55
|
+
|
56
|
+
body = { settings: settings.map { |k, v| { "settingId" => k, "value" => v.to_s } } }
|
57
|
+
|
58
|
+
response = post("appManagement/configuration", {}, body)
|
59
|
+
|
60
|
+
Response.new(raw_response: response)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
#
|
65
|
+
# Deletes the current value for a setting, reverting it to its default value.
|
66
|
+
#
|
67
|
+
# @see http://rustici-docs.s3.amazonaws.com/engine/20.1.x/api/apiV2.html#/appManagement/DeleteApplicationConfigurationSetting
|
68
|
+
#
|
69
|
+
# @param [Hash] options
|
70
|
+
#
|
71
|
+
# @option [String] setting_id
|
72
|
+
# The ID for the setting to be deleted.
|
73
|
+
#
|
74
|
+
# @option options [Boolean] :for_tenant
|
75
|
+
# Indicates whether the configuration should be set for the current tenant.
|
76
|
+
# If false or not specified, will update configuration settings for the application in general.
|
77
|
+
#
|
78
|
+
# @return [ScormEngine::Response]
|
79
|
+
#
|
80
|
+
def delete_app_configuration(options = {})
|
81
|
+
require_options(options, :setting_id)
|
82
|
+
|
83
|
+
api_v2(without_tenant: !options.fetch(:for_tenant, false)) do
|
84
|
+
setting_id = options.delete(:setting_id)
|
85
|
+
|
86
|
+
response = delete("appManagement/configuration/#{setting_id}")
|
87
|
+
|
88
|
+
Response.new(raw_response: response)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# TODO: Consider consolidating this and Registrations::Configuration, but only
|
2
|
+
# TODO: Consider consolidating this and [Registrations|Tenants]::Configuration, but only
|
3
3
|
# after we're sure they are really 99.9% the same in terms of functionality.
|
4
4
|
#
|
5
5
|
module ScormEngine
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# TODO: Consider consolidating this and Courses::Configuration, but only after we're
|
2
|
+
# TODO: Consider consolidating this and [Courses|Tenants]::Configuration, but only after we're
|
3
3
|
# sure they are really 99.9% the same in terms of functionality.
|
4
4
|
#
|
5
5
|
module ScormEngine
|
@@ -0,0 +1,108 @@
|
|
1
|
+
#
|
2
|
+
# TODO: Consider consolidating this and [Courses|Registrations]::Configuration, but only
|
3
|
+
# after we're sure they are really 99.9% the same in terms of functionality.
|
4
|
+
#
|
5
|
+
module ScormEngine
|
6
|
+
module Api
|
7
|
+
module Endpoints
|
8
|
+
module Tenants
|
9
|
+
module Configuration
|
10
|
+
|
11
|
+
#
|
12
|
+
# Returns the effective value of every setting at this level, as well
|
13
|
+
# as the effective value of any setting at a more specific level.
|
14
|
+
#
|
15
|
+
# @see http://rustici-docs.s3.amazonaws.com/engine/2017.1.x/api.html#tenant__configuration_get
|
16
|
+
#
|
17
|
+
# @return [ScormEngine::Models::TenantConfiguration]
|
18
|
+
#
|
19
|
+
def get_tenant_configuration
|
20
|
+
response = get("configuration")
|
21
|
+
|
22
|
+
result = response.success? ? ScormEngine::Models::TenantConfiguration.new_from_api(response.body) : nil
|
23
|
+
|
24
|
+
Response.new(raw_response: response, result: result)
|
25
|
+
end
|
26
|
+
|
27
|
+
#
|
28
|
+
# Bulk set configuration settings via POST request.
|
29
|
+
#
|
30
|
+
# @see http://rustici-docs.s3.amazonaws.com/engine/2017.1.x/api.html#tenant__configuration_post
|
31
|
+
#
|
32
|
+
# @param [Hash] options
|
33
|
+
#
|
34
|
+
# @option options [Hash] :settings
|
35
|
+
# Key/value pairs of configuration options to set.
|
36
|
+
#
|
37
|
+
# @return [ScormEngine::Response]
|
38
|
+
#
|
39
|
+
def post_tenant_configuration(options = {})
|
40
|
+
require_options(options, :settings)
|
41
|
+
|
42
|
+
options = options.dup
|
43
|
+
settings = options.delete(:settings)
|
44
|
+
|
45
|
+
body = { settings: settings.map { |k, v| { "settingId" => k, "value" => v.to_s } } }
|
46
|
+
|
47
|
+
response = post("configuration", options, body)
|
48
|
+
|
49
|
+
Response.new(raw_response: response)
|
50
|
+
end
|
51
|
+
|
52
|
+
#
|
53
|
+
# Returns the effective value for this configuration setting for the resource being configured.
|
54
|
+
#
|
55
|
+
# @see http://rustici-docs.s3.amazonaws.com/engine/2017.1.x/api.html#tenant__configuration__settingId__get
|
56
|
+
#
|
57
|
+
# @param [Hash] options
|
58
|
+
#
|
59
|
+
# @option options [String] :setting_id
|
60
|
+
# The ID of the setting to get.
|
61
|
+
#
|
62
|
+
# @return [String]
|
63
|
+
#
|
64
|
+
def get_tenant_configuration_setting(options = {})
|
65
|
+
require_options(options, :setting_id)
|
66
|
+
|
67
|
+
options = options.dup
|
68
|
+
setting_id = options.delete(:setting_id)
|
69
|
+
|
70
|
+
response = get("configuration/#{setting_id}", options)
|
71
|
+
|
72
|
+
result = response.success? ? response.body["value"] : nil
|
73
|
+
|
74
|
+
Response.new(raw_response: response, result: result)
|
75
|
+
end
|
76
|
+
|
77
|
+
#
|
78
|
+
# Sets the value for this configuration setting, for the resource being configured.
|
79
|
+
#
|
80
|
+
# @see http://rustici-docs.s3.amazonaws.com/engine/2017.1.x/api.html#tenant__configuration__settingId__put
|
81
|
+
#
|
82
|
+
# @param [Hash] options
|
83
|
+
#
|
84
|
+
# @option options [String] :setting_id
|
85
|
+
# The ID of the setting to set.
|
86
|
+
#
|
87
|
+
# @option options [String] :value ("")
|
88
|
+
# The value of the setting to set.
|
89
|
+
#
|
90
|
+
# @return [ScormEngine::Response]
|
91
|
+
#
|
92
|
+
def put_tenant_configuration_setting(options = {})
|
93
|
+
require_options(options, :setting_id)
|
94
|
+
|
95
|
+
options = options.dup
|
96
|
+
setting_id = options.delete(:setting_id)
|
97
|
+
|
98
|
+
body = { value: options.delete(:value).to_s }
|
99
|
+
|
100
|
+
response = put("configuration/#{setting_id}", options, body)
|
101
|
+
|
102
|
+
Response.new(raw_response: response)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -10,8 +10,9 @@ module ScormEngine
|
|
10
10
|
end
|
11
11
|
|
12
12
|
class Configuration
|
13
|
-
# http://rustici-docs.s3.amazonaws.com/engine/2017.1.x/api.html
|
14
|
-
|
13
|
+
# Legacy v1 API: http://rustici-docs.s3.amazonaws.com/engine/2017.1.x/api.html
|
14
|
+
# Latest v2 API: https://rustici-docs.s3.amazonaws.com/engine/20.1.x/api/apiV2.html
|
15
|
+
attr_accessor :protocol, :host, :path_prefix, :v2_path_prefix
|
15
16
|
|
16
17
|
# http://rustici-docs.s3.amazonaws.com/engine/2017.1.x/Architecture-API.html#api-authentication
|
17
18
|
attr_accessor :username, :password
|
@@ -28,6 +29,7 @@ module ScormEngine
|
|
28
29
|
@protocol = ENV.fetch("SCORM_ENGINE_PROTOCOL", "https")
|
29
30
|
@host = ENV["SCORM_ENGINE_HOST"]
|
30
31
|
@path_prefix = ENV.fetch("SCORM_ENGINE_PATH_PREFIX", "/ScormEngineInterface/api/v1/")
|
32
|
+
@v2_path_prefix = ENV.fetch("SCORM_ENGINE_V2_PATH_PREFIX", "/ScormEngineInterface/api/v2/")
|
31
33
|
|
32
34
|
@username = ENV["SCORM_ENGINE_USERNAME"]
|
33
35
|
@password = ENV["SCORM_ENGINE_PASSWORD"]
|
@@ -5,18 +5,24 @@ module ScormEngine
|
|
5
5
|
module Faraday
|
6
6
|
module Connection
|
7
7
|
|
8
|
-
def base_uri
|
8
|
+
def base_uri(version: 1)
|
9
9
|
uri = URI("")
|
10
10
|
uri.scheme = ScormEngine.configuration.protocol
|
11
11
|
uri.host = ScormEngine.configuration.host
|
12
|
-
|
12
|
+
|
13
|
+
uri.path = if version == 2
|
14
|
+
ScormEngine.configuration.v2_path_prefix
|
15
|
+
else
|
16
|
+
ScormEngine.configuration.path_prefix
|
17
|
+
end
|
18
|
+
|
13
19
|
URI(uri.to_s) # convert URI::Generic to URI:HTTPS
|
14
20
|
end
|
15
21
|
|
16
22
|
private
|
17
23
|
|
18
|
-
def connection
|
19
|
-
@connection ||= ::Faraday.new(url: base_uri.to_s) do |faraday|
|
24
|
+
def connection(version: 1)
|
25
|
+
@connection ||= ::Faraday.new(url: base_uri(version: version).to_s) do |faraday|
|
20
26
|
faraday.headers["User-Agent"] = "ScormEngine Ruby Gem #{ScormEngine::VERSION}"
|
21
27
|
|
22
28
|
faraday.basic_auth(ScormEngine.configuration.username, ScormEngine.configuration.password)
|
@@ -17,15 +17,30 @@ module ScormEngine
|
|
17
17
|
request(:delete, path, options)
|
18
18
|
end
|
19
19
|
|
20
|
+
def api_v2(without_tenant: false)
|
21
|
+
@api_version = 2
|
22
|
+
@without_tenant = without_tenant
|
23
|
+
|
24
|
+
yield
|
25
|
+
ensure
|
26
|
+
@api_version = 1
|
27
|
+
end
|
28
|
+
|
20
29
|
private
|
21
30
|
|
22
31
|
def request(method, path, options, body = nil)
|
23
|
-
|
24
|
-
|
32
|
+
connection(version: @api_version).send(method) do |request|
|
33
|
+
if @api_version == 2
|
34
|
+
request.headers["engineTenantName"] = tenant unless @without_tenant
|
35
|
+
else
|
36
|
+
# "more" pagination urls are fully or relatively qualified
|
37
|
+
unless path =~ %r{\Ahttps?://} || path.start_with?(base_uri.path)
|
38
|
+
path = "#{tenant}/#{path}"
|
39
|
+
end
|
40
|
+
end
|
25
41
|
|
26
|
-
|
42
|
+
options = coerce_options(options)
|
27
43
|
|
28
|
-
connection.send(method) do |request|
|
29
44
|
case method
|
30
45
|
when :get, :delete
|
31
46
|
request.url(path, options)
|
data/lib/scorm_engine/models.rb
CHANGED
@@ -12,3 +12,4 @@ require_relative "models/registration_activity_detail"
|
|
12
12
|
require_relative "models/registration_configuration"
|
13
13
|
require_relative "models/registration_launch_history"
|
14
14
|
require_relative "models/registration_runtime_interaction"
|
15
|
+
require_relative "models/tenant_configuration"
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module ScormEngine
|
2
|
+
module Models
|
3
|
+
class TenantConfiguration < Base
|
4
|
+
# @attr
|
5
|
+
#
|
6
|
+
# @return [Hash]
|
7
|
+
attr_accessor :settings
|
8
|
+
|
9
|
+
def self.new_from_api(options = {})
|
10
|
+
this = new
|
11
|
+
|
12
|
+
this.options = options.dup
|
13
|
+
this.settings = get_settings_from_api(options)
|
14
|
+
this
|
15
|
+
end
|
16
|
+
|
17
|
+
#
|
18
|
+
# Extract and normalize the settings from the API options.
|
19
|
+
#
|
20
|
+
# @param [Hash] options
|
21
|
+
# The API options hash
|
22
|
+
#
|
23
|
+
# @return [Hash]
|
24
|
+
# A hash of key/value pairs.
|
25
|
+
#
|
26
|
+
def self.get_settings_from_api(options = {})
|
27
|
+
options["configurationItems"].reduce({}) do |m, o|
|
28
|
+
m[o["id"]] = o["value"]
|
29
|
+
m
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/scorm_engine/version.rb
CHANGED
@@ -7,32 +7,41 @@ http_interactions:
|
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
9
9
|
headers:
|
10
|
-
Content-Type:
|
11
|
-
- application/json
|
12
10
|
User-Agent:
|
13
|
-
- ScormEngine Ruby Gem 0.2
|
11
|
+
- ScormEngine Ruby Gem 0.8.2
|
14
12
|
Authorization:
|
15
13
|
- Basic <BASIC_AUTH>
|
16
14
|
response:
|
17
15
|
status:
|
18
16
|
code: 200
|
19
|
-
message:
|
17
|
+
message: OK
|
20
18
|
headers:
|
21
19
|
content-type:
|
22
20
|
- application/json
|
23
|
-
date:
|
24
|
-
- Wed, 15 Aug 2018 23:29:16 GMT
|
25
|
-
server:
|
26
|
-
- nginx
|
27
|
-
vary:
|
28
|
-
- Accept-Encoding
|
29
21
|
content-length:
|
30
|
-
- '
|
22
|
+
- '94'
|
31
23
|
connection:
|
32
|
-
-
|
24
|
+
- close
|
25
|
+
date:
|
26
|
+
- Tue, 10 Nov 2020 22:57:06 GMT
|
27
|
+
p3p:
|
28
|
+
- CP="NOI"
|
29
|
+
server:
|
30
|
+
- Apache
|
31
|
+
x-xss-protection:
|
32
|
+
- 1; mode=block
|
33
|
+
x-cache:
|
34
|
+
- Miss from cloudfront
|
35
|
+
via:
|
36
|
+
- 1.1 ed42e29cddf5cc10b8ba8ca7b99004ce.cloudfront.net (CloudFront)
|
37
|
+
x-amz-cf-pop:
|
38
|
+
- SLC50-C1
|
39
|
+
x-amz-cf-id:
|
40
|
+
- CvnNxRrtMzgd98IPVo64kWtvyXuDHHB-DgN_VwUiKYHJWAss1NSAUw==
|
33
41
|
body:
|
34
|
-
encoding:
|
35
|
-
string: '{"version":"
|
42
|
+
encoding: UTF-8
|
43
|
+
string: '{"version":"20.1.12.336","platform":"Java","distribution":"Rustici
|
44
|
+
Engine + Rustici Dispatch"}'
|
36
45
|
http_version:
|
37
|
-
recorded_at:
|
46
|
+
recorded_at: Tue, 10 Nov 2020 22:57:07 GMT
|
38
47
|
recorded_with: VCR 4.0.0
|