Module: JustimmoClient::Employee
- Extended by:
- Utils
- Defined in:
- lib/justimmo_client/employee.rb
Overview
Public employee query interface
Class Method Summary collapse
-
.detail(id) ⇒ Object
Retrieve detailed information about a single employee.
-
.ids ⇒ Array<Integer>
An array of employee IDs.
-
.list ⇒ Array<Object>
Retrieve a list of employee data.
Methods included from Utils
api, autoload_dir, model, representer, request, versioned_api
Class Method Details
.detail(id) ⇒ Object
Retrieve detailed information about a single employee.
23 24 25 26 27 28 29 |
# File 'lib/justimmo_client/employee.rb', line 23 def detail(id) xml_response = request(:employee).detail(id) model = model(:employee).new representer(:employee).new(model).from_xml(xml_response) rescue JustimmoClient::RetrievalFailed nil end |
.ids ⇒ Array<Integer>
Returns An array of employee IDs.
32 33 34 35 36 37 |
# File 'lib/justimmo_client/employee.rb', line 32 def ids json_response = request(:employee).ids ::JSON.parse(json_response).map(&:to_i) rescue JustimmoClient::RetrievalFailed [] end |
.list ⇒ Array<Object>
Retrieve a list of employee data.
12 13 14 15 16 17 18 |
# File 'lib/justimmo_client/employee.rb', line 12 def list xml_response = request(:employee).list model = Struct.new(:employees).new representer(:employee_list).new(model).from_xml(xml_response).employees rescue JustimmoClient::RetrievalFailed [] end |