Class: Cadenya::Types::AgentScheduleSpec_Schedule

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(calendars: nil, intervals: nil, timezone: nil) ⇒ AgentScheduleSpec_Schedule

Returns a new instance of AgentScheduleSpec_Schedule.



546
547
548
549
550
# File 'lib/cadenya/types.rb', line 546

def initialize(calendars: nil, intervals: nil, timezone: nil)
  @calendars = calendars
  @intervals = intervals
  @timezone = timezone
end

Instance Attribute Details

#calendarsObject (readonly)

Returns the value of attribute calendars.



544
545
546
# File 'lib/cadenya/types.rb', line 544

def calendars
  @calendars
end

#intervalsObject (readonly)

Returns the value of attribute intervals.



544
545
546
# File 'lib/cadenya/types.rb', line 544

def intervals
  @intervals
end

#timezoneObject (readonly)

Returns the value of attribute timezone.



544
545
546
# File 'lib/cadenya/types.rb', line 544

def timezone
  @timezone
end

Class Method Details

.from_json(data) ⇒ Object



552
553
554
555
556
557
558
# File 'lib/cadenya/types.rb', line 552

def self.from_json(data)
  new(
    calendars: data["calendars"].nil? ? nil : (data["calendars"]).map { |item| Types::Schedule_Calendar.from_json(item) },
    intervals: data["intervals"].nil? ? nil : (data["intervals"]).map { |item| Types::Schedule_Interval.from_json(item) },
    timezone: data["timezone"],
  )
end

Instance Method Details

#to_hObject



560
561
562
563
564
565
566
# File 'lib/cadenya/types.rb', line 560

def to_h
  {
    calendars: Util.plain(@calendars),
    intervals: Util.plain(@intervals),
    timezone: Util.plain(@timezone),
  }.reject { |_k, v| v.nil? }
end