square.rb 33.0.0.20231018 → 42.1.0.20250416

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/lib/square/api/apple_pay_api.rb +15 -11
  4. data/lib/square/api/bank_accounts_api.rb +12 -12
  5. data/lib/square/api/base_api.rb +2 -1
  6. data/lib/square/api/booking_custom_attributes_api.rb +44 -44
  7. data/lib/square/api/bookings_api.rb +53 -53
  8. data/lib/square/api/cards_api.rb +16 -16
  9. data/lib/square/api/cash_drawers_api.rb +12 -12
  10. data/lib/square/api/catalog_api.rb +67 -57
  11. data/lib/square/api/checkout_api.rb +111 -26
  12. data/lib/square/api/customer_custom_attributes_api.rb +40 -40
  13. data/lib/square/api/customer_groups_api.rb +20 -20
  14. data/lib/square/api/customer_segments_api.rb +8 -8
  15. data/lib/square/api/customers_api.rb +144 -54
  16. data/lib/square/api/devices_api.rb +20 -20
  17. data/lib/square/api/disputes_api.rb +36 -36
  18. data/lib/square/api/employees_api.rb +8 -8
  19. data/lib/square/api/events_api.rb +84 -0
  20. data/lib/square/api/gift_card_activities_api.rb +10 -11
  21. data/lib/square/api/gift_cards_api.rb +36 -33
  22. data/lib/square/api/inventory_api.rb +52 -52
  23. data/lib/square/api/invoices_api.rb +109 -41
  24. data/lib/square/api/labor_api.rb +81 -80
  25. data/lib/square/api/location_custom_attributes_api.rb +44 -44
  26. data/lib/square/api/locations_api.rb +18 -17
  27. data/lib/square/api/loyalty_api.rb +72 -72
  28. data/lib/square/api/merchant_custom_attributes_api.rb +44 -44
  29. data/lib/square/api/merchants_api.rb +8 -8
  30. data/lib/square/api/mobile_authorization_api.rb +4 -4
  31. data/lib/square/api/o_auth_api.rb +15 -69
  32. data/lib/square/api/order_custom_attributes_api.rb +44 -44
  33. data/lib/square/api/orders_api.rb +32 -32
  34. data/lib/square/api/payments_api.rb +67 -31
  35. data/lib/square/api/payouts_api.rb +12 -12
  36. data/lib/square/api/refunds_api.rb +31 -13
  37. data/lib/square/api/sites_api.rb +4 -4
  38. data/lib/square/api/snippets_api.rb +12 -12
  39. data/lib/square/api/subscriptions_api.rb +48 -48
  40. data/lib/square/api/team_api.rb +146 -40
  41. data/lib/square/api/terminal_api.rb +95 -53
  42. data/lib/square/api/transactions_api.rb +16 -16
  43. data/lib/square/api/v1_transactions_api.rb +13 -292
  44. data/lib/square/api/vendors_api.rb +28 -28
  45. data/lib/square/api/webhook_subscriptions_api.rb +32 -32
  46. data/lib/square/client.rb +32 -24
  47. data/lib/square/configuration.rb +43 -15
  48. data/lib/square/http/api_response.rb +1 -1
  49. data/lib/square/http/auth/o_auth2.rb +21 -2
  50. data/lib/square.rb +4 -3
  51. data/test/api/api_test_base.rb +1 -1
  52. data/test/api/test_locations_api.rb +1 -1
  53. data/test/api/test_refunds_api.rb +4 -1
  54. data/test/webhooks/test_webhooks_helper.rb +17 -0
  55. metadata +12 -17
@@ -14,7 +14,7 @@ module Square
14
14
  # @param [Integer] limit Optional parameter: The maximum number of invoices
15
15
  # to return (200 is the maximum `limit`). If not provided, the server uses
16
16
  # a default limit of 100 invoices.
17
- # @return [ListInvoicesResponse Hash] response from the API call
17
+ # @return [ApiResponse] the complete http response with raw body and status code.
18
18
  def list_invoices(location_id:,
19
19
  cursor: nil,
20
20
  limit: nil)
@@ -28,9 +28,9 @@ module Square
28
28
  .header_param(new_parameter('application/json', key: 'accept'))
29
29
  .auth(Single.new('global')))
30
30
  .response(new_response_handler
31
- .deserializer(APIHelper.method(:json_deserialize))
32
- .is_api_response(true)
33
- .convertor(ApiResponse.method(:create)))
31
+ .deserializer(APIHelper.method(:json_deserialize))
32
+ .is_api_response(true)
33
+ .convertor(ApiResponse.method(:create)))
34
34
  .execute
