Module: WOTC::Client::Employees
- Included in:
- WOTC::Client
- Defined in:
- lib/wotc/client/employees.rb
Overview
Defines methods related to employees.
Instance Method Summary collapse
-
#certified_employees(company_id = nil) ⇒ Object
Get employees with certified WOTC status.
-
#create_employee(options = {}) ⇒ Object
Create an employee.
-
#employee(employee_id) ⇒ Object
Get a single employee.
-
#employee_auto_fill_wotc_url(employee_id, redirect = nil) ⇒ Object
Generate an auto fill WOTC url.
-
#employee_wotc_info(employee_id) ⇒ Object
Get wotc info for specific employee.
-
#employee_wotc_status(employee_id) ⇒ Object
Get employee’s WOTC status.
-
#employees(options = {}) ⇒ Object
Fetch all employees.
-
#update_employee(employee_id, options = {}) ⇒ Object
Update an employee.
Instance Method Details
#certified_employees(company_id = nil) ⇒ Object
Get employees with certified WOTC status
48 49 50 51 52 53 54 |
# File 'lib/wotc/client/employees.rb', line 48 def certified_employees(company_id=nil) if company_id.nil? get("employees/wotc/certified") else get("employees/wotc/certified?company_id=#{company_id}") end end |
#create_employee(options = {}) ⇒ Object
Create an employee
21 22 23 |
# File 'lib/wotc/client/employees.rb', line 21 def create_employee(={}) post("employees", ) end |
#employee(employee_id) ⇒ Object
Get a single employee
11 12 13 |
# File 'lib/wotc/client/employees.rb', line 11 def employee(employee_id) get("employees/#{employee_id}") end |
#employee_auto_fill_wotc_url(employee_id, redirect = nil) ⇒ Object
Generate an auto fill WOTC url
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/wotc/client/employees.rb', line 36 def employee_auto_fill_wotc_url(employee_id, redirect=nil) uri = URI.parse(redirect) rescue false result = if uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS) get("employees/#{employee_id}/wotc/url?redirect=#{redirect}") else get("employees/#{employee_id}/wotc/url") end return result.body["url"] end |
#employee_wotc_info(employee_id) ⇒ Object
Get wotc info for specific employee
31 32 33 |
# File 'lib/wotc/client/employees.rb', line 31 def employee_wotc_info(employee_id) get("employees/#{employee_id}/wotc") end |
#employee_wotc_status(employee_id) ⇒ Object
Get employee’s WOTC status
26 27 28 |
# File 'lib/wotc/client/employees.rb', line 26 def employee_wotc_status(employee_id) get("employees#{employee_id}/wotc/status") end |
#employees(options = {}) ⇒ Object
Fetch all employees
6 7 8 |
# File 'lib/wotc/client/employees.rb', line 6 def employees(={}) paginate("employees", ) end |
#update_employee(employee_id, options = {}) ⇒ Object
Update an employee
16 17 18 |
# File 'lib/wotc/client/employees.rb', line 16 def update_employee(employee_id, ={}) put("employees/#{employee_id}", ) end |