Class: ShiftNote::ScheduleThisWeek

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

Overview

The schedule for this week.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ ScheduleThisWeek

Returns a new instance of ScheduleThisWeek.


3
4
5
6
7
8
9
10
11
# File 'lib/shiftnote/schedule_this_week.rb', line 3

def initialize(data)
  @raw = data
  @start_date = Time.parse(data['StartDate'])
  @end_date = Time.parse(data['EndDate'])
  @hours = data['Hours']
  @cost = data['Cost']
  @shifts = data['Shifts']
  @schedule = ShiftNote::DaysOfWeekShifts.new(data['DaysOfWeekShifts'])
end

Instance Attribute Details

#costFloat (readonly)

The cost is simply hours * rate.

Returns:

  • (Float)

    the amount of pay the employee will receive


24
25
26
# File 'lib/shiftnote/schedule_this_week.rb', line 24

def cost
  @cost
end

#end_dateTime (readonly)

Returns the end date of the schedule.

Returns:

  • (Time)

    the end date of the schedule.


17
18
19
# File 'lib/shiftnote/schedule_this_week.rb', line 17

def end_date
  @end_date
end

#hoursFloat (readonly)

Returns the total hours this employee is working this schedule.

Returns:

  • (Float)

    the total hours this employee is working this schedule


20
21
22
# File 'lib/shiftnote/schedule_this_week.rb', line 20

def hours
  @hours
end

#rawJSON (readonly)

Returns the raw data returned by ShiftNote.

Returns:

  • (JSON)

    the raw data returned by ShiftNote.


33
34
35
# File 'lib/shiftnote/schedule_this_week.rb', line 33

def raw
  @raw
end

#scheduleShiftNote::DaysOfWeekShifts (readonly)

Returns the schedule for this week.

Returns:


30
31
32
# File 'lib/shiftnote/schedule_this_week.rb', line 30

def schedule
  @schedule
end

#shiftsFloat (readonly)

Returns the amount of shifts this person has this week.

Returns:

  • (Float)

    the amount of shifts this person has this week.


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

def shifts
  @shifts
end

#start_dateTime (readonly)

Returns the start date of the schedule.

Returns:

  • (Time)

    the start date of the schedule.


14
15
16
# File 'lib/shiftnote/schedule_this_week.rb', line 14

def start_date
  @start_date
end