Class: ScormEngine::Models::RegistrationActivityDetail
- Inherits:
-
Object
- Object
- ScormEngine::Models::RegistrationActivityDetail
- Defined in:
- lib/scorm_engine/models/registration_activity_detail.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
TODO: Not sure we want this to be settable.
-
#id ⇒ Object
TODO: Not sure we want this to be settable.
-
#options ⇒ Object
writeonly
Sets the attribute options.
-
#runtime_interactions ⇒ Object
TODO: Not sure we want this to be settable.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#children ⇒ 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/registration_activity_detail.rb', line 10 def children @children end |
#id ⇒ 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/registration_activity_detail.rb', line 10 def id @id end |
#options=(value) ⇒ Object
Sets the attribute options
4 5 6 |
# File 'lib/scorm_engine/models/registration_activity_detail.rb', line 4 def (value) @options = value end |
#runtime_interactions ⇒ 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/registration_activity_detail.rb', line 10 def runtime_interactions @runtime_interactions end |
Class Method Details
.get_runtime_interactions_from_api(options) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/scorm_engine/models/registration_activity_detail.rb', line 29 def self.get_runtime_interactions_from_api() .fetch("runtime", {}) .fetch("runtimeInteractions", []) .map { |e| RegistrationRuntimeInteraction.new_from_api(e) } end |
.new_from_api(options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/scorm_engine/models/registration_activity_detail.rb', line 12 def self.new_from_api( = {}) this = new this. = .dup this.id = ["id"] this.runtime_interactions = get_runtime_interactions_from_api() this.children = .fetch("children", []).map { |e| new_from_api(e) } this end |
Instance Method Details
#all_runtime_interactions ⇒ Object
25 26 27 |
# File 'lib/scorm_engine/models/registration_activity_detail.rb', line 25 def all_runtime_interactions (runtime_interactions + children.map(&:all_runtime_interactions)).flatten end |