Class: ShiftNote::Employee

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

Overview

An employee.

Direct Known Subclasses

User

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: nil) ⇒ Employee

Returns a new instance of Employee.


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

def initialize(id: nil)
  @id = id
end

Instance Attribute Details

#idInteger (readonly)

Returns the ID of the employee.

Returns:

  • (Integer)

    the ID of the employee


8
9
10
# File 'lib/shiftnote/employee.rb', line 8

def id
  @id
end

Instance Method Details

#delete(convert_shifts = false) ⇒ Object

Deletes this employee Quote from the site

This employee may have scheduled shifts.
You can choose to have these assigned shifts converted to house shifts if they are on a published schedule, and template shifts if they are on a draft schedule.
If [false], you will have to manually reassign or delete any shifts assigned to this employee.
true

will convert assigned shifts to house and template shifts.

Parameters:

  • convert_shifts (true, false) (defaults to: false)

    whether to convert these shifts


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

def delete(convert_shifts = false)
  cooki = cookie
  puts cooki
  data = {
    'EmployeeID' => @id,
    'ConvertShifts' => convert_shifts,
    '_' => Time.now.to_i * 1000
  }
end