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.
-
#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.
-
#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.
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.
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.
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 |
#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.
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, = 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: ) 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.
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, = 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.
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, = 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 |