labor_api = client.labor
LaborApi
- List Break Types
- Create Break Type
- Delete Break Type
- Get Break Type
- Update Break Type
- List Employee Wages
- Get Employee Wage
- Create Shift
- Search Shifts
- Delete Shift
- Get Shift
- Update Shift
- List Team Member Wages
- Get Team Member Wage
- List Workweek Configs
- Update Workweek Config
Returns a paginated list of BreakType
instances for a business.
def list_break_types(location_id: nil,
limit: nil,
cursor: nil)
Parameter | Type | Tags | Description |
---|---|---|---|
location_id |
String |
Query, Optional | Filter the returned BreakType results to only those that are associated with thespecified location. |
limit |
Integer |
Query, Optional | The maximum number of BreakType results to return per page. The number can range between 1and 200. The default is 200. |
cursor |
String |
Query, Optional | A pointer to the next page of BreakType results to fetch. |
List Break Types Response Hash
result = labor_api.list_break_types()
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
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_id
break_name
expected_duration
is_paid
You can only have three BreakType
instances per location. If you attempt to add a fourth
BreakType
for a location, an INVALID_REQUEST_ERROR
"Exceeded limit of 3 breaks per location."
is returned.
def create_break_type(body:)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
Create Break Type Request Hash |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Create Break Type Response Hash
body = {}
body[:idempotency_key] = 'PAD3NG5KSN2GL'
body[:break_type] = {}
body[:break_type][:location_id] = 'CGJN03P1D08GF'
body[:break_type][:break_name] = 'Lunch Break'
body[:break_type][:expected_duration] = 'PT30M'
body[:break_type][:is_paid] = true
result = labor_api.create_break_type(body: body)
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
Deletes an existing BreakType
.
A BreakType
can be deleted even if it is referenced from a Shift
.
def delete_break_type(id:)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
String |
Template, Required | The UUID for the BreakType being deleted. |
Delete Break Type Response Hash
id = 'id0'
result = labor_api.delete_break_type(id: id)
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
Returns a single BreakType
specified by id
.
def get_break_type(id:)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
String |
Template, Required | The UUID for the BreakType being retrieved. |
id = 'id0'
result = labor_api.get_break_type(id: id)
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
Updates an existing BreakType
.
def update_break_type(id:,
body:)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
String |
Template, Required | The UUID for the BreakType being updated. |
body |
Update Break Type Request Hash |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Update Break Type Response Hash
id = 'id0'
body = {}
body[:break_type] = {}
body[:break_type][:location_id] = '26M7H24AZ9N6R'
body[:break_type][:break_name] = 'Lunch'
body[:break_type][:expected_duration] = 'PT50M'
body[:break_type][:is_paid] = true
body[:break_type][:version] = 1
result = labor_api.update_break_type(id: id, body: body)
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
This endpoint is deprecated.
Returns a paginated list of EmployeeWage
instances for a business.
def list_employee_wages(employee_id: nil,
limit: nil,
cursor: nil)
Parameter | Type | Tags | Description |
---|---|---|---|
employee_id |
String |
Query, Optional | Filter the returned wages to only those that are associated with the specified employee. |
limit |
Integer |
Query, Optional | The maximum number of EmployeeWage results to return per page. The number can range between1 and 200. The default is 200. |
cursor |
String |
Query, Optional | A pointer to the next page of EmployeeWage results to fetch. |
List Employee Wages Response Hash
result = labor_api.list_employee_wages()
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
This endpoint is deprecated.
Returns a single EmployeeWage
specified by id
.
def get_employee_wage(id:)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
String |
Template, Required | The UUID for the EmployeeWage being retrieved. |
Get Employee Wage Response Hash
id = 'id0'
result = labor_api.get_employee_wage(id: id)
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
Creates a new Shift
.
A Shift
represents a complete workday for a single employee.
You must provide the following values in your request to this
endpoint:
location_id
employee_id
start_at
An attempt to create a new Shift
can result in a BAD_REQUEST
error when:
- The
status
of the newShift
isOPEN
and the employee has another shift with anOPEN
status. - The
start_at
date is in the future. - The
start_at
orend_at
date overlaps another shift for the same employee. - The
Break
instances are set in the request and a breakstart_at
is before theShift.start_at
, a breakend_at
is after theShift.end_at
, or both.
def create_shift(body:)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
Create Shift Request Hash |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
body = {}
body[:idempotency_key] = 'HIDSNG5KS478L'
body[:shift] = {}
body[:shift][:location_id] = 'PAA1RJZZKXBFG'
body[:shift][:start_at] = '2019-01-25T08:11:00+00:00'
body[:shift][:end_at] = '2019-01-25T18:11:00+00:00'
body[:shift][:wage] = {}
body[:shift][:wage][:title] = 'Barista'
body[:shift][:wage][:hourly_rate] = {}
body[:shift][:wage][:hourly_rate][:amount] = 1100
body[:shift][:wage][:hourly_rate][:currency] = 'USD'
body[:shift][:breaks] = []
body[:shift][:breaks][0] = {}
body[:shift][:breaks][0][:start_at] = '2019-01-25T11:11:00+00:00'
body[:shift][:breaks][0][:end_at] = '2019-01-25T11:16:00+00:00'
body[:shift][:breaks][0][:break_type_id] = 'REGS1EQR1TPZ5'
body[:shift][:breaks][0][:name] = 'Tea Break'
body[:shift][:breaks][0][:expected_duration] = 'PT5M'
body[:shift][:breaks][0][:is_paid] = true
body[:shift][:team_member_id] = 'ormj0jJJZ5OZIzxrZYJI'
result = labor_api.create_shift(body: body)
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
Returns a paginated list of Shift
records for a business.
The list to be returned can be filtered by:
- Location IDs.
- Employee IDs.
- Shift status (
OPEN
andCLOSED
). - Shift start.
- Shift end.
- Workday details.
The list can be sorted by:
start_at
.end_at
.created_at
.updated_at
.
def search_shifts(body:)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
Search Shifts Request Hash |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
body = {}
body[:query] = {}
body[:query][:filter] = {}
body[:query][:filter][:workday] = {}
body[:query][:filter][:workday][:date_range] = {}
body[:query][:filter][:workday][:date_range][:start_date] = '2019-01-20'
body[:query][:filter][:workday][:date_range][:end_date] = '2019-02-03'
body[:query][:filter][:workday][:match_shifts_by] = 'START_AT'
body[:query][:filter][:workday][:default_timezone] = 'America/Los_Angeles'
body[:limit] = 100
result = labor_api.search_shifts(body: body)
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
Deletes a Shift
.
def delete_shift(id:)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
String |
Template, Required | The UUID for the Shift being deleted. |
id = 'id0'
result = labor_api.delete_shift(id: id)
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
Returns a single Shift
specified by id
.
def get_shift(id:)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
String |
Template, Required | The UUID for the Shift being retrieved. |
id = 'id0'
result = labor_api.get_shift(id: id)
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
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
.
def update_shift(id:,
body:)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
String |
Template, Required | The ID of the object being updated. |
body |
Update Shift Request Hash |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
id = 'id0'
body = {}
body[:shift] = {}
body[:shift][:location_id] = 'PAA1RJZZKXBFG'
body[:shift][:start_at] = '2019-01-25T08:11:00+00:00'
body[:shift][:end_at] = '2019-01-25T18:11:00+00:00'
body[:shift][:wage] = {}
body[:shift][:wage][:title] = 'Bartender'
body[:shift][:wage][:hourly_rate] = {}
body[:shift][:wage][:hourly_rate][:amount] = 1500
body[:shift][:wage][:hourly_rate][:currency] = 'USD'
body[:shift][:breaks] = []
body[:shift][:breaks][0] = {}
body[:shift][:breaks][0][:id] = 'X7GAQYVVRRG6P'
body[:shift][:breaks][0][:start_at] = '2019-01-25T11:11:00+00:00'
body[:shift][:breaks][0][:end_at] = '2019-01-25T11:16:00+00:00'
body[:shift][:breaks][0][:break_type_id] = 'REGS1EQR1TPZ5'
body[:shift][:breaks][0][:name] = 'Tea Break'
body[:shift][:breaks][0][:expected_duration] = 'PT5M'
body[:shift][:breaks][0][:is_paid] = true
body[:shift][:version] = 1
body[:shift][:team_member_id] = 'ormj0jJJZ5OZIzxrZYJI'
result = labor_api.update_shift(id: id, body: body)
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
Returns a paginated list of TeamMemberWage
instances for a business.
def list_team_member_wages(team_member_id: nil,
limit: nil,
cursor: nil)
Parameter | Type | Tags | Description |
---|---|---|---|
team_member_id |
String |
Query, Optional | Filter the returned wages to only those that are associated with the specified team member. |
limit |
Integer |
Query, Optional | The maximum number of TeamMemberWage results to return per page. The number can range between1 and 200. The default is 200. |
cursor |
String |
Query, Optional | A pointer to the next page of EmployeeWage results to fetch. |
List Team Member Wages Response Hash
result = labor_api.list_team_member_wages()
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
Returns a single TeamMemberWage
specified by id
.
def get_team_member_wage(id:)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
String |
Template, Required | The UUID for the TeamMemberWage being retrieved. |
Get Team Member Wage Response Hash
id = 'id0'
result = labor_api.get_team_member_wage(id: id)
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
Returns a list of WorkweekConfig
instances for a business.
def list_workweek_configs(limit: nil,
cursor: nil)
Parameter | Type | Tags | Description |
---|---|---|---|
limit |
Integer |
Query, Optional | The maximum number of WorkweekConfigs results to return per page. |
cursor |
String |
Query, Optional | A pointer to the next page of WorkweekConfig results to fetch. |
List Workweek Configs Response Hash
result = labor_api.list_workweek_configs()
if result.success?
puts result.data
elsif result.error?
warn result.errors
end
Updates a WorkweekConfig
.
def update_workweek_config(id:,
body:)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
String |
Template, Required | The UUID for the WorkweekConfig object being updated. |
body |
Update Workweek Config Request Hash |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Update Workweek Config Response Hash
id = 'id0'
body = {}
body[:workweek_config] = {}
body[:workweek_config][:start_of_week] = 'MON'
body[:workweek_config][:start_of_day_local_time] = '10:00'
body[:workweek_config][:version] = 10
result = labor_api.update_workweek_config(id: id, body: body)
if result.success?
puts result.data
elsif result.error?
warn result.errors
end