Class: Gusto::Companies::AsyncEmployeesClient
- Inherits:
-
Object
- Object
- Gusto::Companies::AsyncEmployeesClient
- Defined in:
- lib/fern_gusto/companies/employees/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#create(company_id:, first_name:, middle_initial: nil, last_name:, preferred_first_name: nil, date_of_birth: nil, email: nil, ssn: nil, self_onboarding: nil, request_options: nil) ⇒ Object
).
-
#create_historical(company_uuid:, request:, request_options: nil) ⇒ Object
api.companies.employees.create_historical(company_uuid: “company_uuid”, request: { first_name: “Soren”, middle_initial: “A”, last_name: “Kierkegaard”, preferred_first_name: “Angel”, date_of_birth: “1995-05-05”, ssn: “ssn”, work_address: { location_uuid: “1da85d35-1910-4d5e-8e94-39e8cdfe8c9a” }, home_address: { street1: “300 3rd Street”, city: “San Francisco”, state: “CA”, zip: “zip” }, termination: { effective_date: “2022-09-15” }, job: { hire_date: “2018-05-09” }, employee_state_taxes: { wc_covered: true, wc_class_code: “wc_class_code” } }).
- #initialize(request_client:) ⇒ Gusto::Companies::AsyncEmployeesClient constructor
-
#update_historical(company_uuid:, version:, first_name:, middle_initial: nil, last_name:, preferred_first_name: nil, date_of_birth:, ssn:, work_address:, home_address:, termination:, job:, employee_state_taxes: nil, request_options: nil) ⇒ Object
api.companies.employees.update_historical(company_uuid: “company_uuid”).
Constructor Details
#initialize(request_client:) ⇒ Gusto::Companies::AsyncEmployeesClient
200 201 202 |
# File 'lib/fern_gusto/companies/employees/client.rb', line 200 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Gusto::AsyncRequestClient (readonly)
195 196 197 |
# File 'lib/fern_gusto/companies/employees/client.rb', line 195 def request_client @request_client end |
Instance Method Details
#create(company_id:, first_name:, middle_initial: nil, last_name:, preferred_first_name: nil, date_of_birth: nil, email: nil, ssn: nil, self_onboarding: nil, request_options: nil) ⇒ Object
)
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/fern_gusto/companies/employees/client.rb', line 234 def create(company_id:, first_name:, middle_initial: nil, last_name:, preferred_first_name: nil, date_of_birth: nil, email: nil, ssn: nil, self_onboarding: nil, request_options: nil) Async do response = @request_client.conn.post do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.token.nil? req.headers["Authorization"] = .token end unless &.gusto_api_version.nil? req.headers["X-Gusto-API-Version"] = .gusto_api_version end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), first_name: first_name, middle_initial: middle_initial, last_name: last_name, preferred_first_name: preferred_first_name, date_of_birth: date_of_birth, email: email, ssn: ssn, self_onboarding: self_onboarding }.compact req.url "#{@request_client.get_url(request_options: )}/v1/companies/#{company_id}/employees" end Gusto::Employees::Employee.from_json(json_object: response.body) end end |
#create_historical(company_uuid:, request:, request_options: nil) ⇒ Object
api.companies.employees.create_historical(company_uuid: “company_uuid”, request: { first_name: “Soren”, middle_initial: “A”, last_name: “Kierkegaard”, preferred_first_name: “Angel”, date_of_birth: “1995-05-05”, ssn: “ssn”, work_address: { location_uuid: “1da85d35-1910-4d5e-8e94-39e8cdfe8c9a” }, home_address: { street1: “300 3rd Street”, city: “San Francisco”, state: “CA”, zip: “zip” }, termination: { effective_date: “2022-09-15” }, job: { hire_date: “2018-05-09” }, employee_state_taxes: { wc_covered: true, wc_class_code: “wc_class_code” } })
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
# File 'lib/fern_gusto/companies/employees/client.rb', line 292 def create_historical(company_uuid:, request:, request_options: nil) Async do response = @request_client.conn.post do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.token.nil? req.headers["Authorization"] = .token end unless &.gusto_api_version.nil? req.headers["X-Gusto-API-Version"] = .gusto_api_version end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(request || {}), **(&.additional_body_parameters || {}) }.compact req.url "#{@request_client.get_url(request_options: )}/v1/companies/#{company_uuid}/historical_employees" end Gusto::Employees::Employee.from_json(json_object: response.body) end end |
#update_historical(company_uuid:, version:, first_name:, middle_initial: nil, last_name:, preferred_first_name: nil, date_of_birth:, ssn:, work_address:, home_address:, termination:, job:, employee_state_taxes: nil, request_options: nil) ⇒ Object
api.companies.employees.update_historical(company_uuid: “company_uuid”)
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
# File 'lib/fern_gusto/companies/employees/client.rb', line 352 def update_historical(company_uuid:, version:, first_name:, middle_initial: nil, last_name:, preferred_first_name: nil, date_of_birth:, ssn:, work_address:, home_address:, termination:, job:, employee_state_taxes: nil, request_options: nil) Async do response = @request_client.conn.put do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.token.nil? req.headers["Authorization"] = .token end unless &.gusto_api_version.nil? req.headers["X-Gusto-API-Version"] = .gusto_api_version end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), version: version, first_name: first_name, middle_initial: middle_initial, last_name: last_name, preferred_first_name: preferred_first_name, date_of_birth: date_of_birth, ssn: ssn, work_address: work_address, home_address: home_address, termination: termination, job: job, employee_state_taxes: employee_state_taxes }.compact req.url "#{@request_client.get_url(request_options: )}/v1/companies/#{company_uuid}/historical_employees" end Gusto::Employees::Employee.from_json(json_object: response.body) end end |