Class: Gusto::Employees::AsyncTaxSetupClient
- Inherits:
-
Object
- Object
- Gusto::Employees::AsyncTaxSetupClient
- Defined in:
- lib/fern_gusto/employees/tax_setup/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#get_federal_taxes(employee_uuid:, request_options: nil) ⇒ Object
api.employees.tax_setup.get_federal_taxes(employee_uuid: “employee_uuid”).
-
#get_state_taxes(employee_uuid:, request_options: nil) ⇒ Object
api.employees.tax_setup.get_state_taxes(employee_uuid: “employee_uuid”).
- #initialize(request_client:) ⇒ Gusto::Employees::AsyncTaxSetupClient constructor
-
#update_federal_taxes(employee_uuid:, version:, filing_status: nil, extra_withholding: nil, two_jobs: nil, dependents_amount: nil, other_income: nil, deductions: nil, w4data_type: nil, request_options: nil) ⇒ Object
).
-
#update_state_taxes(employee_uuid:, states:, request_options: nil) ⇒ Object
api.employees.tax_setup.update_state_taxes(employee_uuid: “employee_uuid”, states: [{ state: “CA”, questions: [{ key: “filing_status”, answers: [{ value: “M”, valid_from: “2010-01-01” }] }, { key: “withholding_allowance”, answers: [{ value: “value”, valid_from: “2010-01-01” }] }, { key: “additional_withholding”, answers: [{ value: “25.0”, valid_from: “2010-01-01” }] }, { key: “file_new_hire_report”, answers: [{ value: “value”, valid_from: “2010-01-01” }] }] }]).
Constructor Details
#initialize(request_client:) ⇒ Gusto::Employees::AsyncTaxSetupClient
221 222 223 |
# File 'lib/fern_gusto/employees/tax_setup/client.rb', line 221 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Gusto::AsyncRequestClient (readonly)
216 217 218 |
# File 'lib/fern_gusto/employees/tax_setup/client.rb', line 216 def request_client @request_client end |
Instance Method Details
#get_federal_taxes(employee_uuid:, request_options: nil) ⇒ Object
api.employees.tax_setup.get_federal_taxes(employee_uuid: “employee_uuid”)
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/fern_gusto/employees/tax_setup/client.rb', line 237 def get_federal_taxes(employee_uuid:, request_options: nil) Async do response = @request_client.conn.get 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 unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/v1/employees/#{employee_uuid}/federal_taxes" end Gusto::EmployeeTaxSetup::EmployeeFederalTax.from_json(json_object: response.body) end end |
#get_state_taxes(employee_uuid:, request_options: nil) ⇒ Object
api.employees.tax_setup.get_state_taxes(employee_uuid: “employee_uuid”)
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 |
# File 'lib/fern_gusto/employees/tax_setup/client.rb', line 347 def get_state_taxes(employee_uuid:, request_options: nil) Async do response = @request_client.conn.get 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 unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/v1/employees/#{employee_uuid}/state_taxes" end parsed_json = JSON.parse(response.body) parsed_json&.map do | item | item = item.to_json Gusto::EmployeeTaxSetup::EmployeeStateTax.from_json(json_object: item) end end end |
#update_federal_taxes(employee_uuid:, version:, filing_status: nil, extra_withholding: nil, two_jobs: nil, dependents_amount: nil, other_income: nil, deductions: nil, w4data_type: nil, request_options: nil) ⇒ Object
)
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
# File 'lib/fern_gusto/employees/tax_setup/client.rb', line 294 def update_federal_taxes(employee_uuid:, version:, filing_status: nil, extra_withholding: nil, two_jobs: nil, dependents_amount: nil, other_income: nil, deductions: nil, w4data_type: 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, filing_status: filing_status, extra_withholding: extra_withholding, two_jobs: two_jobs, dependents_amount: dependents_amount, other_income: other_income, deductions: deductions, w4_data_type: w4data_type }.compact req.url "#{@request_client.get_url(request_options: )}/v1/employees/#{employee_uuid}/federal_taxes" end Gusto::EmployeeTaxSetup::EmployeeFederalTax.from_json(json_object: response.body) end end |
#update_state_taxes(employee_uuid:, states:, request_options: nil) ⇒ Object
api.employees.tax_setup.update_state_taxes(employee_uuid: “employee_uuid”, states: [{ state: “CA”, questions: [{ key: “filing_status”, answers: [{ value: “M”, valid_from: “2010-01-01” }] }, { key: “withholding_allowance”, answers: [{ value: “value”, valid_from: “2010-01-01” }] }, { key: “additional_withholding”, answers: [{ value: “25.0”, valid_from: “2010-01-01” }] }, { key: “file_new_hire_report”, answers: [{ value: “value”, valid_from: “2010-01-01” }] }] }])
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
# File 'lib/fern_gusto/employees/tax_setup/client.rb', line 394 def update_state_taxes(employee_uuid:, states:, 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 || {}), states: states }.compact req.url "#{@request_client.get_url(request_options: )}/v1/employees/#{employee_uuid}/state_taxes" end parsed_json = JSON.parse(response.body) parsed_json&.map do | item | item = item.to_json Gusto::EmployeeTaxSetup::EmployeeStateTax.from_json(json_object: item) end end end |