Class: VitableConnect::Resources::Employers
- Inherits:
-
Object
- Object
- VitableConnect::Resources::Employers
- Defined in:
- lib/vitable_connect/resources/employers.rb
Instance Method Summary collapse
-
#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.
-
#initialize(client:) ⇒ Employers
constructor
private
A new instance of Employers.
-
#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.
-
#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.
-
#retrieve(employer_id, request_options: {}) ⇒ VitableConnect::Models::EmployerResponse
Retrieves detailed information for a specific employer by ID.
-
#submit_census_sync(employer_id, employees:, request_options: {}) ⇒ VitableConnect::Models::EmployerSubmitCensusSyncResponse
Submits a census sync payload for the specified employer.
-
#update_settings(employer_id, pay_frequency:, request_options: {}) ⇒ VitableConnect::Models::EmployerUpdateSettingsResponse
Some parameter documentations has been truncated, see Models::EmployerUpdateSettingsParams for more details.
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.
179 180 181 |
# File 'lib/vitable_connect/resources/employers.rb', line 179 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.
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/vitable_connect/resources/employers.rb', line 31 def create(params) parsed, = VitableConnect::EmployerCreateParams.dump_request(params) @client.request( method: :post, path: "v1/employers", body: parsed, model: VitableConnect::EmployerResponse, 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.
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, = 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: ) 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.
109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/vitable_connect/resources/employers.rb', line 109 def list_employees(employer_id, params = {}) parsed, = 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: ) 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.
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.
137 138 139 140 141 142 143 144 145 146 |
# File 'lib/vitable_connect/resources/employers.rb', line 137 def submit_census_sync(employer_id, params) parsed, = 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: ) end |
#update_settings(employer_id, pay_frequency:, request_options: {}) ⇒ VitableConnect::Models::EmployerUpdateSettingsResponse
Some parameter documentations has been truncated, see Models::EmployerUpdateSettingsParams for more details.
Updates configuration settings for a specific employer. The employer must belong to the authenticated organization.
165 166 167 168 169 170 171 172 173 174 |
# File 'lib/vitable_connect/resources/employers.rb', line 165 def update_settings(employer_id, params) parsed, = VitableConnect::EmployerUpdateSettingsParams.dump_request(params) @client.request( method: :put, path: ["v1/employers/%1$s/settings", employer_id], body: parsed, model: VitableConnect::Models::EmployerUpdateSettingsResponse, options: ) end |