Class: ScormEngine::Models::DispatchRegistrationCount
- Defined in:
- lib/scorm_engine/models/dispatch_registration_count.rb
Instance Attribute Summary collapse
-
#id ⇒ String
The external identification of this dispatch.
-
#last_reset_at ⇒ DateTime
The date and time of the last count reset, if any.
-
#registration_count ⇒ Integer
The registration count for this dispatch.
Class Method Summary collapse
-
.get_last_reset_time(options = {}) ⇒ Time
Extract and normalize the last reset datetime from the API options.
- .new_from_api(options = {}) ⇒ Object
Methods inherited from Base
Instance Attribute Details
#id ⇒ String
The external identification of this dispatch.
9 10 11 |
# File 'lib/scorm_engine/models/dispatch_registration_count.rb', line 9 def id @id end |
#last_reset_at ⇒ DateTime
The date and time of the last count reset, if any.
19 20 21 |
# File 'lib/scorm_engine/models/dispatch_registration_count.rb', line 19 def last_reset_at @last_reset_at end |
#registration_count ⇒ Integer
The registration count for this dispatch.
14 15 16 |
# File 'lib/scorm_engine/models/dispatch_registration_count.rb', line 14 def registration_count @registration_count end |
Class Method Details
.get_last_reset_time(options = {}) ⇒ Time
Extract and normalize the last reset datetime from the API options.
41 42 43 44 45 46 |
# File 'lib/scorm_engine/models/dispatch_registration_count.rb', line 41 def self.get_last_reset_time( = {}) time = ["lastResetTime"] return if time.nil? || time == "none" Time.parse(time) end |
.new_from_api(options = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/scorm_engine/models/dispatch_registration_count.rb', line 21 def self.new_from_api( = {}) this = new this. = .dup this.id = ["id"] this.registration_count = ["registrationCount"].to_i this.last_reset_at = get_last_reset_time() this end |