35
35
  end
36
36
 
@@ -42,7 +42,7 @@ module Square
42
42
  # @param [CreateInvoiceRequest] body Required parameter: An object
43
43
  # containing the fields to POST for the request. See the corresponding
44
44
  # object definition for field details.
45
- # @return [CreateInvoiceResponse Hash] response from the API call
45
+ # @return [ApiResponse] the complete http response with raw body and status code.
46
46
  def create_invoice(body:)
47
47
  new_api_call_builder
48
48
  .request(new_request_builder(HttpMethodEnum::POST,
@@ -54,9 +54,9 @@ module Square
54
54
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
55
55
  .auth(Single.new('global')))
56
56
  .response(new_response_handler
57
- .deserializer(APIHelper.method(:json_deserialize))
58
- .is_api_response(true)
59
- .convertor(ApiResponse.method(:create)))
57
+ .deserializer(APIHelper.method(:json_deserialize))
58
+ .is_api_response(true)
59
+ .convertor(ApiResponse.method(:create)))
60
60
  .execute
61
61
  end
62
62
 
@@ -70,7 +70,7 @@ module Square
70
70
  # @param [SearchInvoicesRequest] body Required parameter: An object
71
71
  # containing the fields to POST for the request. See the corresponding
72
72
  # object definition for field details.
73
- # @return [SearchInvoicesResponse Hash] response from the API call
73
+ # @return [ApiResponse] the complete http response with raw body and status code.
74
74
  def search_invoices(body:)
75
75
  new_api_call_builder
76
76
  .request(new_request_builder(HttpMethodEnum::POST,
@@ -82,9 +82,9 @@ module Square
82
82
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
83
83
  .auth(Single.new('global')))
84
84
  .response(new_response_handler
85
- .deserializer(APIHelper.method(:json_deserialize))
86
- .is_api_response(true)
87
- .convertor(ApiResponse.method(:create)))
85
+ .deserializer(APIHelper.method(:json_deserialize))
86
+ .is_api_response(true)
87
+ .convertor(ApiResponse.method(:create)))
88
88
  .execute
89
89
  end
90
90
 
@@ -98,7 +98,7 @@ module Square
98
98
  # [invoice](entity:Invoice) to delete. If you do not know the version, you
99
99
  # can call [GetInvoice](api-endpoint:Invoices-GetInvoice) or
100
100
  # [ListInvoices](api-endpoint:Invoices-ListInvoices).
101
- # @return [DeleteInvoiceResponse Hash] response from the API call
101
+ # @return [ApiResponse] the complete http response with raw body and status code.
102
102
  def delete_invoice(invoice_id:,
103
103
  version: nil)
104
104
  new_api_call_builder
@@ -111,16 +111,16 @@ module Square
111
111
  .header_param(new_parameter('application/json', key: 'accept'))
112
112
  .auth(Single.new('global')))
113
113
  .response(new_response_handler
114
- .deserializer(APIHelper.method(:json_deserialize))
115
- .is_api_response(true)
116
- .convertor(ApiResponse.method(:create)))
114
+ .deserializer(APIHelper.method(:json_deserialize))
115
+ .is_api_response(true)
116
+ .convertor(ApiResponse.method(:create)))
117
117
  .execute
118
118
  end
119
119
 
120
120
  # Retrieves an invoice by invoice ID.
121
121
  # @param [String] invoice_id Required parameter: The ID of the invoice to
122
122
  # retrieve.
123
- # @return [GetInvoiceResponse Hash] response from the API call
123
+ # @return [ApiResponse] the complete http response with raw body and status code.
124
124
  def get_invoice(invoice_id:)
125
125
  new_api_call_builder
126
126
  .request(new_request_builder(HttpMethodEnum::GET,
@@ -131,26 +131,25 @@ module Square
131
131
  .header_param(new_parameter('application/json', key: 'accept'))
132
132
  .auth(Single.new('global')))
133
133
  .response(new_response_handler
134
- .deserializer(APIHelper.method(:json_deserialize))
135
- .is_api_response(true)
136
- .convertor(ApiResponse.method(:create)))
134
+ .deserializer(APIHelper.method(:json_deserialize))
135
+ .is_api_response(true)
136
+ .convertor(ApiResponse.method(:create)))
137
137
  .execute
138
138
  end
139
139
 
