Class: Agendrix::Nethris::Services::EmployeeService
- Inherits:
-
Object
- Object
- Agendrix::Nethris::Services::EmployeeService
- Defined in:
- lib/agendrix/nethris/services/employee_service.rb
Instance Method Summary collapse
- #all(options = {}) ⇒ Object
- #get(id, options = {}) ⇒ Object
-
#initialize(client) ⇒ EmployeeService
constructor
A new instance of EmployeeService.
Constructor Details
#initialize(client) ⇒ EmployeeService
Returns a new instance of EmployeeService.
5 6 7 |
# File 'lib/agendrix/nethris/services/employee_service.rb', line 5 def initialize(client) @client = client end |
Instance Method Details
#all(options = {}) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/agendrix/nethris/services/employee_service.rb', line 9 def all( = {}) parameters = .merge( OutputFields: .fetch(:fields, all_fields) ) CollectionProxy.new(@client, Nethris::Employee, parameters) end |
#get(id, options = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/agendrix/nethris/services/employee_service.rb', line 17 def get(id, = {}) parameters = .merge( fields: .fetch(:fields, all_fields) ) data = @client.send_request( type: Request::Type::GET, entity_type: Nethris::Employee.type, id: id, parameters: parameters ) data = data["Employee"]["data"][0] data["EMPL_ID"] = id # Manually set id because API doesn't return it Nethris::Employee.new(@client, data) end |