Class: VitableConnect::Resources::Employees

Inherits:
Object
  • Object
show all
Defined in:
lib/vitable_connect/resources/employees.rb,
sig/vitable_connect/resources/employees.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Employees

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Employees.

Parameters:



106
107
108
# File 'lib/vitable_connect/resources/employees.rb', line 106

def initialize(client:)
  @client = client
end

Instance Method Details

#list_enrollments(employee_id, limit: nil, page: nil, request_options: {}) ⇒ VitableConnect::Internal::PageNumberPage<VitableConnect::Models::Enrollment>

Retrieves a paginated list of benefit enrollments for an employee.

Parameters:

  • employee_id (String)

    Unique employee identifier (empl_*)

  • limit (Integer)

    Items per page (default: 20, max: 100)

  • page (Integer)

    Page number (default: 1)

  • request_options (VitableConnect::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/vitable_connect/resources/employees.rb', line 90

def list_enrollments(employee_id, params = {})
  parsed, options = VitableConnect::EmployeeListEnrollmentsParams.dump_request(params)
  query = VitableConnect::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["v1/employees/%1$s/enrollments", employee_id],
    query: query,
    page: VitableConnect::Internal::PageNumberPage,
    model: VitableConnect::Enrollment,
    options: options
  )
end

#retrieve(employee_id, request_options: {}) ⇒ VitableConnect::Models::EmployeeRetrieveResponse

Retrieves detailed information for a specific employee by ID. Returns employee details including personal information, employment status, classification and compensation-type effective dates, compensation type, and payroll deductions from the most recent statement period. Deductions reflect a snapshot of the current period and are replaced when a new statement is generated.

Parameters:

Returns:

See Also:



21
22
23
24
25
26
27
28
# File 'lib/vitable_connect/resources/employees.rb', line 21

def retrieve(employee_id, params = {})
  @client.request(
    method: :get,
    path: ["v1/employees/%1$s", employee_id],
    model: VitableConnect::Models::EmployeeRetrieveResponse,
    options: params[:request_options]
  )
end

#update(employee_id, effective_date:, address: nil, compensation_type: nil, email: nil, employee_class: nil, gender: nil, phone: nil, start_date: nil, request_options: {}) ⇒ VitableConnect::Models::EmployeeUpdateResponse

Some parameter documentations has been truncated, see Models::EmployeeUpdateParams for more details.

Updates employee personal, contact, address, and employment fields. This endpoint currently supports email, phone, gender, address, employee_class, start_date, and compensation_type. effective_date is required and applies to employee_class and compensation_type when those fields are included in the request.

Parameters:

Returns:

See Also:



64
65
66
67
68
69
70
71
72
73
# File 'lib/vitable_connect/resources/employees.rb', line 64

def update(employee_id, params)
  parsed, options = VitableConnect::EmployeeUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["v1/employees/%1$s", employee_id],
    body: parsed,
    model: VitableConnect::Models::EmployeeUpdateResponse,
    options: options
  )
end