140
- # Updates an invoice by modifying fields, clearing fields, or both. For most
141
- # updates, you can use a sparse
142
- # `Invoice` object to add fields or change values and use the
143
- # `fields_to_clear` field to specify fields to clear.
144
- # However, some restrictions apply. For example, you cannot change the
145
- # `order_id` or `location_id` field and you
146
- # must provide the complete `custom_fields` list to update a custom field.
147
- # Published invoices have additional restrictions.
140
+ # Updates an invoice. This endpoint supports sparse updates, so you only
141
+ # need
142
+ # to specify the fields you want to change along with the required `version`
143
+ # field.
144
+ # Some restrictions apply to updating invoices. For example, you cannot
145
+ # change the
146
+ # `order_id` or `location_id` field.
148
147
  # @param [String] invoice_id Required parameter: The ID of the invoice to
149
148
  # update.
150
149
  # @param [UpdateInvoiceRequest] body Required parameter: An object
151
150
  # containing the fields to POST for the request. See the corresponding
152
151
  # object definition for field details.
153
- # @return [UpdateInvoiceResponse Hash] response from the API call
152
+ # @return [ApiResponse] the complete http response with raw body and status code.
154
153
  def update_invoice(invoice_id:,
155
154
  body:)
156
155
  new_api_call_builder
@@ -165,9 +164,74 @@ module Square
165
164
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
166
165
  .auth(Single.new('global')))
167
166
  .response(new_response_handler
168
- .deserializer(APIHelper.method(:json_deserialize))
169
- .is_api_response(true)
170
- .convertor(ApiResponse.method(:create)))
167
+ .deserializer(APIHelper.method(:json_deserialize))
168
+ .is_api_response(true)
169
+ .convertor(ApiResponse.method(:create)))
170
+ .execute
171
+ end
172
+
173
+ # Uploads a file and attaches it to an invoice. This endpoint accepts HTTP
174
+ # multipart/form-data file uploads
175
+ # with a JSON `request` part and a `file` part. The `file` part must be a
176
+ # `readable stream` that contains a file
177
+ # in a supported format: GIF, JPEG, PNG, TIFF, BMP, or PDF.
178
+ # Invoices can have up to 10 attachments with a total file size of 25 MB.
179
+ # Attachments can be added only to invoices
180
+ # in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state.
181
+ # @param [String] invoice_id Required parameter: The ID of the
182
+ # [invoice](entity:Invoice) to attach the file to.
183
+ # @param [CreateInvoiceAttachmentRequest] request Optional parameter:
184
+ # Represents a
185
+ # [CreateInvoiceAttachment]($e/Invoices/CreateInvoiceAttachment) request.
186
+ # @param [File | UploadIO] image_file Optional parameter: Example:
187
+ # @return [ApiResponse] the complete http response with raw body and status code.
188
+ def create_invoice_attachment(invoice_id:,
189
+ request: nil,
190
+ image_file: nil)
191
+ new_api_call_builder
192
+ .request(new_request_builder(HttpMethodEnum::POST,
193
+ '/v2/invoices/{invoice_id}/attachments',
194
+ 'default')
195
+ .template_param(new_parameter(invoice_id, key: 'invoice_id')
196
+ .should_encode(true))
197
+ .multipart_param(new_parameter(StringIO.new(request.to_json), key: 'request')
198
+ .default_content_type('application/json; charset=utf-8'))
199
+ .multipart_param(new_parameter(image_file, key: 'image_file')
200
+ .default_content_type('image/jpeg'))
201
+ .header_param(new_parameter('application/json', key: 'accept'))
202
+ .auth(Single.new('global')))
203
+ .response(new_response_handler
204
+ .deserializer(APIHelper.method(:json_deserialize))
205
+ .is_api_response(true)
206
+ .convertor(ApiResponse.method(:create)))
207
+ .execute
208
+ end
209
+
210
+ # Removes an attachment from an invoice and permanently deletes the file.
211
+ # Attachments can be removed only
212
+ # from invoices in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID`
213
+ # state.
214
+ # @param [String] invoice_id Required parameter: The ID of the
215
+ # [invoice](entity:Invoice) to delete the attachment from.
216
+ # @param [String] attachment_id Required parameter: The ID of the
217
+ # [attachment](entity:InvoiceAttachment) to delete.
218
+ # @return [ApiResponse] the complete http response with raw body and status code.
219
+ def delete_invoice_attachment(invoice_id:,
220
+ attachment_id:)
221
+ new_api_call_builder
222
+ .request(new_request_builder(HttpMethodEnum::DELETE,
223
+ '/v2/invoices/{invoice_id}/attachments/{attachment_id}',
224
+ 'default')
225
+ .template_param(new_parameter(invoice_id, key: 'invoice_id')
226
+ .should_encode(true))
227
+ .template_param(new_parameter(attachment_id, key: 'attachment_id')
228
+ .should_encode(true))
229
+ .header_param(new_parameter('application/json', key: 'accept'))
230
+ .auth(Single.new('global')))
231
+ .response(new_response_handler
232
+ .deserializer(APIHelper.method(:json_deserialize))
233
+ .is_api_response(true)
234
+ .convertor(ApiResponse.method(:create)))
171
235
  .execute
