Class: EmployeeParser
Instance Attribute Summary
Attributes inherited from BaseParser
#json_response
Instance Method Summary
collapse
Methods inherited from BaseParser
#fields, #initialize
Constructor Details
This class inherits a constructor from BaseParser
Instance Method Details
#employee ⇒ Object
4
5
6
|
# File 'lib/bob/parsers/employee_parser.rb', line 4
def employee
Models::Employee.new(json_response)
end
|
#employees ⇒ Object
8
9
10
|
# File 'lib/bob/parsers/employee_parser.rb', line 8
def employees
json_response['employees'].map { |attributes| Models::Employee.new(attributes) }
end
|
#managers ⇒ Object
12
13
14
15
16
|
# File 'lib/bob/parsers/employee_parser.rb', line 12
def managers
json_response['employees']
.select { |employee| employee['work']['isManager'] }
.map { |attributes| Models::Employee.new(attributes) }
end
|
#starters_on(date) ⇒ Object
18
19
20
21
22
|
# File 'lib/bob/parsers/employee_parser.rb', line 18
def starters_on(date)
json_response['employees']
.select { |employee| Date.parse(employee['work']['startDate']) == date }
.map { |attributes| Models::Employee.new(attributes) }
end
|