class ScormEngine::Models::DispatchRegistrationCount

Attributes

id[RW]

@attr The external identification of this dispatch. @return [String]

last_reset_at[RW]

@attr The date and time of the last count reset, if any. @return [DateTime]

registration_count[RW]

@attr The registration count for this dispatch. @return [Integer]

Public Class Methods

get_last_reset_time(options = {}) click to toggle source

Extract and normalize the last reset datetime from the API options.

@param [Hash] options

The API options hash

@return [Time]

a date/time or nil if undefined.
# File lib/scorm_engine/models/dispatch_registration_count.rb, line 41
def self.get_last_reset_time(options = {})
  time = options["lastResetTime"]
  return if time.nil? || time == "none"

  Time.parse(time)
end
new_from_api(options = {}) click to toggle source
# File lib/scorm_engine/models/dispatch_registration_count.rb, line 21
def self.new_from_api(options = {})
  this = new

  this.options = options.dup
  this.id = options["id"]
  this.registration_count = options["registrationCount"].to_i
  this.last_reset_at = get_last_reset_time(options)

  this
end