172
236
  end
173
237
 
@@ -180,7 +244,7 @@ module Square
180
244
  # @param [CancelInvoiceRequest] body Required parameter: An object
181
245
  # containing the fields to POST for the request. See the corresponding
182
246
  # object definition for field details.
183
- # @return [CancelInvoiceResponse Hash] response from the API call
247
+ # @return [ApiResponse] the complete http response with raw body and status code.
184
248
  def cancel_invoice(invoice_id:,
185
249
  body:)
186
250
  new_api_call_builder
@@ -195,9 +259,9 @@ module Square
195
259
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
196
260
  .auth(Single.new('global')))
197
261
  .response(new_response_handler
198
- .deserializer(APIHelper.method(:json_deserialize))
199
- .is_api_response(true)
200
- .convertor(ApiResponse.method(:create)))
262
+ .deserializer(APIHelper.method(:json_deserialize))
263
+ .is_api_response(true)
264
+ .convertor(ApiResponse.method(:create)))
201
265
  .execute
202
266
  end
203
267
 
@@ -211,15 +275,19 @@ module Square
211
275
  # The invoice `status` also changes from `DRAFT` to a status
212
276
  # based on the invoice configuration. For example, the status changes to
213
277
  # `UNPAID` if
214
- # Square emails the invoice or `PARTIALLY_PAID` if Square charge a card on
278
+ # Square emails the invoice or `PARTIALLY_PAID` if Square charges a card on
215
279
  # file for a portion of the
216
280
  # invoice amount.
281
+ # In addition to the required `ORDERS_WRITE` and `INVOICES_WRITE`
282
+ # permissions, `CUSTOMERS_READ`
283
+ # and `PAYMENTS_WRITE` are required when publishing invoices configured for
284
+ # card-on-file payments.
217
285
  # @param [String] invoice_id Required parameter: The ID of the invoice to
218
286
  # publish.
219
287
  # @param [PublishInvoiceRequest] body Required parameter: An object
220
288
  # containing the fields to POST for the request. See the corresponding
221
289
  # object definition for field details.
222
- # @return [PublishInvoiceResponse Hash] response from the API call
290
+ # @return [ApiResponse] the complete http response with raw body and status code.
223
291
  def publish_invoice(invoice_id:,
224
292
  body:)
225
293
  new_api_call_builder
@@ -234,9 +302,9 @@ module Square
234
302
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
235
303
  .auth(Single.new('global')))
236
304
  .response(new_response_handler
237
- .deserializer(APIHelper.method(:json_deserialize))
238
- .is_api_response(true)
239
- .convertor(ApiResponse.method(:create)))
305
+ .deserializer(APIHelper.method(:json_deserialize))
306
+ .is_api_response(true)
307
+ .convertor(ApiResponse.method(:create)))
240
308
  .execute
241
309
  end
242
310
  end
@@ -10,7 +10,7 @@ module Square
10
10
  # 200. The default is 200.
11
11
  # @param [String] cursor Optional parameter: A pointer to the next page of
12
12
  # `BreakType` results to fetch.
13
- # @return [ListBreakTypesResponse Hash] response from the API call
13
+ # @return [ApiResponse] the complete http response with raw body and status code.
14
14
  def list_break_types(location_id: nil,
15
15
  limit: nil,
16
16
  cursor: nil)
@@ -24,9 +24,9 @@ module Square
24
24
  .header_param(new_parameter('application/json', key: 'accept'))
25
25
  .auth(Single.new('global')))
26
26
  .response(new_response_handler
27
- .deserializer(APIHelper.method(:json_deserialize))
28
- .is_api_response(true)
29
- .convertor(ApiResponse.method(:create)))
27
+ .deserializer(APIHelper.method(:json_deserialize))
28
+ .is_api_response(true)
29
+ .convertor(ApiResponse.method(:create)))
30
30
  .execute
