class ShiftNote::DaysOfWeekShift
A specific day of a schedule.
Attributes
date[R]
@return [Time] the day
raw[R]
@return [JSON] the raw data returned by ShiftNote
.
Public Class Methods
new(data)
click to toggle source
# File lib/shiftnote/days_of_week_shift.rb, line 3 def initialize(data) @raw = data @date = Time.parse(data['ShiftDate']) @raw_shifts = data['Shifts'] end
Public Instance Methods
amount_of_shifts()
click to toggle source
@return [Integer] the amount shifts this employee is working on this day.
# File lib/shiftnote/days_of_week_shift.rb, line 22 def amount_of_shifts @raw_shifts.length end
first_shift()
click to toggle source
@return [Shift] the first shift this employee is working on this day.
# File lib/shiftnote/days_of_week_shift.rb, line 27 def first_shift ShiftNote::Shift.new(@raw_shifts.first) end
shifts()
click to toggle source
@return [Array<Shift>] the shifts this employee is working on this day.
# File lib/shiftnote/days_of_week_shift.rb, line 13 def shifts shifts = [] @raw_shifts.each do |e| shifts.push ShiftNote::Shift.new(e) end shifts end