Class: Gusto::Employees::TaxSetupClient
- Inherits:
-
Object
- Object
- Gusto::Employees::TaxSetupClient
- 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::TaxSetupClient 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::TaxSetupClient
22 23 24 |
# File 'lib/fern_gusto/employees/tax_setup/client.rb', line 22 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Gusto::RequestClient (readonly)
17 18 19 |
# File 'lib/fern_gusto/employees/tax_setup/client.rb', line 17 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”)
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/fern_gusto/employees/tax_setup/client.rb', line 38 def get_federal_taxes(employee_uuid:, request_options: nil) 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 |
#get_state_taxes(employee_uuid:, request_options: nil) ⇒ Object
api.employees.tax_setup.get_state_taxes(employee_uuid: “employee_uuid”)
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/fern_gusto/employees/tax_setup/client.rb', line 144 def get_state_taxes(employee_uuid:, request_options: nil) 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 |
#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
)
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/fern_gusto/employees/tax_setup/client.rb', line 93 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) 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 |
#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” }] }] }])
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/fern_gusto/employees/tax_setup/client.rb', line 189 def update_state_taxes(employee_uuid:, states:, 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 || {}), 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 |