31
31
  end
32
32
 
@@ -46,7 +46,7 @@ module Square
46
46
  # @param [CreateBreakTypeRequest] body Required parameter: An object
47
47
  # containing the fields to POST for the request. See the corresponding
48
48
  # object definition for field details.
49
- # @return [CreateBreakTypeResponse Hash] response from the API call
49
+ # @return [ApiResponse] the complete http response with raw body and status code.
50
50
  def create_break_type(body:)
51
51
  new_api_call_builder
52
52
  .request(new_request_builder(HttpMethodEnum::POST,
@@ -58,9 +58,9 @@ module Square
58
58
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
59
59
  .auth(Single.new('global')))
60
60
  .response(new_response_handler
61
- .deserializer(APIHelper.method(:json_deserialize))
62
- .is_api_response(true)
63
- .convertor(ApiResponse.method(:create)))
61
+ .deserializer(APIHelper.method(:json_deserialize))
62
+ .is_api_response(true)
63
+ .convertor(ApiResponse.method(:create)))
64
64
  .execute
65
65
  end
66
66
 
@@ -68,7 +68,7 @@ module Square
68
68
  # A `BreakType` can be deleted even if it is referenced from a `Shift`.
69
69
  # @param [String] id Required parameter: The UUID for the `BreakType` being
70
70
  # deleted.
71
- # @return [DeleteBreakTypeResponse Hash] response from the API call
71
+ # @return [ApiResponse] the complete http response with raw body and status code.
72
72
  def delete_break_type(id:)
73
73
  new_api_call_builder
74
74
  .request(new_request_builder(HttpMethodEnum::DELETE,
@@ -79,16 +79,16 @@ module Square
79
79
  .header_param(new_parameter('application/json', key: 'accept'))
80
80
  .auth(Single.new('global')))
81
81
  .response(new_response_handler
82
- .deserializer(APIHelper.method(:json_deserialize))
83
- .is_api_response(true)
84
- .convertor(ApiResponse.method(:create)))
82
+ .deserializer(APIHelper.method(:json_deserialize))
83
+ .is_api_response(true)
84
+ .convertor(ApiResponse.method(:create)))
85
85
  .execute
86
86
  end
87
87
 
88
88
  # Returns a single `BreakType` specified by `id`.
89
89
  # @param [String] id Required parameter: The UUID for the `BreakType` being
90
90
  # retrieved.
91
- # @return [GetBreakTypeResponse Hash] response from the API call
91
+ # @return [ApiResponse] the complete http response with raw body and status code.
92
92
  def get_break_type(id:)
93
93
  new_api_call_builder
94
94
  .request(new_request_builder(HttpMethodEnum::GET,
@@ -99,9 +99,9 @@ module Square
99
99
  .header_param(new_parameter('application/json', key: 'accept'))
100
100
  .auth(Single.new('global')))
101
101
  .response(new_response_handler
102
- .deserializer(APIHelper.method(:json_deserialize))
103
- .is_api_response(true)
104
- .convertor(ApiResponse.method(:create)))
102
+ .deserializer(APIHelper.method(:json_deserialize))
103
+ .is_api_response(true)
104
+ .convertor(ApiResponse.method(:create)))
105
105
  .execute
106
106
  end
107
107
 
@@ -111,7 +111,7 @@ module Square
111
111
  # @param [UpdateBreakTypeRequest] body Required parameter: An object
112
112
  # containing the fields to POST for the request. See the corresponding
113
113
  # object definition for field details.
114
- # @return [UpdateBreakTypeResponse Hash] response from the API call
114
+ # @return [ApiResponse] the complete http response with raw body and status code.
115
115
  def update_break_type(id:,
116
116
  body:)
117
117
  new_api_call_builder
@@ -126,9 +126,9 @@ module Square
126
126
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
127
127
  .auth(Single.new('global')))
128
128
  .response(new_response_handler
129
- .deserializer(APIHelper.method(:json_deserialize))
130
- .is_api_response(true)
131
- .convertor(ApiResponse.method(:create)))
129
+ .deserializer(APIHelper.method(:json_deserialize))
130
+ .is_api_response(true)
131
+ .convertor(ApiResponse.method(:create)))
132
132
  .execute
133
133
  end
134
134
 
@@ -140,7 +140,7 @@ module Square
140
140
  # and 200. The default is 200.
