Class: FedenaSdk::EmployeeAttendance

Inherits:
Object
  • Object
show all
Defined in:
lib/fedena_sdk/employee_attendance.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attendance_dateObject

Returns the value of attribute attendance_date.



3
4
5
# File 'lib/fedena_sdk/employee_attendance.rb', line 3

def attendance_date
  @attendance_date
end

#employee_numberObject

Returns the value of attribute employee_number.



3
4
5
# File 'lib/fedena_sdk/employee_attendance.rb', line 3

def employee_number
  @employee_number
end

#half_dayObject

Returns the value of attribute half_day.



3
4
5
# File 'lib/fedena_sdk/employee_attendance.rb', line 3

def half_day
  @half_day
end

#leave_typeObject

Returns the value of attribute leave_type.



3
4
5
# File 'lib/fedena_sdk/employee_attendance.rb', line 3

def leave_type
  @leave_type
end

#reasonObject

Returns the value of attribute reason.



3
4
5
# File 'lib/fedena_sdk/employee_attendance.rb', line 3

def reason
  @reason
end

Class Method Details

.create(*args) ⇒ Object



26
27
28
29
# File 'lib/fedena_sdk/employee_attendance.rb', line 26

def self.create(*args)
  attendance = EmployeeAttendance.new *args
  attendance.save
end

.destroy(employee_number, date) ⇒ Object



31
32
33
34
35
36
# File 'lib/fedena_sdk/employee_attendance.rb', line 31

def self.destroy(employee_number, date)
  url = "/api/employee_attendances/#{employee_number}"
  params = { date: date }
  options = { params: params }
  request(:delete, url, options)
end

Instance Method Details

#attributes_hashObject

Overrides



39
40
41
# File 'lib/fedena_sdk/employee_attendance.rb', line 39

def attributes_hash
  super.merge(leave_type_code: @leave_type)
end

#employee_leave_types(_query) ⇒ Object



13
14
15
16
# File 'lib/fedena_sdk/employee_attendance.rb', line 13

def employee_leave_types(_query)
  url = '/api/employee_leave_types'
  get(url)
end

#saveObject



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

def save
  url = '/api/employee_attendances'
  params = attributes_hash
  options = { params: params }
  hash = post(url, options)
  new hash['attendance_detail']['attendance']
end

#search(_query) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fedena_sdk/employee_attendance.rb', line 5

def search(_query)
  url = '/api/employee_attendances'
  hash = get(url)
  hash['attendance_detail']['attendance'].map do |attendance_hash|
    new attendance_hash
  end
end