Class: Gusto::Companies::EmployeesClient
- Inherits:
-
Object
- Object
- Gusto::Companies::EmployeesClient
- 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::EmployeesClient 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::EmployeesClient
24 25 26 |
# File 'lib/fern_gusto/companies/employees/client.rb', line 24 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Gusto::RequestClient (readonly)
19 20 21 |
# File 'lib/fern_gusto/companies/employees/client.rb', line 19 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
)
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/fern_gusto/companies/employees/client.rb', line 58 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) 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 |
#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” } })
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/fern_gusto/companies/employees/client.rb', line 114 def create_historical(company_uuid:, request:, request_options: nil) 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 |
#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”)
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/fern_gusto/companies/employees/client.rb', line 172 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) 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 |