141
141
  # @param [String] cursor Optional parameter: A pointer to the next page of
142
142
  # `EmployeeWage` results to fetch.
143
- # @return [ListEmployeeWagesResponse Hash] response from the API call
143
+ # @return [ApiResponse] the complete http response with raw body and status code.
144
144
  def list_employee_wages(employee_id: nil,
145
145
  limit: nil,
146
146
  cursor: nil)
@@ -155,16 +155,16 @@ module Square
155
155
  .header_param(new_parameter('application/json', key: 'accept'))
156
156
  .auth(Single.new('global')))
157
157
  .response(new_response_handler
158
- .deserializer(APIHelper.method(:json_deserialize))
159
- .is_api_response(true)
160
- .convertor(ApiResponse.method(:create)))
158
+ .deserializer(APIHelper.method(:json_deserialize))
159
+ .is_api_response(true)
160
+ .convertor(ApiResponse.method(:create)))
161
161
  .execute
162
162
  end
163
163
 
164
164
  # Returns a single `EmployeeWage` specified by `id`.
165
165
  # @param [String] id Required parameter: The UUID for the `EmployeeWage`
166
166
  # being retrieved.
167
- # @return [GetEmployeeWageResponse Hash] response from the API call
167
+ # @return [ApiResponse] the complete http response with raw body and status code.
168
168
  def get_employee_wage(id:)
169
169
  warn 'Endpoint get_employee_wage in LaborApi is deprecated'
170
170
  new_api_call_builder
@@ -176,33 +176,34 @@ module Square
176
176
  .header_param(new_parameter('application/json', key: 'accept'))
177
177
  .auth(Single.new('global')))
178
178
  .response(new_response_handler
179
- .deserializer(APIHelper.method(:json_deserialize))
180
- .is_api_response(true)
181
- .convertor(ApiResponse.method(:create)))
179
+ .deserializer(APIHelper.method(:json_deserialize))
180
+ .is_api_response(true)
181
+ .convertor(ApiResponse.method(:create)))
182
182
  .execute
183
183
  end
184
184
 
185
185
  # Creates a new `Shift`.
186
- # A `Shift` represents a complete workday for a single employee.
186
+ # A `Shift` represents a complete workday for a single team member.
187
187
  # You must provide the following values in your request to this
188
188
  # endpoint:
189
189
  # - `location_id`
190
- # - `employee_id`
190
+ # - `team_member_id`
191
191
  # - `start_at`
192
192
  # An attempt to create a new `Shift` can result in a `BAD_REQUEST` error
193
193
  # when:
194
- # - The `status` of the new `Shift` is `OPEN` and the employee has another
194
+ # - The `status` of the new `Shift` is `OPEN` and the team member has
195
+ # another
195
196
  # shift with an `OPEN` status.
196
197
  # - The `start_at` date is in the future.
197
- # - The `start_at` or `end_at` date overlaps another shift for the same
198
- # employee.
198
+ # - The `start_at` or `end_at` date overlaps another shift for the same team
199
+ # member.
199
200
  # - The `Break` instances are set in the request and a break `start_at`
200
201
  # is before the `Shift.start_at`, a break `end_at` is after
201
202
  # the `Shift.end_at`, or both.
202
203
  # @param [CreateShiftRequest] body Required parameter: An object containing
203
204
  # the fields to POST for the request. See the corresponding object
204
205
  # definition for field details.
205
- # @return [CreateShiftResponse Hash] response from the API call
206
+ # @return [ApiResponse] the complete http response with raw body and status code.
206
207
  def create_shift(body:)
207
208
  new_api_call_builder
208
209
  .request(new_request_builder(HttpMethodEnum::POST,
@@ -214,29 +215,29 @@ module Square
214
215
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
215
216
  .auth(Single.new('global')))
216
217
  .response(new_response_handler
217
- .deserializer(APIHelper.method(:json_deserialize))
218
- .is_api_response(true)
219
- .convertor(ApiResponse.method(:create)))
218
+ .deserializer(APIHelper.method(:json_deserialize))
219
+ .is_api_response(true)
220
+ .convertor(ApiResponse.method(:create)))
220
221
  .execute
221
222
  end
222
223
 
223
224
  # Returns a paginated list of `Shift` records for a business.
224
225
  # The list to be returned can be filtered by:
