Class: ShiftNote::DaysOfWeekShifts

Inherits:
Object
  • Object
show all
Defined in:
lib/shiftnote/days_of_week_shifts.rb

Overview

The days of the week, their shifts.

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ DaysOfWeekShifts

Returns a new instance of DaysOfWeekShifts.


3
4
5
# File 'lib/shiftnote/days_of_week_shifts.rb', line 3

def initialize(data)
  @data = data
end

Instance Method Details

#daysArray<DaysOfWeekShift>

The days in this week, whether working or not.

Returns:


9
10
11
12
13
14
15
# File 'lib/shiftnote/days_of_week_shifts.rb', line 9

def days
  dayz = []
  @data.each do |e|
    dayz.push ShiftNote::DaysOfWeekShift.new(e)
  end
  dayz
end

#rawJSON

Returns the raw data returned by ShiftNote.

Returns:

  • (JSON)

    the raw data returned by ShiftNote


27
28
29
# File 'lib/shiftnote/days_of_week_shifts.rb', line 27

def raw
  @data
end

#working_daysArray<DaysOfWeekShift>

Returns only the days this employee is working.

Returns:


18
19
20
21
22
23
24
# File 'lib/shiftnote/days_of_week_shifts.rb', line 18

def working_days
  dayz = []
  @data.each do |e|
    dayz.push ShiftNote::DaysOfWeekShift.new(e) unless e['Shifts'].empty?
  end
  dayz
end