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. |
This method returns a ApiResponse
instance. The data
property in this instance returns the response data which is of type 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. |
This method returns a ApiResponse
instance. The data
property in this instance returns the response data which is of type Create Break Type Response Hash
.
body = {
:break_type => {
:location_id => 'CGJN03P1D08GF',
:break_name => 'Lunch Break',
:expected_duration => 'PT30M',
:is_paid => true
},
:idempotency_key => 'PAD3NG5KSN2GL'
}
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. |
This method returns a ApiResponse
instance. The data
property in this instance returns the response data which is of type 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. |
This method returns a ApiResponse
instance. The data
property in this instance returns the response data which is of type Get Break Type Response Hash
.
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. |
This method returns a ApiResponse
instance. The data
property in this instance returns the response data which is of type Update Break Type Response Hash
.
id = 'id0'
body = {
:break_type => {
:location_id => '26M7H24AZ9N6R',
:break_name => 'Lunch',
:expected_duration => 'PT50M',
:is_paid => true,
: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. |
This method returns a ApiResponse
instance. The data
property in this instance returns the response data which is of type 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. |
This method returns a ApiResponse
instance. The data
property in this instance returns the response data which is of type 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 team member.
You must provide the following values in your request to this
endpoint:
location_id
team_member_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 team member 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 team member. - 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. |
This method returns a ApiResponse
instance. The data
property in this instance returns the response data which is of type Create Shift Response Hash
.
body = {
:shift => {
:location_id => 'PAA1RJZZKXBFG',
:start_at => '2019-01-25T03:11:00-05:00',
:end_at => '2019-01-25T13:11:00-05:00',
:wage => {
:title => 'Barista',
:hourly_rate => {
:amount => 1100,
:currency => 'USD'
},
:tip_eligible => true
},
:breaks => [
{
:start_at => '2019-01-25T06:11:00-05:00',
:break_type_id => 'REGS1EQR1TPZ5',
:name => 'Tea Break',
:expected_duration => 'PT5M',
:is_paid => true,
:end_at => '2019-01-25T06:16:00-05:00'
}
],
:team_member_id => 'ormj0jJJZ5OZIzxrZYJI',
:declared_cash_tip_money => {
:amount => 500,
:currency => 'USD'
}
},
:idempotency_key => 'HIDSNG5KS478L'
}
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
- Team member IDs
- Shift status (
OPEN
orCLOSED
) - 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. |
This method returns a ApiResponse
instance. The data
property in this instance returns the response data which is of type Search Shifts Response Hash
.
body = {
:query => {
:filter => {
:workday => {
:date_range => {
:start_date => '2019-01-20',
:end_date => '2019-02-03'
},
:match_shifts_by => 'START_AT',
:default_timezone => 'America/Los_Angeles'
}
}
},
: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. |
This method returns a ApiResponse
instance. The data
property in this instance returns the response data which is of type Delete Shift Response Hash
.
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. |
This method returns a ApiResponse
instance. The data
property in this instance returns the response data which is of type Get Shift Response Hash
.
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. |
This method returns a ApiResponse
instance. The data
property in this instance returns the response data which is of type Update Shift Response Hash
.
id = 'id0'
body = {
:shift => {
:location_id => 'PAA1RJZZKXBFG',
:start_at => '2019-01-25T03:11:00-05:00',
:end_at => '2019-01-25T13:11:00-05:00',
:wage => {
:title => 'Bartender',
:hourly_rate => {
:amount => 1500,
:currency => 'USD'
},
:tip_eligible => true
},
:breaks => [
{
:start_at => '2019-01-25T06:11:00-05:00',
:break_type_id => 'REGS1EQR1TPZ5',
:name => 'Tea Break',
:expected_duration => 'PT5M',
:is_paid => true,
:id => 'X7GAQYVVRRG6P',
:end_at => '2019-01-25T06:16:00-05:00'
}
],
:version => 1,
:team_member_id => 'ormj0jJJZ5OZIzxrZYJI',
:declared_cash_tip_money => {
:amount => 500,
:currency => 'USD'
}
}
}
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. |
This method returns a ApiResponse
instance. The data
property in this instance returns the response data which is of type 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. |
This method returns a ApiResponse
instance. The data
property in this instance returns the response data which is of type 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. |
This method returns a ApiResponse
instance. The data
property in this instance returns the response data which is of type 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. |
This method returns a ApiResponse
instance. The data
property in this instance returns the response data which is of type Update Workweek Config Response Hash
.
id = 'id0'
body = {
:workweek_config => {
:start_of_week => 'MON',
:start_of_day_local_time => '10:00',
: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