class Comet::ScheduleConfig

ScheduleConfig is a typed class wrapper around the underlying Comet Server API data structure.

def clear

def clear
  @frequency_type = 0
  @seconds_past = 0
  @offset = 0
  @from_time = Comet::HourSchedConfig.new
  @to_time = Comet::HourSchedConfig.new
  @days_select = Comet::DaysOfWeekConfig.new
  @random_delay_secs = 0
  @unknown_json_fields = {}
end

def from_hash(obj)

Parameters:
  • obj (Hash) -- The complete object as a Ruby hash
def from_hash(obj)
  raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
  obj.each do |k, v|
    case k
    when 'FrequencyType'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
      @frequency_type = v
    when 'SecondsPast'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
      @seconds_past = v
    when 'Offset'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
      @offset = v
    when 'RestrictRuntime'
      @restrict_runtime = v
    when 'FromTime'
      @from_time = Comet::HourSchedConfig.new
      @from_time.from_hash(v)
    when 'ToTime'
      @to_time = Comet::HourSchedConfig.new
      @to_time.from_hash(v)
    when 'RestrictDays'
      @restrict_days = v
    when 'DaysSelect'
      @days_select = Comet::DaysOfWeekConfig.new
      @days_select.from_hash(v)
    when 'RandomDelaySecs'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
      @random_delay_secs = v
    else
      @unknown_json_fields[k] = v
    end
  end
end

def from_json(json_string)

Parameters:
  • json_string (String) -- The complete object in JSON format
def from_json(json_string)
  raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
  from_hash(JSON.parse(json_string))
end

def initialize

def initialize
  clear
end

def to_h

Returns:
  • (Hash) - The complete object as a Ruby hash
def to_h
  to_hash
end

def to_hash

Returns:
  • (Hash) - The complete object as a Ruby hash
def to_hash
  ret = {}
  ret['FrequencyType'] = @frequency_type
  ret['SecondsPast'] = @seconds_past
  unless @offset.nil?
    ret['Offset'] = @offset
  end
  ret['RestrictRuntime'] = @restrict_runtime
  ret['FromTime'] = @from_time
  ret['ToTime'] = @to_time
  ret['RestrictDays'] = @restrict_days
  ret['DaysSelect'] = @days_select
  unless @random_delay_secs.nil?
    ret['RandomDelaySecs'] = @random_delay_secs
  end
  @unknown_json_fields.each do |k, v|
    ret[k] = v
  end
  ret
end

def to_json(options = {})

Returns:
  • (String) - The complete object as a JSON string
def to_json(options = {})
  to_hash.to_json(options)
end