Class: ScormEngine::Models::CourseConfiguration
- Inherits:
-
Object
- Object
- ScormEngine::Models::CourseConfiguration
- Defined in:
- lib/scorm_engine/models/course_configuration.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
writeonly
Sets the attribute options.
-
#settings ⇒ Object
TODO: Not sure we want this to be settable.
Class Method Summary collapse
-
.get_settings_from_api(options = {}) ⇒ Hash
Extract and normalize the settings from the API options.
- .new_from_api(options = {}) ⇒ Object
Instance Attribute Details
#options=(value) ⇒ Object
Sets the attribute options
4 5 6 |
# File 'lib/scorm_engine/models/course_configuration.rb', line 4 def (value) @options = value end |
#settings ⇒ Object
TODO: Not sure we want this to be settable. Will depend on how we go about creating/updating records. For now it makes it easier to create instances from API options hash.
10 11 12 |
# File 'lib/scorm_engine/models/course_configuration.rb', line 10 def settings @settings end |
Class Method Details
.get_settings_from_api(options = {}) ⇒ Hash
Extract and normalize the settings from the API options.
29 30 31 32 33 34 |
# File 'lib/scorm_engine/models/course_configuration.rb', line 29 def self.get_settings_from_api( = {}) ["configurationItems"].reduce({}) do |m, o| m[o["id"]] = o["value"] m end end |
.new_from_api(options = {}) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/scorm_engine/models/course_configuration.rb', line 12 def self.new_from_api( = {}) this = new this. = .dup this.settings = get_settings_from_api() this end |