class ShiftNote::Shift
A shift, on the schedule. Woah!
Attributes
I don't know what this means. @return [true, false]
@return [Float] the cost of this shift for the company
@return [String] the name of the employee working this Shift
.
@return [Integer] the employee working this shift's ID.
@return [Float] the duration of this shift in hours.
@return [String] the internal location of this shift.
I don't know what this means. @return [String]
I don't know what this means. @return [true, false]
I don't know what this means. Do they open? Is the shift open? What! It's true or false though. @return [true, false]
@return [String] the position this employee is working.
Probably used on the website. @return [String] the color of this position this employee is working.
@return [JSON] the raw data returned by ShiftNote
@return [Integer] the shift's schedule's ID.
@return [String] the shift's schedule's name
I have absolutely no idea what the IDs mean. @return [Integer] the shift's schedule's status ID.
@return [Time] the date of this shift.
@return [Integer] the shift's ID.
@return [Time] the time this employee should clock in.
@return [Time] the time this employee should clock out.
I don't know what this means. @return [true, false]
Public Class Methods
# File lib/shiftnote/shift.rb, line 3 def initialize(data) @raw = data @schedule_id = data['ScheduleId'] @schedule_name = data['ScheduleName'] @schedule_status_id = data['ScheduleStatusId'] @shift_id = data['ShiftId'] @employee_id = data['EmployeeId'] @employee = data['Employee'] @shift_date = Time.parse(data['ShiftDate']) @time_in = Time.parse(data['TimeIn']) @time_out = Time.parse(data['TimeOut']) @position = data['Position'] @position_color = data['PositionColor'] @internal_location = data['InternalLocation'] @open = data['Open'] @close = data['Close'] @on_call = data['OnCall'] @volume = data['Volume'] @note = data['Note'] @hours = data['Hours'] @cost = data['Cost'] @is_pending_pickup = data['IsPendingPickUp'] @is_pending_manager_approval = data['IsPendingManagerApproval'] @is_pending_swap = data['IsPendingSwap'] @is_pending_swap_manager_approval = data['IsPendingSwapManagerApproval'] @hide_end_times = data['HideEndTimes'] end
Public Instance Methods
I wonder what happens when this is true. Hopefully it doesn't break. @return [true, false] to hide the end time of the shift.
# File lib/shiftnote/shift.rb, line 125 def hide_end_times? @hide_end_times end
If the shift is waiting for the manager to approve it. @return [true, false] whether this shift is pending manager approval
# File lib/shiftnote/shift.rb, line 105 def pending_manager_approval? @is_pending_manager_approval end
This is true if this shift is dropped. This is false if it's been picked up or never was dropped. @return [true, false] whether this shift is pending pickup
# File lib/shiftnote/shift.rb, line 99 def pending_pickup? @is_pending_pickup end
When a shift is swapped with someone, it waits for them to accept or deny. Until that happens, this is true. @return [true, false] is the shift is pending swap.
# File lib/shiftnote/shift.rb, line 112 def pending_swap? @is_pending_swap end
When the shift swap is approved, the manager needs to approve it. Until this happens, this is true. @return [true, false] is the shift is pending swap manager approval.
# File lib/shiftnote/shift.rb, line 119 def pending_swap_manager_approval? @is_pending_swap_manager_approval end
Releases the shift to an employee. @param [Integer] the employee ID of the employee to drop this to, leave blank for everyone. @param [String] the reason for dropping this shift.
# File lib/shiftnote/shift.rb, line 135 def release(employee = 0, reason = nil) data = { "ShiftID" => shift_id, "ScheduleID" => schedule_id, "EmployeeId" => employee, "Reason" => reason, "X-Requested-With" => "XMLHttpRequest" } end