Class: VitableConnect::Resources::Employers

Inherits:
Object
  • Object
show all
Defined in:
lib/vitable_connect/resources/employers.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Employers

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 Employers.

Parameters:



181
182
183
# File 'lib/vitable_connect/resources/employers.rb', line 181

def initialize(client:)
  @client = client
end

Instance Method Details

#create(address:, ein:, email:, legal_name:, name:, phone_number: nil, reference_id: nil, request_options: {}) ⇒ VitableConnect::Models::EmployerResponse

Creates a new employer for the authenticated organization. Requires employer name, legal name, EIN, email, and address information. Returns the created employer with its assigned ID.

Parameters:

  • address (VitableConnect::Models::EmployerCreateParams::Address)

    Employer address

  • ein (String)

    Employer Identification Number (format: XX-XXXXXXX)

  • email (String)

    Email address for billing and communications

  • legal_name (String)

    Legal business name

  • name (String)

    Employer display name

  • phone_number (String, nil)

    Employer phone number (10-digit US format, e.g. 5551234567)

  • reference_id (String, nil)

    External reference ID for this employer

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

Returns:

See Also:



31
32
33
34
35
36
37
38
39
40
# File 'lib/vitable_connect/resources/employers.rb', line 31

def create(params)
  parsed, options = VitableConnect::EmployerCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/employers",
    body: parsed,
    model: VitableConnect::EmployerResponse,
    options: options
  )
end

#create_benefit_eligibility_policy(employer_id, classification:, waiting_period:, request_options: {}) ⇒ VitableConnect::Models::BenefitEligibilityPolicyResponse

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

Creates a benefit eligibility policy for the specified employer.

Parameters:

  • employer_id (String)

    Unique employer identifier (empr_*)

  • classification (String)

    Which employee classifications are eligible. One of: full_time, part_time, all

  • waiting_period (String)

    Waiting period before eligibility. One of: first_of_following_month, 30_days, 60

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

Returns:

See Also:



110
111
112
113
114
115
116
117
118
119
# File 'lib/vitable_connect/resources/employers.rb', line 110

def create_benefit_eligibility_policy(employer_id, params)
  parsed, options = VitableConnect::EmployerCreateBenefitEligibilityPolicyParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v1/employers/%1$s/benefit-eligibility-policies", employer_id],
    body: parsed,
    model: VitableConnect::BenefitEligibilityPolicyResponse,
    options: options
  )
end

#list(limit: nil, page: nil, request_options: {}) ⇒ VitableConnect::Internal::PageNumberPage<VitableConnect::Models::Employer>

Retrieves a paginated list of all employers belonging to the authenticated organization. Results are sorted by creation date (newest first) and paginated using page and limit parameters.

Parameters:

  • 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:



78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/vitable_connect/resources/employers.rb', line 78

def list(params = {})
  parsed, options = VitableConnect::EmployerListParams.dump_request(params)
  query = VitableConnect::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "v1/employers",
    query: query,
    page: VitableConnect::Internal::PageNumberPage,
    model: VitableConnect::Employer,
    options: options
  )
end

#list_employees(employer_id, limit: nil, page: nil, request_options: {}) ⇒ VitableConnect::Internal::PageNumberPage<VitableConnect::Models::Employee>

Retrieves a paginated list of all employees for a specific employer. Results are paginated using page and limit parameters. Each employee includes payroll deductions from the most recent statement period. When a new deduction statement is generated, previous period deductions are replaced.

Parameters:

  • employer_id (String)

    Unique employer identifier (empr_*)

  • 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:



139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/vitable_connect/resources/employers.rb', line 139

def list_employees(employer_id, params = {})
  parsed, options = VitableConnect::EmployerListEmployeesParams.dump_request(params)
  query = VitableConnect::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["v1/employers/%1$s/employees", employer_id],
    query: query,
    page: VitableConnect::Internal::PageNumberPage,
    model: VitableConnect::Employee,
    options: options
  )
end

#retrieve(employer_id, request_options: {}) ⇒ VitableConnect::Models::EmployerResponse

Retrieves detailed information for a specific employer by ID. The employer must belong to the authenticated organization.

Parameters:

Returns:

See Also:



54
55
56
57
58
59
60
61
# File 'lib/vitable_connect/resources/employers.rb', line 54

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

#submit_census_sync(employer_id, employees:, request_options: {}) ⇒ VitableConnect::Models::EmployerSubmitCensusSyncResponse

Submits a census sync payload for the specified employer. The employees in the payload will be queued for processing. Returns an accepted response with the timestamp of acceptance.

Parameters:

Returns:

See Also:



167
168
169
170
171
172
173
174
175
176
# File 'lib/vitable_connect/resources/employers.rb', line 167

def submit_census_sync(employer_id, params)
  parsed, options = VitableConnect::EmployerSubmitCensusSyncParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v1/employers/%1$s/census-sync", employer_id],
    body: parsed,
    model: VitableConnect::Models::EmployerSubmitCensusSyncResponse,
    options: options
  )
end