Class: GustoEmbedded::PaySchedules
- Inherits:
-
Object
- Object
- GustoEmbedded::PaySchedules
- Extended by:
- T::Sig
- Defined in:
- lib/gusto_embedded/payschedules.rb
Instance Method Summary collapse
- #assign(company_id, pay_schedule_assignment_body, x_gusto_api_version = nil) ⇒ Object
- #create(company_id, request_body, x_gusto_api_version = nil) ⇒ Object
- #get(company_id, pay_schedule_id, x_gusto_api_version = nil) ⇒ Object
- #get_all(company_id, page = nil, per = nil, x_gusto_api_version = nil) ⇒ Object
- #get_assignments(company_id, x_gusto_api_version = nil) ⇒ Object
- #get_pay_periods(request) ⇒ Object
- #get_preview(request) ⇒ Object
- #get_unprocessed_termination_periods(company_id, x_gusto_api_version = nil) ⇒ Object
-
#initialize(sdk_config) ⇒ PaySchedules
constructor
A new instance of PaySchedules.
- #preview_assignment(company_id, pay_schedule_assignment_body, x_gusto_api_version = nil) ⇒ Object
- #update(company_id, pay_schedule_id, request_body, x_gusto_api_version = nil) ⇒ Object
Constructor Details
#initialize(sdk_config) ⇒ PaySchedules
Returns a new instance of PaySchedules.
17 18 19 |
# File 'lib/gusto_embedded/payschedules.rb', line 17 def initialize(sdk_config) @sdk_configuration = sdk_config end |
Instance Method Details
#assign(company_id, pay_schedule_assignment_body, x_gusto_api_version = nil) ⇒ Object
494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 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 |
# File 'lib/gusto_embedded/payschedules.rb', line 494 def assign(company_id, pay_schedule_assignment_body, x_gusto_api_version = nil) # assign - Assign pay schedules for a company # This endpoint assigns employees to pay schedules based on the schedule type. # For `by_employee` and `by_department` schedules, use the `partial_assignment` parameter to control the assignment scope. Set it to `true` for partial assignments (only some employees or departments at a time) and `false` for full assignments (all employees or departments at once). # # scope: `pay_schedules:write` request = ::GustoEmbedded::Operations::PostV1CompaniesCompanyIdPaySchedulesAssignRequest.new( company_id: company_id, pay_schedule_assignment_body: pay_schedule_assignment_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::PostV1CompaniesCompanyIdPaySchedulesAssignRequest, base_url, '/v1/companies/{company_id}/pay_schedules/assign', request ) headers = Utils.get_headers(request) req_content_type, data, form = Utils.serialize_request_body(request, :pay_schedule_assignment_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::PostV1CompaniesCompanyIdPaySchedulesAssignResponse.new( status_code: r.status, content_type: content_type, raw_response: r ) if r.status == 200 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(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 |
# File 'lib/gusto_embedded/payschedules.rb', line 23 def create(company_id, request_body, x_gusto_api_version = nil) # create - Create a new pay schedule # If a company does not have any pay schedules, this endpoint will create a single pay schedule and assign it to all employees. This is a common use case during company onboarding. # # If a company has an existing active pay schedule and want to support multiple pay schedules, this endpoint will create a pay schedule that is not assigned to any employee. # # Be sure to **[check state laws](https://www.dol.gov/agencies/whd/state/payday)** to know what schedule is right for your customers. # # scope: `pay_schedules:write` request = ::GustoEmbedded::Operations::PostV1CompaniesCompanyIdPaySchedulesRequest.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::PostV1CompaniesCompanyIdPaySchedulesRequest, base_url, '/v1/companies/{company_id}/pay_schedules', 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::PostV1CompaniesCompanyIdPaySchedulesResponse.new( status_code: r.status, content_type: content_type, raw_response: r ) if r.status == 201 if Utils.match_content_type(content_type, 'application/json') out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::PayScheduleCreateUpdate) res.pay_schedule_create_update = 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, pay_schedule_id, x_gusto_api_version = nil) ⇒ Object
181 182 183 184 185 186 187 188 189 190 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 |
# File 'lib/gusto_embedded/payschedules.rb', line 181 def get(company_id, pay_schedule_id, x_gusto_api_version = nil) # get - Get a pay schedule # The pay schedule object in Gusto captures the details of when employees work and when they should be paid. A company can have multiple pay schedules. # # scope: `pay_schedules:read` request = ::GustoEmbedded::Operations::GetV1CompaniesCompanyIdPaySchedulesPayScheduleIdRequest.new( company_id: company_id, pay_schedule_id: pay_schedule_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::GetV1CompaniesCompanyIdPaySchedulesPayScheduleIdRequest, base_url, '/v1/companies/{company_id}/pay_schedules/{pay_schedule_id}', 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::GetV1CompaniesCompanyIdPaySchedulesPayScheduleIdResponse.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::PayScheduleObject) res.pay_schedule_object = out end elsif r.status == 404 end res end |
#get_all(company_id, page = nil, per = nil, x_gusto_api_version = nil) ⇒ Object
89 90 91 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 |
# File 'lib/gusto_embedded/payschedules.rb', line 89 def get_all(company_id, page = nil, per = nil, x_gusto_api_version = nil) # get_all - Get the pay schedules for a company # The pay schedule object in Gusto captures the details of when employees work and when they should be paid. A company can have multiple pay schedules. # # scope: `pay_schedules:read` request = ::GustoEmbedded::Operations::GetV1CompaniesCompanyIdPaySchedulesRequest.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::GetV1CompaniesCompanyIdPaySchedulesRequest, base_url, '/v1/companies/{company_id}/pay_schedules', request ) headers = Utils.get_headers(request) query_params = Utils.get_query_params(::GustoEmbedded::Operations::GetV1CompaniesCompanyIdPaySchedulesRequest, 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::GetV1CompaniesCompanyIdPaySchedulesResponse.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::PayScheduleList]) res.pay_schedule_list = out end elsif r.status == 404 end res end |
#get_assignments(company_id, x_gusto_api_version = nil) ⇒ Object
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 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
# File 'lib/gusto_embedded/payschedules.rb', line 386 def get_assignments(company_id, x_gusto_api_version = nil) # get_assignments - Get pay schedule assignments for a company # This endpoint returns the current pay schedule assignment for a company, with pay schedule and employee/department mappings depending on the pay schedule type. # # scope: `pay_schedules:read` request = ::GustoEmbedded::Operations::GetV1CompaniesCompanyIdPaySchedulesAssignmentsRequest.new( company_id: company_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::GetV1CompaniesCompanyIdPaySchedulesAssignmentsRequest, base_url, '/v1/companies/{company_id}/pay_schedules/assignments', 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::GetV1CompaniesCompanyIdPaySchedulesAssignmentsResponse.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::PayScheduleAssignment) res.pay_schedule_assignment = out end elsif r.status == 404 end res end |
#get_pay_periods(request) ⇒ Object
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
# File 'lib/gusto_embedded/payschedules.rb', line 291 def get_pay_periods(request) # get_pay_periods - Get pay periods for a company # Pay periods are the foundation of payroll. Compensation, time & attendance, taxes, and expense reports all rely on when they happened. To begin submitting information for a given payroll, we need to agree on the time period. # # By default, this endpoint returns pay periods starting from 6 months ago to the date today. Use the `start_date` and `end_date` parameters to change the scope of the response. End dates can be up to 3 months in the future and there is no limit on start dates. # # Starting in version '2023-04-01', the eligible_employees attribute was removed from the response. The eligible employees for a payroll are determined by the employee_compensations returned from the payrolls#prepare endpoint. # # scope: `payrolls:read` url, params = @sdk_configuration.get_server_details base_url = Utils.template_url(url, params) url = Utils.generate_url( ::GustoEmbedded::Operations::GetV1CompaniesCompanyIdPayPeriodsRequest, base_url, '/v1/companies/{company_id}/pay_periods', request ) headers = Utils.get_headers(request) query_params = Utils.get_query_params(::GustoEmbedded::Operations::GetV1CompaniesCompanyIdPayPeriodsRequest, 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::GetV1CompaniesCompanyIdPayPeriodsResponse.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::PayPeriod]) res.pay_period_list = out end elsif r.status == 404 end res end |
#get_preview(request) ⇒ Object
139 140 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 |
# File 'lib/gusto_embedded/payschedules.rb', line 139 def get_preview(request) # get_preview - Preview pay schedule dates # Provides a preview of a pay schedule with the specified parameters for the next 18 months. # # scope: `pay_schedules:write` url, params = @sdk_configuration.get_server_details base_url = Utils.template_url(url, params) url = Utils.generate_url( ::GustoEmbedded::Operations::GetV1CompaniesCompanyIdPaySchedulesPreviewRequest, base_url, '/v1/companies/{company_id}/pay_schedules/preview', request ) headers = Utils.get_headers(request) query_params = Utils.get_query_params(::GustoEmbedded::Operations::GetV1CompaniesCompanyIdPaySchedulesPreviewRequest, 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::GetV1CompaniesCompanyIdPaySchedulesPreviewResponse.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::Operations::GetV1CompaniesCompanyIdPaySchedulesPreviewResponseBody) res.object = out end end res end |
#get_unprocessed_termination_periods(company_id, x_gusto_api_version = nil) ⇒ Object
338 339 340 341 342 343 344 345 346 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 375 376 377 378 379 380 381 382 |
# File 'lib/gusto_embedded/payschedules.rb', line 338 def get_unprocessed_termination_periods(company_id, x_gusto_api_version = nil) # get_unprocessed_termination_periods - Get termination pay periods for a company # When a payroll admin terminates an employee and selects "Dismissal Payroll" as the employee's final payroll, their last pay period will appear on the list. # # This endpoint returns the unprocessed pay periods for past and future terminated employees in a given company. # # scope: `payrolls:read` request = ::GustoEmbedded::Operations::GetV1CompaniesCompanyIdUnprocessedTerminationPayPeriodsRequest.new( company_id: company_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::GetV1CompaniesCompanyIdUnprocessedTerminationPayPeriodsRequest, base_url, '/v1/companies/{company_id}/pay_periods/unprocessed_termination_pay_periods', 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::GetV1CompaniesCompanyIdUnprocessedTerminationPayPeriodsResponse.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::UnprocessedTerminationPayPeriod]) res.unprocessed_termination_pay_period_list = out end elsif r.status == 404 end res end |
#preview_assignment(company_id, pay_schedule_assignment_body, x_gusto_api_version = nil) ⇒ Object
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 462 463 464 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 |
# File 'lib/gusto_embedded/payschedules.rb', line 432 def preview_assignment(company_id, pay_schedule_assignment_body, x_gusto_api_version = nil) # preview_assignment - Preview pay schedule assignments for a company # This endpoint returns the employee changes, including pay period and transition pay periods, for changing the pay schedule. # # scope: `pay_schedules:write` request = ::GustoEmbedded::Operations::PostV1CompaniesCompanyIdPaySchedulesAssignmentPreviewRequest.new( company_id: company_id, pay_schedule_assignment_body: pay_schedule_assignment_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::PostV1CompaniesCompanyIdPaySchedulesAssignmentPreviewRequest, base_url, '/v1/companies/{company_id}/pay_schedules/assignment_preview', request ) headers = Utils.get_headers(request) req_content_type, data, form = Utils.serialize_request_body(request, :pay_schedule_assignment_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::PostV1CompaniesCompanyIdPaySchedulesAssignmentPreviewResponse.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::PayScheduleAssignmentPreview) res.pay_schedule_assignment_preview = 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 |
#update(company_id, pay_schedule_id, request_body, x_gusto_api_version = nil) ⇒ Object
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 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 |
# File 'lib/gusto_embedded/payschedules.rb', line 228 def update(company_id, pay_schedule_id, request_body, x_gusto_api_version = nil) # update - Update a pay schedule # Updates a pay schedule. # # scope: `pay_schedules:write` request = ::GustoEmbedded::Operations::PutV1CompaniesCompanyIdPaySchedulesPayScheduleIdRequest.new( company_id: company_id, pay_schedule_id: pay_schedule_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::PutV1CompaniesCompanyIdPaySchedulesPayScheduleIdRequest, base_url, '/v1/companies/{company_id}/pay_schedules/{pay_schedule_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::PutV1CompaniesCompanyIdPaySchedulesPayScheduleIdResponse.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::PayScheduleCreateUpdate) res.pay_schedule_create_update = 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 |