Class: ScormEngine::Models::RegistrationRuntimeInteraction
- Defined in:
- lib/scorm_engine/models/registration_runtime_interaction.rb
Instance Attribute Summary collapse
-
#correct_responses ⇒ Object
TODO: Not sure we want this to be settable.
-
#description ⇒ Object
TODO: Not sure we want this to be settable.
-
#id ⇒ Object
TODO: Not sure we want this to be settable.
-
#latency ⇒ Object
TODO: Not sure we want this to be settable.
-
#learner_response ⇒ Object
TODO: Not sure we want this to be settable.
-
#result ⇒ Object
TODO: Not sure we want this to be settable.
-
#timestamp ⇒ Object
TODO: Not sure we want this to be settable.
-
#type ⇒ Object
TODO: Not sure we want this to be settable.
-
#weighting ⇒ Object
TODO: Not sure we want this to be settable.
Class Method Summary collapse
- .get_description_from_api(options) ⇒ Object
- .get_learner_response_from_api(options) ⇒ Object
- .get_timestamp_from_api(options) ⇒ Object
- .new_from_api(options = {}) ⇒ Object
Instance Method Summary collapse
Methods inherited from Base
Instance Attribute Details
#correct_responses ⇒ 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.
7 8 9 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 7 def correct_responses @correct_responses end |
#description ⇒ 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.
7 8 9 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 7 def description @description 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.
7 8 9 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 7 def id @id end |
#latency ⇒ 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.
7 8 9 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 7 def latency @latency end |
#learner_response ⇒ 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.
7 8 9 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 7 def learner_response @learner_response end |
#result ⇒ 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.
7 8 9 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 7 def result @result end |
#timestamp ⇒ 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.
7 8 9 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 7 def end |
#type ⇒ 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.
7 8 9 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 7 def type @type end |
#weighting ⇒ 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.
7 8 9 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 7 def weighting @weighting end |
Class Method Details
.get_description_from_api(options) ⇒ Object
27 28 29 30 31 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 27 def self.get_description_from_api() description = ["description"].to_s.gsub(/\s+/, " ").strip description = nil if description.empty? || description == "null" description end |
.get_learner_response_from_api(options) ⇒ Object
33 34 35 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 33 def self.get_learner_response_from_api() ["learnerResponse"].to_s.gsub(/\s+/, " ").strip end |
.get_timestamp_from_api(options) ⇒ Object
37 38 39 40 41 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 37 def self.() = ["timestampUtc"] return if .nil? || .empty? Time.parse() end |
.new_from_api(options = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 10 def self.new_from_api( = {}) this = new this. = .dup this.id = ["id"] this.type = ["type"] this.description = get_description_from_api() this. = () this.correct_responses = ["correctResponses"] this.learner_response = get_learner_response_from_api() this.result = ["result"] this.weighting = ["weighting"].to_f this.latency = ["latency"] this end |
Instance Method Details
#latency_in_seconds ⇒ Object
43 44 45 46 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 43 def latency_in_seconds h, m, s = latency.split(":") h.to_i * 3600 + m.to_i * 60 + s.to_i end |