Class: Cadenya::Types::Schedule_Calendar

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(second: nil, minute: nil, hour: nil, day_of_month: nil, month: nil, day_of_week: nil, comment: nil) ⇒ Schedule_Calendar

Returns a new instance of Schedule_Calendar.



4940
4941
4942
4943
4944
4945
4946
4947
4948
# File 'lib/cadenya/types.rb', line 4940

def initialize(second: nil, minute: nil, hour: nil, day_of_month: nil, month: nil, day_of_week: nil, comment: nil)
  @second = second
  @minute = minute
  @hour = hour
  @day_of_month = day_of_month
  @month = month
  @day_of_week = day_of_week
  @comment = comment
end

Instance Attribute Details

#commentObject (readonly)

Returns the value of attribute comment.



4938
4939
4940
# File 'lib/cadenya/types.rb', line 4938

def comment
  @comment
end

#day_of_monthObject (readonly)

Returns the value of attribute day_of_month.



4938
4939
4940
# File 'lib/cadenya/types.rb', line 4938

def day_of_month
  @day_of_month
end

#day_of_weekObject (readonly)

Returns the value of attribute day_of_week.



4938
4939
4940
# File 'lib/cadenya/types.rb', line 4938

def day_of_week
  @day_of_week
end

#hourObject (readonly)

Returns the value of attribute hour.



4938
4939
4940
# File 'lib/cadenya/types.rb', line 4938

def hour
  @hour
end

#minuteObject (readonly)

Returns the value of attribute minute.



4938
4939
4940
# File 'lib/cadenya/types.rb', line 4938

def minute
  @minute
end

#monthObject (readonly)

Returns the value of attribute month.



4938
4939
4940
# File 'lib/cadenya/types.rb', line 4938

def month
  @month
end

#secondObject (readonly)

Returns the value of attribute second.



4938
4939
4940
# File 'lib/cadenya/types.rb', line 4938

def second
  @second
end

Class Method Details

.from_json(data) ⇒ Object



4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
# File 'lib/cadenya/types.rb', line 4950

def self.from_json(data)
  new(
    second: data["second"].nil? ? nil : (data["second"]).map { |item| Types::Schedule_Range.from_json(item) },
    minute: data["minute"].nil? ? nil : (data["minute"]).map { |item| Types::Schedule_Range.from_json(item) },
    hour: data["hour"].nil? ? nil : (data["hour"]).map { |item| Types::Schedule_Range.from_json(item) },
    day_of_month: data["dayOfMonth"].nil? ? nil : (data["dayOfMonth"]).map { |item| Types::Schedule_Range.from_json(item) },
    month: data["month"].nil? ? nil : (data["month"]).map { |item| Types::Schedule_Range.from_json(item) },
    day_of_week: data["dayOfWeek"].nil? ? nil : (data["dayOfWeek"]).map { |item| Types::Schedule_Range.from_json(item) },
    comment: data["comment"],
  )
end

Instance Method Details

#to_hObject



4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
# File 'lib/cadenya/types.rb', line 4962

def to_h
  {
    second: Util.plain(@second),
    minute: Util.plain(@minute),
    hour: Util.plain(@hour),
    day_of_month: Util.plain(@day_of_month),
    month: Util.plain(@month),
    day_of_week: Util.plain(@day_of_week),
    comment: Util.plain(@comment),
  }.reject { |_k, v| v.nil? }
end