225
- # - Location IDs.
226
- # - Employee IDs.
227
- # - Shift status (`OPEN` and `CLOSED`).
228
- # - Shift start.
229
- # - Shift end.
230
- # - Workday details.
226
+ # - Location IDs
227
+ # - Team member IDs
228
+ # - Shift status (`OPEN` or `CLOSED`)
229
+ # - Shift start
230
+ # - Shift end
231
+ # - Workday details
231
232
  # The list can be sorted by:
232
- # - `start_at`.
233
- # - `end_at`.
234
- # - `created_at`.
235
- # - `updated_at`.
233
+ # - `START_AT`
234
+ # - `END_AT`
235
+ # - `CREATED_AT`
236
+ # - `UPDATED_AT`
236
237
  # @param [SearchShiftsRequest] body Required parameter: An object containing
237
238
  # the fields to POST for the request. See the corresponding object
238
239
  # definition for field details.
239
- # @return [SearchShiftsResponse Hash] response from the API call
240
+ # @return [ApiResponse] the complete http response with raw body and status code.
240
241
  def search_shifts(body:)
241
242
  new_api_call_builder
242
243
  .request(new_request_builder(HttpMethodEnum::POST,
@@ -248,16 +249,16 @@ module Square
248
249
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
249
250
  .auth(Single.new('global')))
250
251
  .response(new_response_handler
251
- .deserializer(APIHelper.method(:json_deserialize))
252
- .is_api_response(true)
253
- .convertor(ApiResponse.method(:create)))
252
+ .deserializer(APIHelper.method(:json_deserialize))
253
+ .is_api_response(true)
254
+ .convertor(ApiResponse.method(:create)))
254
255
  .execute
255
256
  end
256
257
 
257
258
  # Deletes a `Shift`.
258
259
  # @param [String] id Required parameter: The UUID for the `Shift` being
259
260
  # deleted.
260
- # @return [DeleteShiftResponse Hash] response from the API call
261
+ # @return [ApiResponse] the complete http response with raw body and status code.
261
262
  def delete_shift(id:)
262
263
  new_api_call_builder
263
264
  .request(new_request_builder(HttpMethodEnum::DELETE,
@@ -268,16 +269,16 @@ module Square
268
269
  .header_param(new_parameter('application/json', key: 'accept'))
269
270
  .auth(Single.new('global')))
270
271
  .response(new_response_handler
271
- .deserializer(APIHelper.method(:json_deserialize))
272
- .is_api_response(true)
273
- .convertor(ApiResponse.method(:create)))
272
+ .deserializer(APIHelper.method(:json_deserialize))
273
+ .is_api_response(true)
274
+ .convertor(ApiResponse.method(:create)))
274
275
  .execute
275
276
  end
276
277
 
277
278
  # Returns a single `Shift` specified by `id`.
278
279
  # @param [String] id Required parameter: The UUID for the `Shift` being
279
280
  # retrieved.
280
- # @return [GetShiftResponse Hash] response from the API call
281
+ # @return [ApiResponse] the complete http response with raw body and status code.
281
282
  def get_shift(id:)
282
283
  new_api_call_builder
283
284
  .request(new_request_builder(HttpMethodEnum::GET,
@@ -288,9 +289,9 @@ module Square
288
289
  .header_param(new_parameter('application/json', key: 'accept'))
289
290
  .auth(Single.new('global')))
290
291
  .response(new_response_handler
291
- .deserializer(APIHelper.method(:json_deserialize))
292
- .is_api_response(true)
293
- .convertor(ApiResponse.method(:create)))
292
+ .deserializer(APIHelper.method(:json_deserialize))
293
+ .is_api_response(true)
294
+ .convertor(ApiResponse.method(:create)))
294
295
  .execute
295
296
  end
296
297
 
@@ -306,7 +307,7 @@ module Square
306
307
  # @param [UpdateShiftRequest] body Required parameter: An object containing
307
308
  # the fields to POST for the request. See the corresponding object
308
309
  # definition for field details.
309
- # @return [UpdateShiftResponse Hash] response from the API call
310
+ # @return [ApiResponse] the complete http response with raw body and status code.
310
311
  def update_shift(id:,
311
312
  body:)
312
313
  new_api_call_builder
@@ -321,9 +322,9 @@ module Square
321
322
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
322
323
  .auth(Single.new('global')))
323
324
  .response(new_response_handler
324
- .deserializer(APIHelper.method(:json_deserialize))
325
- .is_api_response(true)
326
- .convertor(ApiResponse.method(:create)))
325
+ .deserializer(APIHelper.method(:json_deserialize))
326
+ .is_api_response(true)
327
+ .convertor(ApiResponse.method(:create)))
327
328
  .execute
