Class: ShiftNote::Shift
- Inherits:
-
Object
- Object
- ShiftNote::Shift
- Defined in:
- lib/shiftnote/shift.rb
Overview
A shift, on the schedule. Woah!
Instance Attribute Summary collapse
-
#close ⇒ true, false
readonly
I don’t know what this means.
-
#cost ⇒ Float
readonly
The cost of this shift for the company.
-
#employee ⇒ String
readonly
The name of the employee working this Shift.
-
#employee_id ⇒ Integer
readonly
The employee working this shift’s ID.
-
#hours ⇒ Float
readonly
The duration of this shift in hours.
-
#internal_location ⇒ String
readonly
The internal location of this shift.
-
#note ⇒ String
readonly
I don’t know what this means.
-
#on_call ⇒ true, false
readonly
I don’t know what this means.
-
#open ⇒ true, false
readonly
I don’t know what this means.
-
#position ⇒ String
readonly
The position this employee is working.
-
#position_color ⇒ String
readonly
Probably used on the website.
-
#raw ⇒ JSON
readonly
The raw data returned by ShiftNote.
-
#schedule_id ⇒ Integer
readonly
The shift’s schedule’s ID.
-
#schedule_name ⇒ String
readonly
The shift’s schedule’s name.
-
#schedule_status_id ⇒ Integer
readonly
I have absolutely no idea what the IDs mean.
-
#shift_date ⇒ Time
readonly
The date of this shift.
-
#shift_id ⇒ Integer
readonly
The shift’s ID.
-
#time_in ⇒ Time
readonly
The time this employee should clock in.
-
#time_out ⇒ Time
readonly
The time this employee should clock out.
-
#volume ⇒ true, false
readonly
I don’t know what this means.
Instance Method Summary collapse
-
#hide_end_times? ⇒ true, false
I wonder what happens when this is true.
-
#initialize(data) ⇒ Shift
constructor
A new instance of Shift.
-
#pending_manager_approval? ⇒ true, false
If the shift is waiting for the manager to approve it.
-
#pending_pickup? ⇒ true, false
This is true if this shift is dropped.
-
#pending_swap? ⇒ true, false
When a shift is swapped with someone, it waits for them to accept or deny.
-
#pending_swap_manager_approval? ⇒ true, false
When the shift swap is approved, the manager needs to approve it.
-
#release(employee = 0, reason = nil) ⇒ Object
Releases the shift to an employee.
Constructor Details
#initialize(data) ⇒ Shift
Returns a new instance of Shift.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# 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 |
Instance Attribute Details
#close ⇒ true, false (readonly)
I don’t know what this means.
76 77 78 |
# File 'lib/shiftnote/shift.rb', line 76 def close @close end |
#cost ⇒ Float (readonly)
Returns the cost of this shift for the company.
94 95 96 |
# File 'lib/shiftnote/shift.rb', line 94 def cost @cost end |
#employee ⇒ String (readonly)
Returns the name of the employee working this Shift.
48 49 50 |
# File 'lib/shiftnote/shift.rb', line 48 def employee @employee end |
#employee_id ⇒ Integer (readonly)
Returns the employee working this shift’s ID.
45 46 47 |
# File 'lib/shiftnote/shift.rb', line 45 def employee_id @employee_id end |
#hours ⇒ Float (readonly)
Returns the duration of this shift in hours.
91 92 93 |
# File 'lib/shiftnote/shift.rb', line 91 def hours @hours end |
#internal_location ⇒ String (readonly)
Returns the internal location of this shift.
67 68 69 |
# File 'lib/shiftnote/shift.rb', line 67 def internal_location @internal_location end |
#note ⇒ String (readonly)
I don’t know what this means.
88 89 90 |
# File 'lib/shiftnote/shift.rb', line 88 def note @note end |
#on_call ⇒ true, false (readonly)
I don’t know what this means.
80 81 82 |
# File 'lib/shiftnote/shift.rb', line 80 def on_call @on_call end |
#open ⇒ true, false (readonly)
I don’t know what this means. Do they open? Is the shift open? What! It’s true or false though.
72 73 74 |
# File 'lib/shiftnote/shift.rb', line 72 def open @open end |
#position ⇒ String (readonly)
Returns the position this employee is working.
60 61 62 |
# File 'lib/shiftnote/shift.rb', line 60 def position @position end |
#position_color ⇒ String (readonly)
Probably used on the website.
64 65 66 |
# File 'lib/shiftnote/shift.rb', line 64 def position_color @position_color end |
#raw ⇒ JSON (readonly)
Returns the raw data returned by ShiftNote.
130 131 132 |
# File 'lib/shiftnote/shift.rb', line 130 def raw @raw end |
#schedule_id ⇒ Integer (readonly)
Returns the shift’s schedule’s ID.
32 33 34 |
# File 'lib/shiftnote/shift.rb', line 32 def schedule_id @schedule_id end |
#schedule_name ⇒ String (readonly)
Returns the shift’s schedule’s name.
35 36 37 |
# File 'lib/shiftnote/shift.rb', line 35 def schedule_name @schedule_name end |
#schedule_status_id ⇒ Integer (readonly)
I have absolutely no idea what the IDs mean.
39 40 41 |
# File 'lib/shiftnote/shift.rb', line 39 def schedule_status_id @schedule_status_id end |
#shift_date ⇒ Time (readonly)
Returns the date of this shift.
51 52 53 |
# File 'lib/shiftnote/shift.rb', line 51 def shift_date @shift_date end |
#shift_id ⇒ Integer (readonly)
Returns the shift’s ID.
42 43 44 |
# File 'lib/shiftnote/shift.rb', line 42 def shift_id @shift_id end |
#time_in ⇒ Time (readonly)
Returns the time this employee should clock in.
54 55 56 |
# File 'lib/shiftnote/shift.rb', line 54 def time_in @time_in end |
#time_out ⇒ Time (readonly)
Returns the time this employee should clock out.
57 58 59 |
# File 'lib/shiftnote/shift.rb', line 57 def time_out @time_out end |
#volume ⇒ true, false (readonly)
I don’t know what this means.
84 85 86 |
# File 'lib/shiftnote/shift.rb', line 84 def volume @volume end |
Instance Method Details
#hide_end_times? ⇒ true, false
I wonder what happens when this is true. Hopefully it doesn’t break.
125 126 127 |
# File 'lib/shiftnote/shift.rb', line 125 def hide_end_times? @hide_end_times end |
#pending_manager_approval? ⇒ true, false
If the shift is waiting for the manager to approve it.
105 106 107 |
# File 'lib/shiftnote/shift.rb', line 105 def pending_manager_approval? @is_pending_manager_approval end |
#pending_pickup? ⇒ true, false
This is true if this shift is dropped. This is false if it’s been picked up or never was dropped.
99 100 101 |
# File 'lib/shiftnote/shift.rb', line 99 def pending_pickup? @is_pending_pickup end |
#pending_swap? ⇒ true, false
When a shift is swapped with someone, it waits for them to accept or deny. Until that happens, this is true.
112 113 114 |
# File 'lib/shiftnote/shift.rb', line 112 def pending_swap? @is_pending_swap end |
#pending_swap_manager_approval? ⇒ true, false
When the shift swap is approved, the manager needs to approve it. Until this happens, this is true.
119 120 121 |
# File 'lib/shiftnote/shift.rb', line 119 def pending_swap_manager_approval? @is_pending_swap_manager_approval end |
#release(employee = 0, reason = nil) ⇒ Object
Releases the shift to an employee.
135 136 137 138 139 140 141 142 143 |
# 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 |