Class: SquareLegacy::LaborApi
- Defined in:
- lib/square_legacy/api/labor_api.rb
Overview
LaborApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#bulk_publish_scheduled_shifts(body:) ⇒ ApiResponse
Publishes 1 - 100 scheduled shifts.
-
#create_break_type(body:) ⇒ ApiResponse
Creates a new
BreakType. -
#create_scheduled_shift(body:) ⇒ ApiResponse
Creates a scheduled shift by providing draft shift details such as job ID, team member assignment, and start and end times.
-
#create_shift(body:) ⇒ ApiResponse
deprecated
Deprecated.
This endpoint is deprecated at Square API version 2025-05-21. Use create_timecard instead.
-
#create_timecard(body:) ⇒ ApiResponse
Creates a new
Timecard. -
#delete_break_type(id:) ⇒ ApiResponse
Deletes an existing
BreakType. -
#delete_shift(id:) ⇒ ApiResponse
deprecated
Deprecated.
This endpoint is deprecated at Square API version 2025-05-21. Use delete_timecard instead.
-
#delete_timecard(id:) ⇒ ApiResponse
Deletes a
Timecard. -
#get_break_type(id:) ⇒ ApiResponse
Returns a single
BreakTypespecified byid. -
#get_employee_wage(id:) ⇒ ApiResponse
Returns a single
EmployeeWagespecified byid. -
#get_shift(id:) ⇒ ApiResponse
deprecated
Deprecated.
This endpoint is deprecated at Square API version 2025-05-21. Use retrieve_timecard instead.
-
#get_team_member_wage(id:) ⇒ ApiResponse
Returns a single
TeamMemberWagespecified byid. -
#list_break_types(location_id: nil, limit: nil, cursor: nil) ⇒ ApiResponse
Returns a paginated list of
BreakTypeinstances for a business. -
#list_employee_wages(employee_id: nil, limit: nil, cursor: nil) ⇒ ApiResponse
Returns a paginated list of
EmployeeWageinstances for a business. -
#list_team_member_wages(team_member_id: nil, limit: nil, cursor: nil) ⇒ ApiResponse
Returns a paginated list of
TeamMemberWageinstances for a business. -
#list_workweek_configs(limit: nil, cursor: nil) ⇒ ApiResponse
Returns a list of
WorkweekConfiginstances for a business. -
#publish_scheduled_shift(id:, body:) ⇒ ApiResponse
Publishes a scheduled shift.
-
#retrieve_scheduled_shift(id:) ⇒ ApiResponse
Retrieves a scheduled shift by ID.
-
#retrieve_timecard(id:) ⇒ ApiResponse
Returns a single
Timecardspecified byid. -
#search_scheduled_shifts(body:) ⇒ ApiResponse
Returns a paginated list of scheduled shifts, with optional filter and sort settings.
-
#search_shifts(body:) ⇒ ApiResponse
deprecated
Deprecated.
This endpoint is deprecated at Square API version 2025-05-21. Use search_timecards instead.
-
#search_timecards(body:) ⇒ ApiResponse
Returns a paginated list of
Timecardrecords for a business. -
#update_break_type(id:, body:) ⇒ ApiResponse
Updates an existing
BreakType. -
#update_scheduled_shift(id:, body:) ⇒ ApiResponse
Updates the draft shift details for a scheduled shift.
-
#update_shift(id:, body:) ⇒ ApiResponse
deprecated
Deprecated.
This endpoint is deprecated at Square API version 2025-05-21. Use update_timecard instead.
-
#update_timecard(id:, body:) ⇒ ApiResponse
Updates an existing
Timecard. -
#update_workweek_config(id:, body:) ⇒ ApiResponse
Updates a
WorkweekConfig.
Methods inherited from BaseApi
#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from SquareLegacy::BaseApi
Instance Method Details
#bulk_publish_scheduled_shifts(body:) ⇒ ApiResponse
Publishes 1 - 100 scheduled shifts. This endpoint takes a map of individual publish
requests and returns a map of responses. When a scheduled shift is published, Square keeps
the draft_shift_details field as is and copies it to the published_shift_details field.
The minimum start_at and maximum end_at timestamps of all shifts in a
BulkPublishScheduledShifts request must fall within a two-week period.
containing the fields to POST for the request. See the corresponding object
definition for field details.
615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 |
# File 'lib/square_legacy/api/labor_api.rb', line 615 def bulk_publish_scheduled_shifts(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/labor/scheduled-shifts/bulk-publish', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#create_break_type(body:) ⇒ ApiResponse
Creates a new BreakType.
A BreakType is a template for creating Break objects.
You must provide the following values in your request to this
endpoint:
location_idbreak_nameexpected_durationis_paidYou can only have threeBreakTypeinstances per location. If you attempt to add a fourthBreakTypefor a location, anINVALID_REQUEST_ERROR"Exceeded limit of 3 breaks per location." is returned. containing the fields to POST for the request. See the corresponding object definition for field details.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/square_legacy/api/labor_api.rb', line 50 def create_break_type(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/labor/break-types', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#create_scheduled_shift(body:) ⇒ ApiResponse
Creates a scheduled shift by providing draft shift details such as job ID,
team member assignment, and start and end times.
The following draft_shift_details fields are required:
location_idjob_idstart_atend_atcontaining the fields to POST for the request. See the corresponding object definition for field details.
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 |
# File 'lib/square_legacy/api/labor_api.rb', line 589 def create_scheduled_shift(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/labor/scheduled-shifts', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#create_shift(body:) ⇒ ApiResponse
This endpoint is deprecated at Square API version 2025-05-21. Use create_timecard instead.
Creates a new Shift.
A Shift represents a complete workday for a single team member.
You must provide the following values in your request to this
endpoint:
location_idteam_member_idstart_atAn attempt to create a newShiftcan result in aBAD_REQUESTerror when:- The
statusof the newShiftisOPENand the team member has another shift with anOPENstatus. - The
start_atdate is in the future. - The
start_atorend_atdate overlaps another shift for the same team member. - The
Breakinstances are set in the request and a breakstart_atis before theShift.start_at, a breakend_atis after theShift.end_at, or both. the fields to POST for the request. See the corresponding object definition for field details.
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/square_legacy/api/labor_api.rb', line 208 def create_shift(body:) warn 'Endpoint create_shift in LaborApi is deprecated' new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/labor/shifts', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#create_timecard(body:) ⇒ ApiResponse
Creates a new Timecard.
A Timecard represents a complete workday for a single team member.
You must provide the following values in your request to this
endpoint:
location_idteam_member_idstart_atAn attempt to create a newTimecardcan result in aBAD_REQUESTerror when:- The
statusof the newTimecardisOPENand the team member has another timecard with anOPENstatus. - The
start_atdate is in the future. - The
start_atorend_atdate overlaps another timecard for the same team member. - The
Breakinstances are set in the request and a breakstart_atis before theTimecard.start_at, a breakend_atis after theTimecard.end_at, or both. the fields to POST for the request. See the corresponding object definition for field details.
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 |
# File 'lib/square_legacy/api/labor_api.rb', line 458 def create_timecard(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/labor/timecards', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#delete_break_type(id:) ⇒ ApiResponse
Deletes an existing BreakType.
A BreakType can be deleted even if it is referenced from a Shift.
deleted.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/square_legacy/api/labor_api.rb', line 72 def delete_break_type(id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::DELETE, '/v2/labor/break-types/{id}', 'default') .template_param(new_parameter(id, key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#delete_shift(id:) ⇒ ApiResponse
This endpoint is deprecated at Square API version 2025-05-21. Use delete_timecard instead.
Deletes a Shift.
deleted.
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/square_legacy/api/labor_api.rb', line 267 def delete_shift(id:) warn 'Endpoint delete_shift in LaborApi is deprecated' new_api_call_builder .request(new_request_builder(HttpMethodEnum::DELETE, '/v2/labor/shifts/{id}', 'default') .template_param(new_parameter(id, key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#delete_timecard(id:) ⇒ ApiResponse
Deletes a Timecard.
deleted.
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
# File 'lib/square_legacy/api/labor_api.rb', line 513 def delete_timecard(id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::DELETE, '/v2/labor/timecards/{id}', 'default') .template_param(new_parameter(id, key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#get_break_type(id:) ⇒ ApiResponse
Returns a single BreakType specified by id.
retrieved.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/square_legacy/api/labor_api.rb', line 92 def get_break_type(id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/labor/break-types/{id}', 'default') .template_param(new_parameter(id, key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#get_employee_wage(id:) ⇒ ApiResponse
Returns a single EmployeeWage specified by id.
being retrieved.
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/square_legacy/api/labor_api.rb', line 168 def get_employee_wage(id:) warn 'Endpoint get_employee_wage in LaborApi is deprecated' new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/labor/employee-wages/{id}', 'default') .template_param(new_parameter(id, key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#get_shift(id:) ⇒ ApiResponse
This endpoint is deprecated at Square API version 2025-05-21. Use retrieve_timecard instead.
Returns a single Shift specified by id.
retrieved.
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/square_legacy/api/labor_api.rb', line 289 def get_shift(id:) warn 'Endpoint get_shift in LaborApi is deprecated' new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/labor/shifts/{id}', 'default') .template_param(new_parameter(id, key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#get_team_member_wage(id:) ⇒ ApiResponse
Returns a single TeamMemberWage specified by id.
being retrieved.
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
# File 'lib/square_legacy/api/labor_api.rb', line 373 def get_team_member_wage(id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/labor/team-member-wages/{id}', 'default') .template_param(new_parameter(id, key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#list_break_types(location_id: nil, limit: nil, cursor: nil) ⇒ ApiResponse
Returns a paginated list of BreakType instances for a business.
BreakType results to only those that are associated with the specified
location.
BreakType results to return per page. The number can range between 1 and
200. The default is 200.
BreakType results to fetch.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/square_legacy/api/labor_api.rb', line 14 def list_break_types(location_id: nil, limit: nil, cursor: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/labor/break-types', 'default') .query_param(new_parameter(location_id, key: 'location_id')) .query_param(new_parameter(limit, key: 'limit')) .query_param(new_parameter(cursor, key: 'cursor')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#list_employee_wages(employee_id: nil, limit: nil, cursor: nil) ⇒ ApiResponse
Returns a paginated list of EmployeeWage instances for a business.
to only those that are associated with the specified employee.
EmployeeWage results to return per page. The number can range between 1
and 200. The default is 200.
EmployeeWage results to fetch.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/square_legacy/api/labor_api.rb', line 144 def list_employee_wages(employee_id: nil, limit: nil, cursor: nil) warn 'Endpoint list_employee_wages in LaborApi is deprecated' new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/labor/employee-wages', 'default') .query_param(new_parameter(employee_id, key: 'employee_id')) .query_param(new_parameter(limit, key: 'limit')) .query_param(new_parameter(cursor, key: 'cursor')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#list_team_member_wages(team_member_id: nil, limit: nil, cursor: nil) ⇒ ApiResponse
Returns a paginated list of TeamMemberWage instances for a business.
wages to only those that are associated with the specified team member.
TeamMemberWage results to return per page. The number can range between
1 and 200. The default is 200.
EmployeeWage results to fetch.
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
# File 'lib/square_legacy/api/labor_api.rb', line 350 def list_team_member_wages(team_member_id: nil, limit: nil, cursor: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/labor/team-member-wages', 'default') .query_param(new_parameter(team_member_id, key: 'team_member_id')) .query_param(new_parameter(limit, key: 'limit')) .query_param(new_parameter(cursor, key: 'cursor')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#list_workweek_configs(limit: nil, cursor: nil) ⇒ ApiResponse
Returns a list of WorkweekConfig instances for a business.
WorkweekConfigs results to return per page.
WorkweekConfig results to fetch.
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 |
# File 'lib/square_legacy/api/labor_api.rb', line 395 def list_workweek_configs(limit: nil, cursor: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/labor/workweek-configs', 'default') .query_param(new_parameter(limit, key: 'limit')) .query_param(new_parameter(cursor, key: 'cursor')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#publish_scheduled_shift(id:, body:) ⇒ ApiResponse
Publishes a scheduled shift. When a scheduled shift is published, Square keeps the
draft_shift_details field as is and copies it to the published_shift_details field.
the fields to POST for the request. See the corresponding object definition for field details.
706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 |
# File 'lib/square_legacy/api/labor_api.rb', line 706 def publish_scheduled_shift(id:, body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/labor/scheduled-shifts/{id}/publish', 'default') .template_param(new_parameter(id, key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#retrieve_scheduled_shift(id:) ⇒ ApiResponse
Retrieves a scheduled shift by ID.
658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 |
# File 'lib/square_legacy/api/labor_api.rb', line 658 def retrieve_scheduled_shift(id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/labor/scheduled-shifts/{id}', 'default') .template_param(new_parameter(id, key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#retrieve_timecard(id:) ⇒ ApiResponse
Returns a single Timecard specified by id.
retrieved.
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 |
# File 'lib/square_legacy/api/labor_api.rb', line 533 def retrieve_timecard(id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/labor/timecards/{id}', 'default') .template_param(new_parameter(id, key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#search_scheduled_shifts(body:) ⇒ ApiResponse
Returns a paginated list of scheduled shifts, with optional filter and sort settings.
By default, results are sorted by start_at in ascending order.
containing the fields to POST for the request. See the corresponding object
definition for field details.
638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 |
# File 'lib/square_legacy/api/labor_api.rb', line 638 def search_scheduled_shifts(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/labor/scheduled-shifts/search', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#search_shifts(body:) ⇒ ApiResponse
This endpoint is deprecated at Square API version 2025-05-21. Use search_timecards instead.
Returns a paginated list of Shift records for a business.
The list to be returned can be filtered by:
- Location IDs
- Team member IDs
- Shift status (
OPENorCLOSED) - Shift start
- Shift end
- Workday details The list can be sorted by:
START_ATEND_ATCREATED_ATUPDATED_ATthe fields to POST for the request. See the corresponding object definition for field details.
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/square_legacy/api/labor_api.rb', line 244 def search_shifts(body:) warn 'Endpoint search_shifts in LaborApi is deprecated' new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/labor/shifts/search', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#search_timecards(body:) ⇒ ApiResponse
Returns a paginated list of Timecard records for a business.
The list to be returned can be filtered by:
- Location IDs
- Team member IDs
- Timecard status (
OPENorCLOSED) - Timecard start
- Timecard end
- Workday details The list can be sorted by:
START_ATEND_ATCREATED_ATUPDATED_ATcontaining the fields to POST for the request. See the corresponding object definition for field details.
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
# File 'lib/square_legacy/api/labor_api.rb', line 492 def search_timecards(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/labor/timecards/search', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#update_break_type(id:, body:) ⇒ ApiResponse
Updates an existing BreakType.
updated.
containing the fields to POST for the request. See the corresponding
object definition for field details.
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/square_legacy/api/labor_api.rb', line 115 def update_break_type(id:, body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/v2/labor/break-types/{id}', 'default') .template_param(new_parameter(id, key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#update_scheduled_shift(id:, body:) ⇒ ApiResponse
Updates the draft shift details for a scheduled shift. This endpoint supports sparse updates, so only new, changed, or removed fields are required in the request. You must publish the shift to make updates public. the fields to POST for the request. See the corresponding object definition for field details.
681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 |
# File 'lib/square_legacy/api/labor_api.rb', line 681 def update_scheduled_shift(id:, body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/v2/labor/scheduled-shifts/{id}', 'default') .template_param(new_parameter(id, key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#update_shift(id:, body:) ⇒ ApiResponse
This endpoint is deprecated at Square API version 2025-05-21. Use update_timecard instead.
Updates an existing Shift.
When adding a Break to a Shift, any earlier Break instances in the
Shift have
the end_at property set to a valid RFC-3339 datetime string.
When closing a Shift, all Break instances in the Shift must be
complete with end_at
set on each Break.
updated.
the fields to POST for the request. See the corresponding object
definition for field details.
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
# File 'lib/square_legacy/api/labor_api.rb', line 320 def update_shift(id:, body:) warn 'Endpoint update_shift in LaborApi is deprecated' new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/v2/labor/shifts/{id}', 'default') .template_param(new_parameter(id, key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#update_timecard(id:, body:) ⇒ ApiResponse
Updates an existing Timecard.
When adding a Break to a Timecard, any earlier Break instances in the
Timecard have the end_at property set to a valid RFC-3339 datetime string.
When closing a Timecard, all Break instances in the Timecard must be
complete with end_at set on each Break.
the fields to POST for the request. See the corresponding object
definition for field details.
559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 |
# File 'lib/square_legacy/api/labor_api.rb', line 559 def update_timecard(id:, body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/v2/labor/timecards/{id}', 'default') .template_param(new_parameter(id, key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#update_workweek_config(id:, body:) ⇒ ApiResponse
Updates a WorkweekConfig.
object being updated.
containing the fields to POST for the request. See the corresponding
object definition for field details.
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 |
# File 'lib/square_legacy/api/labor_api.rb', line 419 def update_workweek_config(id:, body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/v2/labor/workweek-configs/{id}', 'default') .template_param(new_parameter(id, key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |