Class: GustoEmbedded::Payrolls
- Inherits:
-
Object
- Object
- GustoEmbedded::Payrolls
- Extended by:
- T::Sig
- Defined in:
- lib/gusto_embedded/payrolls.rb
Instance Method Summary collapse
- #calculate(company_id, payroll_id, x_gusto_api_version = nil) ⇒ Object
- #calculate_gross_up(payroll_uuid, request_body, x_gusto_api_version = nil) ⇒ Object
- #cancel(company_id, payroll_id, x_gusto_api_version = nil) ⇒ Object
- #create_off_cycle(company_id, request_body, x_gusto_api_version = nil) ⇒ Object
- #delete(company_id, payroll_id, async = nil, x_gusto_api_version = nil) ⇒ Object
- #generate_printable_checks(payroll_uuid, request_body, x_gusto_api_version = nil) ⇒ Object
- #get(company_id, payroll_id, include = nil, x_gusto_api_version = nil) ⇒ Object
- #get_approved_reversals(company_id, page = nil, per = nil, x_gusto_api_version = nil) ⇒ Object
- #get_blockers(company_uuid, x_gusto_api_version = nil) ⇒ Object
- #get_pay_stub(payroll_id, employee_id, x_gusto_api_version = nil) ⇒ Object
- #get_pay_stubs(employee_id, x_gusto_api_version = nil) ⇒ Object
- #get_receipt(payroll_uuid, x_gusto_api_version = nil) ⇒ Object
-
#initialize(sdk_config) ⇒ Payrolls
constructor
A new instance of Payrolls.
- #list(request) ⇒ Object
- #prepare(company_id, payroll_id, x_gusto_api_version = nil) ⇒ Object
- #skip(company_uuid, request_body, x_gusto_api_version = nil) ⇒ Object
- #submit(company_id, payroll_id, request_body, x_gusto_api_version = nil) ⇒ Object
- #update(company_id, payroll_id, request_body, x_gusto_api_version = nil) ⇒ Object
Constructor Details
#initialize(sdk_config) ⇒ Payrolls
Returns a new instance of Payrolls.
17 18 19 |
# File 'lib/gusto_embedded/payrolls.rb', line 17 def initialize(sdk_config) @sdk_configuration = sdk_config end |
Instance Method Details
#calculate(company_id, payroll_id, x_gusto_api_version = nil) ⇒ Object
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 |
# File 'lib/gusto_embedded/payrolls.rb', line 637 def calculate(company_id, payroll_id, x_gusto_api_version = nil) # calculate - Calculate a payroll # Performs calculations for taxes, benefits, and deductions for an unprocessed payroll. The calculated payroll details provide a preview of the actual values that will be used when the payroll is run. # # This calculation is asynchronous and a successful request responds with a 202 HTTP status. To view the details of the calculated payroll, use the GET /v1/companies/{company_id}/payrolls/{payroll_id} endpoint with *include=taxes,benefits,deductions* params. # In v2023-04-01, *show_calculation=true* is no longer required. # # If the company is blocked from running payroll due to issues like incomplete setup, missing information or other compliance issues, the response will be 422 Unprocessable Entity with a categorization of the blockers as described in the error responses. request = ::GustoEmbedded::Operations::PutV1CompaniesCompanyIdPayrollsPayrollIdCalculateRequest.new( company_id: company_id, payroll_id: payroll_id, x_gusto_api_version: x_gusto_api_version ) url, params = @sdk_configuration.get_server_details base_url = Utils.template_url(url, params) url = Utils.generate_url( ::GustoEmbedded::Operations::PutV1CompaniesCompanyIdPayrollsPayrollIdCalculateRequest, base_url, '/v1/companies/{company_id}/payrolls/{payroll_id}/calculate', request ) headers = Utils.get_headers(request) headers['Accept'] = 'application/json' headers['user-agent'] = @sdk_configuration.user_agent r = @sdk_configuration.client.put(url) do |req| req.headers = headers security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil Utils.configure_request_security(req, security) if !security.nil? end content_type = r.headers.fetch('Content-Type', 'application/octet-stream') res = ::GustoEmbedded::Operations::PutV1CompaniesCompanyIdPayrollsPayrollIdCalculateResponse.new( status_code: r.status, content_type: content_type, raw_response: r ) if r.status == 202 elsif r.status == 404 elsif r.status == 422 if Utils.match_content_type(content_type, 'application/json') out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::Object) res.one_of = out end end res end |
#calculate_gross_up(payroll_uuid, request_body, x_gusto_api_version = nil) ⇒ Object
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 |
# File 'lib/gusto_embedded/payrolls.rb', line 573 def calculate_gross_up(payroll_uuid, request_body, x_gusto_api_version = nil) # calculate_gross_up - Calculate gross up # Calculates gross up earnings for an employee's payroll, given net earnings. This endpoint is only applicable to off-cycle unprocessed payrolls. # # The gross up amount must then be mapped to the corresponding fixed compensation earning type to get the correct payroll amount. For example, for bonus off-cycles, the gross up amount should be set with the Bonus earning type in the payroll `fixed_compensations` field. # # scope: `payrolls:run` request = ::GustoEmbedded::Operations::PostPayrollsGrossUpPayrollUuidRequest.new( payroll_uuid: payroll_uuid, request_body: request_body, x_gusto_api_version: x_gusto_api_version ) url, params = @sdk_configuration.get_server_details base_url = Utils.template_url(url, params) url = Utils.generate_url( ::GustoEmbedded::Operations::PostPayrollsGrossUpPayrollUuidRequest, base_url, '/v1/payrolls/{payroll_uuid}/gross_up', request ) headers = Utils.get_headers(request) req_content_type, data, form = Utils.serialize_request_body(request, :request_body, :json) headers['content-type'] = req_content_type raise StandardError, 'request body is required' if data.nil? && form.nil? headers['Accept'] = 'application/json' headers['user-agent'] = @sdk_configuration.user_agent r = @sdk_configuration.client.post(url) do |req| req.headers = headers security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil Utils.configure_request_security(req, security) if !security.nil? if form req.body = Utils.encode_form(form) elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded') req.body = URI.encode_www_form(data) else req.body = data end end content_type = r.headers.fetch('Content-Type', 'application/octet-stream') res = ::GustoEmbedded::Operations::PostPayrollsGrossUpPayrollUuidResponse.new( status_code: r.status, content_type: content_type, raw_response: r ) if r.status == 200 if Utils.match_content_type(content_type, 'application/json') out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::GrossUpPay) res.gross_up_pay = out end elsif r.status == 404 elsif r.status == 422 if Utils.match_content_type(content_type, 'application/json') out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::Object) res.one_of = out end end res end |
#cancel(company_id, payroll_id, x_gusto_api_version = nil) ⇒ Object
751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 |
# File 'lib/gusto_embedded/payrolls.rb', line 751 def cancel(company_id, payroll_id, x_gusto_api_version = nil) # cancel - Cancel a payroll # Transitions a `processed` payroll back to the `unprocessed` state. A payroll can be canceled if it meets both criteria: # - `processed` is true # - Current time is earlier than 3:30pm PT on the payroll_deadline # # scope: `payrolls:run` # request = ::GustoEmbedded::Operations::PutApiV1CompaniesCompanyIdPayrollsPayrollIdCancelRequest.new( company_id: company_id, payroll_id: payroll_id, x_gusto_api_version: x_gusto_api_version ) url, params = @sdk_configuration.get_server_details base_url = Utils.template_url(url, params) url = Utils.generate_url( ::GustoEmbedded::Operations::PutApiV1CompaniesCompanyIdPayrollsPayrollIdCancelRequest, base_url, '/v1/companies/{company_id}/payrolls/{payroll_id}/cancel', request ) headers = Utils.get_headers(request) headers['Accept'] = 'application/json' headers['user-agent'] = @sdk_configuration.user_agent r = @sdk_configuration.client.put(url) do |req| req.headers = headers security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil Utils.configure_request_security(req, security) if !security.nil? end content_type = r.headers.fetch('Content-Type', 'application/octet-stream') res = ::GustoEmbedded::Operations::PutApiV1CompaniesCompanyIdPayrollsPayrollIdCancelResponse.new( status_code: r.status, content_type: content_type, raw_response: r ) if r.status == 200 if Utils.match_content_type(content_type, 'application/json') out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::Payroll) res.payroll = out end elsif r.status == 404 elsif r.status == 422 if Utils.match_content_type(content_type, 'application/json') out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::UnprocessableEntityErrorObject) res.unprocessable_entity_error_object = out end end res end |
#create_off_cycle(company_id, request_body, x_gusto_api_version = nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/gusto_embedded/payrolls.rb', line 23 def create_off_cycle(company_id, request_body, x_gusto_api_version = nil) # create_off_cycle - Create an off-cycle payroll # Creates a new, unprocessed, off-cycle payroll. # # ## `off_cycle_reason` # By default: # - External benefits and deductions will be included when the `off_cycle_reason` is set to `Correction`. # - All benefits and deductions are blocked when the `off_cycle_reason` is set to `Bonus`. # # These elections can be overridden with the `skip_regular_deductions` boolean. # # scope: `payrolls:run` request = ::GustoEmbedded::Operations::PostV1CompaniesCompanyIdPayrollsRequest.new( company_id: company_id, request_body: request_body, x_gusto_api_version: x_gusto_api_version ) url, params = @sdk_configuration.get_server_details base_url = Utils.template_url(url, params) url = Utils.generate_url( ::GustoEmbedded::Operations::PostV1CompaniesCompanyIdPayrollsRequest, base_url, '/v1/companies/{company_id}/payrolls', request ) headers = Utils.get_headers(request) req_content_type, data, form = Utils.serialize_request_body(request, :request_body, :json) headers['content-type'] = req_content_type raise StandardError, 'request body is required' if data.nil? && form.nil? headers['Accept'] = 'application/json' headers['user-agent'] = @sdk_configuration.user_agent r = @sdk_configuration.client.post(url) do |req| req.headers = headers security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil Utils.configure_request_security(req, security) if !security.nil? if form req.body = Utils.encode_form(form) elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded') req.body = URI.encode_www_form(data) else req.body = data end end content_type = r.headers.fetch('Content-Type', 'application/octet-stream') res = ::GustoEmbedded::Operations::PostV1CompaniesCompanyIdPayrollsResponse.new( status_code: r.status, content_type: content_type, raw_response: r ) if r.status == 200 if Utils.match_content_type(content_type, 'application/json') out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::PayrollPrepared) res.payroll_prepared = out end elsif r.status == 404 elsif r.status == 422 if Utils.match_content_type(content_type, 'application/json') out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::UnprocessableEntityErrorObject) res.unprocessable_entity_error_object = out end end res end |
#delete(company_id, payroll_id, async = nil, x_gusto_api_version = nil) ⇒ Object
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
# File 'lib/gusto_embedded/payrolls.rb', line 315 def delete(company_id, payroll_id, async = nil, x_gusto_api_version = nil) # delete - Delete a payroll # This endpoint allows you to delete an **unprocessed** payroll. # # By default the payroll and associated data is deleted synchronously. To request an asynchronous delete, use the `async=true` query parameter. In both cases validation of ability to delete will be performed and an Unprocessable Entity error will be returned if the payroll is not able to be deleted. A successful synchronous delete will return `204/No Content`. When a payroll has been enqueued for asynchronous deletion, `202/Accepted` will be returned. # # scope: `payrolls:run` request = ::GustoEmbedded::Operations::DeleteV1CompaniesCompanyIdPayrollsRequest.new( company_id: company_id, payroll_id: payroll_id, async: async, x_gusto_api_version: x_gusto_api_version ) url, params = @sdk_configuration.get_server_details base_url = Utils.template_url(url, params) url = Utils.generate_url( ::GustoEmbedded::Operations::DeleteV1CompaniesCompanyIdPayrollsRequest, base_url, '/v1/companies/{company_id}/payrolls/{payroll_id}', request ) headers = Utils.get_headers(request) query_params = Utils.get_query_params(::GustoEmbedded::Operations::DeleteV1CompaniesCompanyIdPayrollsRequest, request) headers['Accept'] = '*/*' headers['user-agent'] = @sdk_configuration.user_agent r = @sdk_configuration.client.delete(url) do |req| req.headers = headers req.params = query_params security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil Utils.configure_request_security(req, security) if !security.nil? end content_type = r.headers.fetch('Content-Type', 'application/octet-stream') res = ::GustoEmbedded::Operations::DeleteV1CompaniesCompanyIdPayrollsResponse.new( status_code: r.status, content_type: content_type, raw_response: r ) if [202, 204].include?(r.status) elsif [404, 422].include?(r.status) end res end |
#generate_printable_checks(payroll_uuid, request_body, x_gusto_api_version = nil) ⇒ Object
895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 |
# File 'lib/gusto_embedded/payrolls.rb', line 895 def generate_printable_checks(payroll_uuid, request_body, x_gusto_api_version = nil) # generate_printable_checks - Generate printable payroll checks (pdf) # This endpoint initiates the generation of employee checks for the payroll specified by payroll_uuid. A generation status and corresponding request_uuid will be returned. Use the generated document GET endpoint with document_type: `printable_payroll_checks` and request_uuid to poll the check generation process and retrieve the generated check URL upon completion. # # scope: `generated_documents:write` request = ::GustoEmbedded::Operations::PostV1PayrollsPayrollUuidGeneratedDocumentsPrintablePayrollChecksRequest.new( payroll_uuid: payroll_uuid, request_body: request_body, x_gusto_api_version: x_gusto_api_version ) url, params = @sdk_configuration.get_server_details base_url = Utils.template_url(url, params) url = Utils.generate_url( ::GustoEmbedded::Operations::PostV1PayrollsPayrollUuidGeneratedDocumentsPrintablePayrollChecksRequest, base_url, '/v1/payrolls/{payroll_uuid}/generated_documents/printable_payroll_checks', request ) headers = Utils.get_headers(request) req_content_type, data, form = Utils.serialize_request_body(request, :request_body, :json) headers['content-type'] = req_content_type raise StandardError, 'request body is required' if data.nil? && form.nil? headers['Accept'] = 'application/json' headers['user-agent'] = @sdk_configuration.user_agent r = @sdk_configuration.client.post(url) do |req| req.headers = headers security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil Utils.configure_request_security(req, security) if !security.nil? if form req.body = Utils.encode_form(form) elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded') req.body = URI.encode_www_form(data) else req.body = data end end content_type = r.headers.fetch('Content-Type', 'application/octet-stream') res = ::GustoEmbedded::Operations::PostV1PayrollsPayrollUuidGeneratedDocumentsPrintablePayrollChecksResponse.new( status_code: r.status, content_type: content_type, raw_response: r ) if r.status == 200 if Utils.match_content_type(content_type, 'application/json') out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::PayrollCheck) res.payroll_check = out end elsif r.status == 404 elsif r.status == 422 if Utils.match_content_type(content_type, 'application/json') out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::UnprocessableEntityErrorObject) res.unprocessable_entity_error_object = out end end res end |
#get(company_id, payroll_id, include = nil, x_gusto_api_version = nil) ⇒ Object
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/gusto_embedded/payrolls.rb', line 191 def get(company_id, payroll_id, include = nil, x_gusto_api_version = nil) # get - Get a single payroll # Returns a payroll. If payroll is calculated or processed, will return employee_compensations and totals. # # Notes: # * Hour and dollar amounts are returned as string representations of numeric decimals. # * Hours are represented to the thousands place; dollar amounts are represented to the cent. # * Every eligible compensation is returned for each employee. If no data has yet be inserted for a given field, it defaults to “0.00” (for fixed amounts) or “0.000” (for hours ). # * To return future payrolls, you must include an `end_date` in the future. # * When include parameter with benefits value is passed, employee_benefits:read scope is required to return benefits # * Benefits containing PHI are only visible with the `employee_benefits:read:phi` scope # # scope: `payrolls:read` request = ::GustoEmbedded::Operations::GetV1CompaniesCompanyIdPayrollsPayrollIdRequest.new( company_id: company_id, payroll_id: payroll_id, include: include, x_gusto_api_version: x_gusto_api_version ) url, params = @sdk_configuration.get_server_details base_url = Utils.template_url(url, params) url = Utils.generate_url( ::GustoEmbedded::Operations::GetV1CompaniesCompanyIdPayrollsPayrollIdRequest, base_url, '/v1/companies/{company_id}/payrolls/{payroll_id}', request ) headers = Utils.get_headers(request) query_params = Utils.get_query_params(::GustoEmbedded::Operations::GetV1CompaniesCompanyIdPayrollsPayrollIdRequest, request) headers['Accept'] = 'application/json' headers['user-agent'] = @sdk_configuration.user_agent r = @sdk_configuration.client.get(url) do |req| req.headers = headers req.params = query_params security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil Utils.configure_request_security(req, security) if !security.nil? end content_type = r.headers.fetch('Content-Type', 'application/octet-stream') res = ::GustoEmbedded::Operations::GetV1CompaniesCompanyIdPayrollsPayrollIdResponse.new( status_code: r.status, content_type: content_type, raw_response: r ) if r.status == 200 if Utils.match_content_type(content_type, 'application/json') out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::Payroll) res.payroll = out end elsif r.status == 404 end res end |
#get_approved_reversals(company_id, page = nil, per = nil, x_gusto_api_version = nil) ⇒ Object
141 142 143 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 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/gusto_embedded/payrolls.rb', line 141 def get_approved_reversals(company_id, page = nil, per = nil, x_gusto_api_version = nil) # get_approved_reversals - Get approved payroll reversals # Returns all approved Payroll Reversals for a Company. # # scope: `payrolls:read` request = ::GustoEmbedded::Operations::GetV1CompaniesCompanyIdPayrollReversalsRequest.new( company_id: company_id, page: page, per: per, x_gusto_api_version: x_gusto_api_version ) url, params = @sdk_configuration.get_server_details base_url = Utils.template_url(url, params) url = Utils.generate_url( ::GustoEmbedded::Operations::GetV1CompaniesCompanyIdPayrollReversalsRequest, base_url, '/v1/companies/{company_id}/payroll_reversals', request ) headers = Utils.get_headers(request) query_params = Utils.get_query_params(::GustoEmbedded::Operations::GetV1CompaniesCompanyIdPayrollReversalsRequest, request) headers['Accept'] = 'application/json' headers['user-agent'] = @sdk_configuration.user_agent r = @sdk_configuration.client.get(url) do |req| req.headers = headers req.params = query_params security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil Utils.configure_request_security(req, security) if !security.nil? end content_type = r.headers.fetch('Content-Type', 'application/octet-stream') res = ::GustoEmbedded::Operations::GetV1CompaniesCompanyIdPayrollReversalsResponse.new( status_code: r.status, content_type: content_type, raw_response: r ) if r.status == 200 if Utils.match_content_type(content_type, 'application/json') out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::PayrollReversal) res.payroll_reversal = out end elsif r.status == 404 end res end |
#get_blockers(company_uuid, x_gusto_api_version = nil) ⇒ Object
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 |
# File 'lib/gusto_embedded/payrolls.rb', line 465 def get_blockers(company_uuid, x_gusto_api_version = nil) # get_blockers - Get all payroll blockers for a company # Returns a list of reasons that prevent the company from running payrolls. See the [payroll blockers guide](https://docs.gusto.com/embedded-payroll/docs/payroll-blockers) for a complete list of reasons. # # The list is empty if there are no payroll blockers. # # scope: `payrolls:run` request = ::GustoEmbedded::Operations::GetV1CompaniesPayrollBlockersCompanyUuidRequest.new( company_uuid: company_uuid, x_gusto_api_version: x_gusto_api_version ) url, params = @sdk_configuration.get_server_details base_url = Utils.template_url(url, params) url = Utils.generate_url( ::GustoEmbedded::Operations::GetV1CompaniesPayrollBlockersCompanyUuidRequest, base_url, '/v1/companies/{company_uuid}/payrolls/blockers', request ) headers = Utils.get_headers(request) headers['Accept'] = 'application/json' headers['user-agent'] = @sdk_configuration.user_agent r = @sdk_configuration.client.get(url) do |req| req.headers = headers security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil Utils.configure_request_security(req, security) if !security.nil? end content_type = r.headers.fetch('Content-Type', 'application/octet-stream') res = ::GustoEmbedded::Operations::GetV1CompaniesPayrollBlockersCompanyUuidResponse.new( status_code: r.status, content_type: content_type, raw_response: r ) if r.status == 200 if Utils.match_content_type(content_type, 'application/json') out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), T::Array[::GustoEmbedded::Shared::PayrollBlocker]) res.payroll_blocker_list = out end elsif r.status == 404 end res end |
#get_pay_stub(payroll_id, employee_id, x_gusto_api_version = nil) ⇒ Object
806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 |
# File 'lib/gusto_embedded/payrolls.rb', line 806 def get_pay_stub(payroll_id, employee_id, x_gusto_api_version = nil) # get_pay_stub - Get an employee pay stub (pdf) # Get an employee's pay stub for the specified payroll. By default, an application/pdf response will be returned. No other content types are currently supported, but may be supported in the future. # # scope: `pay_stubs:read` request = ::GustoEmbedded::Operations::GetV1PayrollsPayrollUuidEmployeesEmployeeUuidPayStubRequest.new( payroll_id: payroll_id, employee_id: employee_id, x_gusto_api_version: x_gusto_api_version ) url, params = @sdk_configuration.get_server_details base_url = Utils.template_url(url, params) url = Utils.generate_url( ::GustoEmbedded::Operations::GetV1PayrollsPayrollUuidEmployeesEmployeeUuidPayStubRequest, base_url, '/v1/payrolls/{payroll_id}/employees/{employee_id}/pay_stub', request ) headers = Utils.get_headers(request) headers['Accept'] = '*/*' headers['user-agent'] = @sdk_configuration.user_agent r = @sdk_configuration.client.get(url) do |req| req.headers = headers security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil Utils.configure_request_security(req, security) if !security.nil? end content_type = r.headers.fetch('Content-Type', 'application/octet-stream') res = ::GustoEmbedded::Operations::GetV1PayrollsPayrollUuidEmployeesEmployeeUuidPayStubResponse.new( status_code: r.status, content_type: content_type, raw_response: r ) if r.status == 200 elsif r.status == 404 end res end |
#get_pay_stubs(employee_id, x_gusto_api_version = nil) ⇒ Object
849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 |
# File 'lib/gusto_embedded/payrolls.rb', line 849 def get_pay_stubs(employee_id, x_gusto_api_version = nil) # get_pay_stubs - Get an employee's pay stubs # Get an employee's pay stubs # # scope: `pay_stubs:read` request = ::GustoEmbedded::Operations::GetV1EmployeesEmployeeUuidPayStubsRequest.new( employee_id: employee_id, x_gusto_api_version: x_gusto_api_version ) url, params = @sdk_configuration.get_server_details base_url = Utils.template_url(url, params) url = Utils.generate_url( ::GustoEmbedded::Operations::GetV1EmployeesEmployeeUuidPayStubsRequest, base_url, '/v1/employees/{employee_id}/pay_stubs', request ) headers = Utils.get_headers(request) headers['Accept'] = 'application/json' headers['user-agent'] = @sdk_configuration.user_agent r = @sdk_configuration.client.get(url) do |req| req.headers = headers security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil Utils.configure_request_security(req, security) if !security.nil? end content_type = r.headers.fetch('Content-Type', 'application/octet-stream') res = ::GustoEmbedded::Operations::GetV1EmployeesEmployeeUuidPayStubsResponse.new( status_code: r.status, content_type: content_type, raw_response: r ) if r.status == 200 if Utils.match_content_type(content_type, 'application/json') out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), T::Array[::GustoEmbedded::Shared::EmployeePayStub]) res.employee_pay_stubs_list = out end elsif r.status == 404 end res end |
#get_receipt(payroll_uuid, x_gusto_api_version = nil) ⇒ Object
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 |
# File 'lib/gusto_embedded/payrolls.rb', line 414 def get_receipt(payroll_uuid, x_gusto_api_version = nil) # get_receipt - Get a single payroll receipt # Returns a payroll receipt. # # Notes: # * Hour and dollar amounts are returned as string representations of numeric decimals. # * Dollar amounts are represented to the cent. # * If no data has yet be inserted for a given field, it defaults to “0.00” (for fixed amounts). # # scope: `payrolls:read` request = ::GustoEmbedded::Operations::GetV1PaymentReceiptsPayrollsPayrollUuidRequest.new( payroll_uuid: payroll_uuid, x_gusto_api_version: x_gusto_api_version ) url, params = @sdk_configuration.get_server_details base_url = Utils.template_url(url, params) url = Utils.generate_url( ::GustoEmbedded::Operations::GetV1PaymentReceiptsPayrollsPayrollUuidRequest, base_url, '/v1/payrolls/{payroll_uuid}/receipt', request ) headers = Utils.get_headers(request) headers['Accept'] = 'application/json' headers['user-agent'] = @sdk_configuration.user_agent r = @sdk_configuration.client.get(url) do |req| req.headers = headers security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil Utils.configure_request_security(req, security) if !security.nil? end content_type = r.headers.fetch('Content-Type', 'application/octet-stream') res = ::GustoEmbedded::Operations::GetV1PaymentReceiptsPayrollsPayrollUuidResponse.new( status_code: r.status, content_type: content_type, raw_response: r ) if r.status == 200 if Utils.match_content_type(content_type, 'application/json') out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::PayrollReceipt) res.payroll_receipt = out end elsif r.status == 404 end res end |
#list(request) ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/gusto_embedded/payrolls.rb', line 92 def list(request) # list - Get all payrolls for a company # Returns a list of payrolls for a company. You can change the payrolls returned by updating the processing_status, payroll_types, start_date, & end_date params. # # By default, will return processed, regular payrolls for the past 6 months. # # Notes: # * Dollar amounts are returned as string representations of numeric decimals, are represented to the cent. # * end_date can be at most 3 months in the future and start_date and end_date can't be more than 1 year apart. # # scope: `payrolls:read` url, params = @sdk_configuration.get_server_details base_url = Utils.template_url(url, params) url = Utils.generate_url( ::GustoEmbedded::Operations::GetV1CompaniesCompanyIdPayrollsRequest, base_url, '/v1/companies/{company_id}/payrolls', request ) headers = Utils.get_headers(request) query_params = Utils.get_query_params(::GustoEmbedded::Operations::GetV1CompaniesCompanyIdPayrollsRequest, request) headers['Accept'] = 'application/json' headers['user-agent'] = @sdk_configuration.user_agent r = @sdk_configuration.client.get(url) do |req| req.headers = headers req.params = query_params security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil Utils.configure_request_security(req, security) if !security.nil? end content_type = r.headers.fetch('Content-Type', 'application/octet-stream') res = ::GustoEmbedded::Operations::GetV1CompaniesCompanyIdPayrollsResponse.new( status_code: r.status, content_type: content_type, raw_response: r ) if r.status == 200 if Utils.match_content_type(content_type, 'application/json') out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), T::Array[::GustoEmbedded::Shared::PayrollMinimal]) res.payroll_list = out end elsif r.status == 404 end res end |
#prepare(company_id, payroll_id, x_gusto_api_version = nil) ⇒ Object
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 |
# File 'lib/gusto_embedded/payrolls.rb', line 363 def prepare(company_id, payroll_id, x_gusto_api_version = nil) # prepare - Prepare a payroll for update # This endpoint will build the payroll and get it ready for making updates. This includes adding/removing eligible employees from the Payroll and updating the check_date, payroll_deadline, and payroll_status_meta dates & times. # # Notes: # * Will null out calculated_at & totals if a payroll has already been calculated. # * Will return the version param used for updating the payroll # # scope: `payrolls:write` request = ::GustoEmbedded::Operations::PutV1CompaniesCompanyIdPayrollsPayrollIdPrepareRequest.new( company_id: company_id, payroll_id: payroll_id, x_gusto_api_version: x_gusto_api_version ) url, params = @sdk_configuration.get_server_details base_url = Utils.template_url(url, params) url = Utils.generate_url( ::GustoEmbedded::Operations::PutV1CompaniesCompanyIdPayrollsPayrollIdPrepareRequest, base_url, '/v1/companies/{company_id}/payrolls/{payroll_id}/prepare', request ) headers = Utils.get_headers(request) headers['Accept'] = 'application/json' headers['user-agent'] = @sdk_configuration.user_agent r = @sdk_configuration.client.put(url) do |req| req.headers = headers security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil Utils.configure_request_security(req, security) if !security.nil? end content_type = r.headers.fetch('Content-Type', 'application/octet-stream') res = ::GustoEmbedded::Operations::PutV1CompaniesCompanyIdPayrollsPayrollIdPrepareResponse.new( status_code: r.status, content_type: content_type, raw_response: r ) if r.status == 200 if Utils.match_content_type(content_type, 'application/json') out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::PayrollPrepared) res.payroll_prepared = out end elsif r.status == 404 end res end |
#skip(company_uuid, request_body, x_gusto_api_version = nil) ⇒ Object
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 |
# File 'lib/gusto_embedded/payrolls.rb', line 513 def skip(company_uuid, request_body, x_gusto_api_version = nil) # skip - Skip a payroll # Submits a $0 payroll for employees associated with the pay schedule to skip payroll. This submission is asynchronous and a successful request responds with a 202 HTTP status. Upon success, the payroll is transitioned to the `processed` state. # # If the company is blocked from running payroll due to issues like incomplete setup, missing information or other compliance issues, the response will be 422 Unprocessable Entity with a categorization of the blockers as described in the error responses. # # scope: `payrolls:run` request = ::GustoEmbedded::Operations::PostCompaniesPayrollSkipCompanyUuidRequest.new( company_uuid: company_uuid, request_body: request_body, x_gusto_api_version: x_gusto_api_version ) url, params = @sdk_configuration.get_server_details base_url = Utils.template_url(url, params) url = Utils.generate_url( ::GustoEmbedded::Operations::PostCompaniesPayrollSkipCompanyUuidRequest, base_url, '/v1/companies/{company_uuid}/payrolls/skip', request ) headers = Utils.get_headers(request) req_content_type, data, form = Utils.serialize_request_body(request, :request_body, :json) headers['content-type'] = req_content_type raise StandardError, 'request body is required' if data.nil? && form.nil? headers['Accept'] = 'application/json' headers['user-agent'] = @sdk_configuration.user_agent r = @sdk_configuration.client.post(url) do |req| req.headers = headers security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil Utils.configure_request_security(req, security) if !security.nil? if form req.body = Utils.encode_form(form) elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded') req.body = URI.encode_www_form(data) else req.body = data end end content_type = r.headers.fetch('Content-Type', 'application/octet-stream') res = ::GustoEmbedded::Operations::PostCompaniesPayrollSkipCompanyUuidResponse.new( status_code: r.status, content_type: content_type, raw_response: r ) if r.status == 202 elsif r.status == 404 elsif r.status == 422 if Utils.match_content_type(content_type, 'application/json') out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::Object) res.one_of = out end end res end |
#submit(company_id, payroll_id, request_body, x_gusto_api_version = nil) ⇒ Object
688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 |
# File 'lib/gusto_embedded/payrolls.rb', line 688 def submit(company_id, payroll_id, request_body, x_gusto_api_version = nil) # submit - Submit payroll # Submits an unprocessed payroll to be calculated and run. This submission is asynchronous and a successful request responds with a 202 HTTP status. Upon success, transitions the payroll to the `processed` state. # # You should poll to ensure that payroll is processed successfully, as async errors only occur after async processing is complete. # # If the company is blocked from running payroll due to issues like incomplete setup, missing information or other compliance issues, the response will be 422 Unprocessable Entity with a categorization of the blockers as described in the error responses. # # scope: `payrolls:run` request = ::GustoEmbedded::Operations::PutV1CompaniesCompanyIdPayrollsPayrollIdSubmitRequest.new( company_id: company_id, payroll_id: payroll_id, request_body: request_body, x_gusto_api_version: x_gusto_api_version ) url, params = @sdk_configuration.get_server_details base_url = Utils.template_url(url, params) url = Utils.generate_url( ::GustoEmbedded::Operations::PutV1CompaniesCompanyIdPayrollsPayrollIdSubmitRequest, base_url, '/v1/companies/{company_id}/payrolls/{payroll_id}/submit', request ) headers = Utils.get_headers(request) req_content_type, data, form = Utils.serialize_request_body(request, :request_body, :json) headers['content-type'] = req_content_type raise StandardError, 'request body is required' if data.nil? && form.nil? headers['Accept'] = 'application/json' headers['user-agent'] = @sdk_configuration.user_agent r = @sdk_configuration.client.put(url) do |req| req.headers = headers security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil Utils.configure_request_security(req, security) if !security.nil? if form req.body = Utils.encode_form(form) elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded') req.body = URI.encode_www_form(data) else req.body = data end end content_type = r.headers.fetch('Content-Type', 'application/octet-stream') res = ::GustoEmbedded::Operations::PutV1CompaniesCompanyIdPayrollsPayrollIdSubmitResponse.new( status_code: r.status, content_type: content_type, raw_response: r ) if r.status == 202 elsif r.status == 404 elsif r.status == 422 if Utils.match_content_type(content_type, 'application/json') out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::Object) res.one_of = out end end res end |
#update(company_id, payroll_id, request_body, x_gusto_api_version = nil) ⇒ Object
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/gusto_embedded/payrolls.rb', line 249 def update(company_id, payroll_id, request_body, x_gusto_api_version = nil) # update - Update a payroll by ID # This endpoint allows you to update information for one or more employees for a specific **unprocessed** payroll. You can think of the **unprocessed** # payroll object as a template of fields that you can update. You cannot modify the structure of the payroll object through this endpoint, only values # of the fields included in the payroll. If you do not include specific employee compensations or fixed/hourly compensations in your request body, they # will not be removed from the payroll. # # scope: `payrolls:write` request = ::GustoEmbedded::Operations::PutV1CompaniesCompanyIdPayrollsRequest.new( company_id: company_id, payroll_id: payroll_id, request_body: request_body, x_gusto_api_version: x_gusto_api_version ) url, params = @sdk_configuration.get_server_details base_url = Utils.template_url(url, params) url = Utils.generate_url( ::GustoEmbedded::Operations::PutV1CompaniesCompanyIdPayrollsRequest, base_url, '/v1/companies/{company_id}/payrolls/{payroll_id}', request ) headers = Utils.get_headers(request) req_content_type, data, form = Utils.serialize_request_body(request, :request_body, :json) headers['content-type'] = req_content_type raise StandardError, 'request body is required' if data.nil? && form.nil? headers['Accept'] = 'application/json' headers['user-agent'] = @sdk_configuration.user_agent r = @sdk_configuration.client.put(url) do |req| req.headers = headers security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil Utils.configure_request_security(req, security) if !security.nil? if form req.body = Utils.encode_form(form) elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded') req.body = URI.encode_www_form(data) else req.body = data end end content_type = r.headers.fetch('Content-Type', 'application/octet-stream') res = ::GustoEmbedded::Operations::PutV1CompaniesCompanyIdPayrollsResponse.new( status_code: r.status, content_type: content_type, raw_response: r ) if r.status == 200 if Utils.match_content_type(content_type, 'application/json') out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::PayrollPrepared) res.payroll_prepared = out end elsif r.status == 404 elsif r.status == 422 if Utils.match_content_type(content_type, 'application/json') out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::UnprocessableEntityErrorObject) res.unprocessable_entity_error_object = out end end res end |