328
329
  end
329
330
 
@@ -335,7 +336,7 @@ module Square
335
336
  # 1 and 200. The default is 200.
336
337
  # @param [String] cursor Optional parameter: A pointer to the next page of
337
338
  # `EmployeeWage` results to fetch.
338
- # @return [ListTeamMemberWagesResponse Hash] response from the API call
339
+ # @return [ApiResponse] the complete http response with raw body and status code.
339
340
  def list_team_member_wages(team_member_id: nil,
340
341
  limit: nil,
341
342
  cursor: nil)
@@ -349,16 +350,16 @@ module Square
349
350
  .header_param(new_parameter('application/json', key: 'accept'))
350
351
  .auth(Single.new('global')))
351
352
  .response(new_response_handler
352
- .deserializer(APIHelper.method(:json_deserialize))
353
- .is_api_response(true)
354
- .convertor(ApiResponse.method(:create)))
353
+ .deserializer(APIHelper.method(:json_deserialize))
354
+ .is_api_response(true)
355
+ .convertor(ApiResponse.method(:create)))
355
356
  .execute
356
357
  end
357
358
 
358
- # Returns a single `TeamMemberWage` specified by `id `.
359
+ # Returns a single `TeamMemberWage` specified by `id`.
359
360
  # @param [String] id Required parameter: The UUID for the `TeamMemberWage`
360
361
  # being retrieved.
361
- # @return [GetTeamMemberWageResponse Hash] response from the API call
362
+ # @return [ApiResponse] the complete http response with raw body and status code.
362
363
  def get_team_member_wage(id:)
363
364
  new_api_call_builder
364
365
  .request(new_request_builder(HttpMethodEnum::GET,
@@ -369,9 +370,9 @@ module Square
369
370
  .header_param(new_parameter('application/json', key: 'accept'))
370
371
  .auth(Single.new('global')))
371
372
  .response(new_response_handler
372
- .deserializer(APIHelper.method(:json_deserialize))
373
- .is_api_response(true)
374
- .convertor(ApiResponse.method(:create)))
373
+ .deserializer(APIHelper.method(:json_deserialize))
374
+ .is_api_response(true)
375
+ .convertor(ApiResponse.method(:create)))
375
376
  .execute
376
377
  end
377
378
 
@@ -380,7 +381,7 @@ module Square
380
381
  # `WorkweekConfigs` results to return per page.
381
382
  # @param [String] cursor Optional parameter: A pointer to the next page of
382
383
  # `WorkweekConfig` results to fetch.
383
- # @return [ListWorkweekConfigsResponse Hash] response from the API call
384
+ # @return [ApiResponse] the complete http response with raw body and status code.
384
385
  def list_workweek_configs(limit: nil,
385
386
  cursor: nil)
386
387
  new_api_call_builder
@@ -392,9 +393,9 @@ module Square
392
393
  .header_param(new_parameter('application/json', key: 'accept'))
393
394
  .auth(Single.new('global')))
394
395
  .response(new_response_handler
395
- .deserializer(APIHelper.method(:json_deserialize))
396
- .is_api_response(true)
397
- .convertor(ApiResponse.method(:create)))
396
+ .deserializer(APIHelper.method(:json_deserialize))
397
+ .is_api_response(true)
398
+ .convertor(ApiResponse.method(:create)))
398
399
  .execute
399
400
  end
400
401
 
@@ -404,7 +405,7 @@ module Square
404
405
  # @param [UpdateWorkweekConfigRequest] body Required parameter: An object
405
406
  # containing the fields to POST for the request. See the corresponding
406
407
  # object definition for field details.
407
- # @return [UpdateWorkweekConfigResponse Hash] response from the API call
408
+ # @return [ApiResponse] the complete http response with raw body and status code.
408
409
  def update_workweek_config(id:,
409
410
  body:)
410
411
  new_api_call_builder
@@ -419,9 +420,9 @@ module Square
419
420
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
420
421
  .auth(Single.new('global')))
421
422
  .response(new_response_handler
422
- .deserializer(APIHelper.method(:json_deserialize))
423
- .is_api_response(true)
424
- .convertor(ApiResponse.method(:create)))
423
+ .deserializer(APIHelper.method(:json_deserialize))
424
+ .is_api_response(true)
425
+ .convertor(ApiResponse.method(:create)))
425
426
  .execute
426
427
  end
427
428
  end