Class: Gusto::Companies::AsyncDepartmentsClient
- Inherits:
-
Object
- Object
- Gusto::Companies::AsyncDepartmentsClient
- Defined in:
- lib/fern_gusto/companies/departments/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#add_people(department_uuid:, version: nil, employees: nil, contractors: nil, request_options: nil) ⇒ Object
api.companies.departments.add_people(department_uuid: “department_uuid”).
-
#create(company_uuid:, title: nil, request_options: nil) ⇒ Object
api.companies.departments.create(company_uuid: “company_uuid”, title: “Stage Hand”).
-
#delete(department_uuid:, request_options: nil) ⇒ Object
api.companies.departments.delete(department_uuid: “department_uuid”).
-
#get(department_uuid:, request_options: nil) ⇒ Object
api.companies.departments.get(department_uuid: “department_uuid”).
- #initialize(request_client:) ⇒ Gusto::Companies::AsyncDepartmentsClient constructor
-
#list(company_uuid:, request_options: nil) ⇒ Object
api.companies.departments.list(company_uuid: “company_uuid”).
-
#remove_people(department_uuid:, version: nil, employees: nil, contractors: nil, request_options: nil) ⇒ Object
api.companies.departments.remove_people(department_uuid: “department_uuid”).
-
#update(department_uuid:, version:, title: nil, request_options: nil) ⇒ Object
).
Constructor Details
#initialize(request_client:) ⇒ Gusto::Companies::AsyncDepartmentsClient
303 304 305 |
# File 'lib/fern_gusto/companies/departments/client.rb', line 303 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Gusto::AsyncRequestClient (readonly)
298 299 300 |
# File 'lib/fern_gusto/companies/departments/client.rb', line 298 def request_client @request_client end |
Instance Method Details
#add_people(department_uuid:, version: nil, employees: nil, contractors: nil, request_options: nil) ⇒ Object
api.companies.departments.add_people(department_uuid: “department_uuid”)
521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 |
# File 'lib/fern_gusto/companies/departments/client.rb', line 521 def add_people(department_uuid:, version: nil, employees: nil, contractors: 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, employees: employees, contractors: contractors }.compact req.url "#{@request_client.get_url(request_options: )}/v1/departments/#{department_uuid}/add" end Gusto::Department.from_json(json_object: response.body) end end |
#create(company_uuid:, title: nil, request_options: nil) ⇒ Object
api.companies.departments.create(company_uuid: “company_uuid”, title: “Stage Hand”)
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
# File 'lib/fern_gusto/companies/departments/client.rb', line 362 def create(company_uuid:, title: nil, request_options: nil) Async do 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 || {}), title: title }.compact req.url "#{@request_client.get_url(request_options: )}/v1/companies/#{company_uuid}/departments" end Gusto::Department.from_json(json_object: response.body) end end |
#delete(department_uuid:, request_options: nil) ⇒ Object
api.companies.departments.delete(department_uuid: “department_uuid”)
478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 |
# File 'lib/fern_gusto/companies/departments/client.rb', line 478 def delete(department_uuid:, request_options: nil) Async do response = @request_client.conn.delete 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/departments/#{department_uuid}" end end end |
#get(department_uuid:, request_options: nil) ⇒ Object
api.companies.departments.get(department_uuid: “department_uuid”)
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
# File 'lib/fern_gusto/companies/departments/client.rb', line 397 def get(department_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/departments/#{department_uuid}" end Gusto::Department.from_json(json_object: response.body) end end |
#list(company_uuid:, request_options: nil) ⇒ Object
api.companies.departments.list(company_uuid: “company_uuid”)
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 |
# File 'lib/fern_gusto/companies/departments/client.rb', line 320 def list(company_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/companies/#{company_uuid}/departments" end parsed_json = JSON.parse(response.body) parsed_json&.map do | item | item = item.to_json Gusto::Department.from_json(json_object: item) end end end |
#remove_people(department_uuid:, version: nil, employees: nil, contractors: nil, request_options: nil) ⇒ Object
api.companies.departments.remove_people(department_uuid: “department_uuid”)
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 |
# File 'lib/fern_gusto/companies/departments/client.rb', line 563 def remove_people(department_uuid:, version: nil, employees: nil, contractors: 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, employees: employees, contractors: contractors }.compact req.url "#{@request_client.get_url(request_options: )}/v1/departments/#{department_uuid}/remove" end Gusto::Department.from_json(json_object: response.body) end end |
#update(department_uuid:, version:, title: nil, request_options: nil) ⇒ Object
)
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 |
# File 'lib/fern_gusto/companies/departments/client.rb', line 442 def update(department_uuid:, version:, title: 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, title: title }.compact req.url "#{@request_client.get_url(request_options: )}/v1/departments/#{department_uuid}" end Gusto::Department.from_json(json_object: response.body) end end |