Class: ScormEngine::Models::RegistrationRuntimeInteraction
- Inherits:
-
Object
- Object
- 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.
-
#options ⇒ Object
writeonly
Sets the attribute options.
-
#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
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.
10 11 12 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 10 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.
10 11 12 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 10 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.
10 11 12 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 10 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.
10 11 12 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 10 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.
10 11 12 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 10 def learner_response @learner_response end |
#options=(value) ⇒ Object
Sets the attribute options
4 5 6 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 4 def (value) @options = value 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.
10 11 12 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 10 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.
10 11 12 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 10 def @timestamp 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.
10 11 12 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 10 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.
10 11 12 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 10 def weighting @weighting end |
Class Method Details
.get_description_from_api(options) ⇒ Object
30 31 32 33 34 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 30 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
36 37 38 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 36 def self.get_learner_response_from_api() ["learnerResponse"].to_s.gsub(/\s+/, " ").strip end |
.get_timestamp_from_api(options) ⇒ Object
40 41 42 43 44 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 40 def self.() = ["timestampUtc"] return if .nil? || .empty? Time.parse() end |
.new_from_api(options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 13 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
46 47 48 49 |
# File 'lib/scorm_engine/models/registration_runtime_interaction.rb', line 46 def latency_in_seconds h, m, s = latency.split(":") h.to_i * 3600 + m.to_i * 60 + s.to_i end |