square.rb 6.2.0.20200812 → 8.0.0.20201216

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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +34 -33
  3. data/lib/square.rb +61 -62
  4. data/lib/square/api/apple_pay_api.rb +5 -3
  5. data/lib/square/api/bank_accounts_api.rb +16 -19
  6. data/lib/square/api/base_api.rb +1 -1
  7. data/lib/square/api/bookings_api.rb +308 -0
  8. data/lib/square/api/cash_drawers_api.rb +13 -6
  9. data/lib/square/api/catalog_api.rb +68 -32
  10. data/lib/square/api/checkout_api.rb +4 -2
  11. data/lib/square/api/customer_groups_api.rb +18 -8
  12. data/lib/square/api/customer_segments_api.rb +9 -5
  13. data/lib/square/api/customers_api.rb +47 -27
  14. data/lib/square/api/devices_api.rb +17 -6
  15. data/lib/square/api/disputes_api.rb +71 -68
  16. data/lib/square/api/employees_api.rb +10 -5
  17. data/lib/square/api/inventory_api.rb +30 -15
  18. data/lib/square/api/invoices_api.rb +42 -38
  19. data/lib/square/api/labor_api.rb +131 -22
  20. data/lib/square/api/locations_api.rb +16 -13
  21. data/lib/square/api/loyalty_api.rb +60 -66
  22. data/lib/square/api/merchants_api.rb +7 -3
  23. data/lib/square/api/mobile_authorization_api.rb +5 -3
  24. data/lib/square/api/o_auth_api.rb +11 -8
  25. data/lib/square/api/orders_api.rb +111 -90
  26. data/lib/square/api/payments_api.rb +75 -65
  27. data/lib/square/api/refunds_api.rb +37 -27
  28. data/lib/square/api/subscriptions_api.rb +29 -28
  29. data/lib/square/api/team_api.rb +46 -30
  30. data/lib/square/api/terminal_api.rb +156 -7
  31. data/lib/square/api/transactions_api.rb +32 -18
  32. data/lib/square/api/v1_employees_api.rb +59 -31
  33. data/lib/square/api/v1_items_api.rb +195 -115
  34. data/lib/square/api/v1_transactions_api.rb +49 -27
  35. data/lib/square/api_helper.rb +14 -9
  36. data/lib/square/client.rb +14 -20
  37. data/lib/square/configuration.rb +2 -2
  38. data/lib/square/http/api_response.rb +2 -0
  39. data/lib/square/http/faraday_client.rb +9 -2
  40. data/spec/user_journey_spec.rb +2 -5
  41. data/test/api/api_test_base.rb +1 -6
  42. data/test/api/test_catalog_api.rb +1 -4
  43. data/test/api/test_customers_api.rb +1 -4
  44. data/test/api/test_employees_api.rb +1 -4
  45. data/test/api/test_labor_api.rb +2 -6
  46. data/test/api/test_locations_api.rb +22 -33
  47. data/test/api/test_merchants_api.rb +1 -4
  48. data/test/api/test_payments_api.rb +3 -6
  49. data/test/api/test_refunds_api.rb +3 -6
  50. data/test/http_response_catcher.rb +0 -5
  51. data/test/test_helper.rb +0 -5
  52. metadata +33 -16
  53. data/lib/square/api/reporting_api.rb +0 -138
  54. data/lib/square/api/v1_locations_api.rb +0 -65
@@ -35,7 +35,9 @@ module Square
35
35
  # Return appropriate response type.
36
36
  decoded = APIHelper.json_deserialize(_response.raw_body)
37
37
  _errors = APIHelper.map_response(decoded, ['errors'])
38
- ApiResponse.new(_response, data: decoded, errors: _errors)
38
+ ApiResponse.new(
39
+ _response, data: decoded, errors: _errors
40
+ )
39
41
  end
40
42
 
41
43
  # Retrieves a filtered list of Terminal checkout requests created by the
@@ -68,7 +70,9 @@ module Square
68
70
  # Return appropriate response type.
69
71
  decoded = APIHelper.json_deserialize(_response.raw_body)
70
72
  _errors = APIHelper.map_response(decoded, ['errors'])
71
- ApiResponse.new(_response, data: decoded, errors: _errors)
73
+ ApiResponse.new(
74
+ _response, data: decoded, errors: _errors
75
+ )
72
76
  end
73
77
 
74
78
  # Retrieves a Terminal checkout request by checkout_id.
@@ -81,7 +85,7 @@ module Square
81
85
  _query_builder << '/v2/terminals/checkouts/{checkout_id}'
82
86
  _query_builder = APIHelper.append_url_with_template_parameters(
83
87
  _query_builder,
84
- 'checkout_id' => checkout_id
88
+ 'checkout_id' => { 'value' => checkout_id, 'encode' => true }
85
89
  )
86
90
  _query_url = APIHelper.clean_url _query_builder
87
91
 
@@ -101,10 +105,12 @@ module Square
101
105
  # Return appropriate response type.
102
106
  decoded = APIHelper.json_deserialize(_response.raw_body)
103
107
  _errors = APIHelper.map_response(decoded, ['errors'])
104
- ApiResponse.new(_response, data: decoded, errors: _errors)
108
+ ApiResponse.new(
109
+ _response, data: decoded, errors: _errors
110
+ )
105
111
  end
106
112
 
107
- # Cancels a Terminal checkout request, if the status of the request permits
113
+ # Cancels a Terminal checkout request if the status of the request permits
108
114
  # it.
109
115
  # @param [String] checkout_id Required parameter: Unique ID for the desired
110
116
  # `TerminalCheckout`
@@ -115,7 +121,148 @@ module Square
115
121
  _query_builder << '/v2/terminals/checkouts/{checkout_id}/cancel'
116
122
  _query_builder = APIHelper.append_url_with_template_parameters(
117
123
  _query_builder,
118
- 'checkout_id' => checkout_id
124
+ 'checkout_id' => { 'value' => checkout_id, 'encode' => true }
125
+ )
126
+ _query_url = APIHelper.clean_url _query_builder
127
+
128
+ # Prepare headers.
129
+ _headers = {
130
+ 'accept' => 'application/json'
131
+ }
132
+
133
+ # Prepare and execute HttpRequest.
134
+ _request = config.http_client.post(
135
+ _query_url,
136
+ headers: _headers
137
+ )
138
+ OAuth2.apply(config, _request)
139
+ _response = execute_request(_request)
140
+
141
+ # Return appropriate response type.
142
+ decoded = APIHelper.json_deserialize(_response.raw_body)
143
+ _errors = APIHelper.map_response(decoded, ['errors'])
144
+ ApiResponse.new(
145
+ _response, data: decoded, errors: _errors
146
+ )
147
+ end
148
+
149
+ # Creates a request to refund an Interac payment completed on a Square
150
+ # Terminal.
151
+ # @param [CreateTerminalRefundRequest] body Required parameter: An object
152
+ # containing the fields to POST for the request. See the corresponding
153
+ # object definition for field details.
154
+ # @return [CreateTerminalRefundResponse Hash] response from the API call
155
+ def create_terminal_refund(body:)
156
+ # Prepare query url.
157
+ _query_builder = config.get_base_uri
158
+ _query_builder << '/v2/terminals/refunds'
159
+ _query_url = APIHelper.clean_url _query_builder
160
+
161
+ # Prepare headers.
162
+ _headers = {
163
+ 'accept' => 'application/json',
164
+ 'content-type' => 'application/json; charset=utf-8'
165
+ }
166
+
167
+ # Prepare and execute HttpRequest.
168
+ _request = config.http_client.post(
169
+ _query_url,
170
+ headers: _headers,
171
+ parameters: body.to_json
172
+ )
173
+ OAuth2.apply(config, _request)
174
+ _response = execute_request(_request)
175
+
176
+ # Return appropriate response type.
177
+ decoded = APIHelper.json_deserialize(_response.raw_body)
178
+ _errors = APIHelper.map_response(decoded, ['errors'])
179
+ ApiResponse.new(
180
+ _response, data: decoded, errors: _errors
181
+ )
182
+ end
183
+
184
+ # Retrieves a filtered list of Terminal Interac refund requests created by
185
+ # the seller making the request.
186
+ # @param [SearchTerminalRefundsRequest] body Required parameter: An object
187
+ # containing the fields to POST for the request. See the corresponding
188
+ # object definition for field details.
189
+ # @return [SearchTerminalRefundsResponse Hash] response from the API call
190
+ def search_terminal_refunds(body:)
191
+ # Prepare query url.
192
+ _query_builder = config.get_base_uri
193
+ _query_builder << '/v2/terminals/refunds/search'
194
+ _query_url = APIHelper.clean_url _query_builder
195
+
196
+ # Prepare headers.
197
+ _headers = {
198
+ 'accept' => 'application/json',
199
+ 'content-type' => 'application/json; charset=utf-8'
200
+ }
201
+
202
+ # Prepare and execute HttpRequest.
203
+ _request = config.http_client.post(
204
+ _query_url,
205
+ headers: _headers,
206
+ parameters: body.to_json
207
+ )
208
+ OAuth2.apply(config, _request)
209
+ _response = execute_request(_request)
210
+
211
+ # Return appropriate response type.
212
+ decoded = APIHelper.json_deserialize(_response.raw_body)
213
+ _errors = APIHelper.map_response(decoded, ['errors'])
214
+ ApiResponse.new(
215
+ _response, data: decoded, errors: _errors
216
+ )
217
+ end
218
+
219
+ # Retrieves an Interac terminal refund object by ID.
220
+ # @param [String] terminal_refund_id Required parameter: Unique ID for the
221
+ # desired `TerminalRefund`
222
+ # @return [GetTerminalRefundResponse Hash] response from the API call
223
+ def get_terminal_refund(terminal_refund_id:)
224
+ # Prepare query url.
225
+ _query_builder = config.get_base_uri
226
+ _query_builder << '/v2/terminals/refunds/{terminal_refund_id}'
227
+ _query_builder = APIHelper.append_url_with_template_parameters(
228
+ _query_builder,
229
+ 'terminal_refund_id' => { 'value' => terminal_refund_id, 'encode' => true }
230
+ )
231
+ _query_url = APIHelper.clean_url _query_builder
232
+
233
+ # Prepare headers.
234
+ _headers = {
235
+ 'accept' => 'application/json'
236
+ }
237
+
238
+ # Prepare and execute HttpRequest.
239
+ _request = config.http_client.get(
240
+ _query_url,
241
+ headers: _headers
242
+ )
243
+ OAuth2.apply(config, _request)
244
+ _response = execute_request(_request)
245
+
246
+ # Return appropriate response type.
247
+ decoded = APIHelper.json_deserialize(_response.raw_body)
248
+ _errors = APIHelper.map_response(decoded, ['errors'])
249
+ ApiResponse.new(
250
+ _response, data: decoded, errors: _errors
251
+ )
252
+ end
253
+
254
+ # Cancels an Interac terminal refund request by refund request ID if the
255
+ # status of the request permits it.
256
+ # @param [String] terminal_refund_id Required parameter: Unique ID for the
257
+ # desired `TerminalRefund`
258
+ # @return [CancelTerminalRefundResponse Hash] response from the API call
259
+ def cancel_terminal_refund(terminal_refund_id:)
260
+ # Prepare query url.
261
+ _query_builder = config.get_base_uri
262
+ _query_builder << '/v2/terminals/refunds/{terminal_refund_id}/cancel'
263
+ _query_builder = APIHelper.append_url_with_template_parameters(
264
+ _query_builder,
265
+ 'terminal_refund_id' => { 'value' => terminal_refund_id, 'encode' => true }
119
266
  )
120
267
  _query_url = APIHelper.clean_url _query_builder
121
268
 
@@ -135,7 +282,9 @@ module Square
135
282
  # Return appropriate response type.
136
283
  decoded = APIHelper.json_deserialize(_response.raw_body)
137
284
  _errors = APIHelper.map_response(decoded, ['errors'])
138
- ApiResponse.new(_response, data: decoded, errors: _errors)
285
+ ApiResponse.new(
286
+ _response, data: decoded, errors: _errors
287
+ )
139
288
  end
140
289
  end
141
290
  end
@@ -42,7 +42,7 @@ module Square
42
42
  _query_builder << '/v2/locations/{location_id}/refunds'
43
43
  _query_builder = APIHelper.append_url_with_template_parameters(
44
44
  _query_builder,
45
- 'location_id' => location_id
45
+ 'location_id' => { 'value' => location_id, 'encode' => true }
46
46
  )
47
47
  _query_builder = APIHelper.append_url_with_query_parameters(
48
48
  _query_builder,
@@ -69,7 +69,9 @@ module Square
69
69
  # Return appropriate response type.
70
70
  decoded = APIHelper.json_deserialize(_response.raw_body)
71
71
  _errors = APIHelper.map_response(decoded, ['errors'])
72
- ApiResponse.new(_response, data: decoded, errors: _errors)
72
+ ApiResponse.new(
73
+ _response, data: decoded, errors: _errors
74
+ )
73
75
  end
74
76
 
75
77
  # Lists transactions for a particular location.
@@ -106,7 +108,7 @@ module Square
106
108
  _query_builder << '/v2/locations/{location_id}/transactions'
107
109
  _query_builder = APIHelper.append_url_with_template_parameters(
108
110
  _query_builder,
109
- 'location_id' => location_id
111
+ 'location_id' => { 'value' => location_id, 'encode' => true }
110
112
  )
111
113
  _query_builder = APIHelper.append_url_with_query_parameters(
112
114
  _query_builder,
@@ -133,7 +135,9 @@ module Square
133
135
  # Return appropriate response type.
134
136
  decoded = APIHelper.json_deserialize(_response.raw_body)
135
137
  _errors = APIHelper.map_response(decoded, ['errors'])
136
- ApiResponse.new(_response, data: decoded, errors: _errors)
138
+ ApiResponse.new(
139
+ _response, data: decoded, errors: _errors
140
+ )
137
141
  end
138
142
 
139
143
  # Charges a card represented by a card nonce or a customer's card on file.
@@ -169,7 +173,7 @@ module Square
169
173
  _query_builder << '/v2/locations/{location_id}/transactions'
170
174
  _query_builder = APIHelper.append_url_with_template_parameters(
171
175
  _query_builder,
172
- 'location_id' => location_id
176
+ 'location_id' => { 'value' => location_id, 'encode' => true }
173
177
  )
174
178
  _query_url = APIHelper.clean_url _query_builder
175
179
 
@@ -191,7 +195,9 @@ module Square
191
195
  # Return appropriate response type.
192
196
  decoded = APIHelper.json_deserialize(_response.raw_body)
193
197
  _errors = APIHelper.map_response(decoded, ['errors'])
194
- ApiResponse.new(_response, data: decoded, errors: _errors)
198
+ ApiResponse.new(
199
+ _response, data: decoded, errors: _errors
200
+ )
195
201
  end
196
202
 
197
203
  # Retrieves details for a single transaction.
@@ -208,8 +214,8 @@ module Square
208
214
  _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}'
209
215
  _query_builder = APIHelper.append_url_with_template_parameters(
210
216
  _query_builder,
211
- 'location_id' => location_id,
212
- 'transaction_id' => transaction_id
217
+ 'location_id' => { 'value' => location_id, 'encode' => true },
218
+ 'transaction_id' => { 'value' => transaction_id, 'encode' => true }
213
219
  )
214
220
  _query_url = APIHelper.clean_url _query_builder
215
221
 
@@ -229,7 +235,9 @@ module Square
229
235
  # Return appropriate response type.
230
236
  decoded = APIHelper.json_deserialize(_response.raw_body)
231
237
  _errors = APIHelper.map_response(decoded, ['errors'])
232
- ApiResponse.new(_response, data: decoded, errors: _errors)
238
+ ApiResponse.new(
239
+ _response, data: decoded, errors: _errors
240
+ )
233
241
  end
234
242
 
235
243
  # Captures a transaction that was created with the
@@ -250,8 +258,8 @@ module Square
250
258
  _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}/capture'
251
259
  _query_builder = APIHelper.append_url_with_template_parameters(
252
260
  _query_builder,
253
- 'location_id' => location_id,
254
- 'transaction_id' => transaction_id
261
+ 'location_id' => { 'value' => location_id, 'encode' => true },
262
+ 'transaction_id' => { 'value' => transaction_id, 'encode' => true }
255
263
  )
256
264
  _query_url = APIHelper.clean_url _query_builder
257
265
 
@@ -271,7 +279,9 @@ module Square
271
279
  # Return appropriate response type.
272
280
  decoded = APIHelper.json_deserialize(_response.raw_body)
273
281
  _errors = APIHelper.map_response(decoded, ['errors'])
274
- ApiResponse.new(_response, data: decoded, errors: _errors)
282
+ ApiResponse.new(
283
+ _response, data: decoded, errors: _errors
284
+ )
275
285
  end
276
286
 
277
287
  # Initiates a refund for a previously charged tender.
@@ -299,8 +309,8 @@ module Square
299
309
  _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}/refund'
300
310
  _query_builder = APIHelper.append_url_with_template_parameters(
301
311
  _query_builder,
302
- 'location_id' => location_id,
303
- 'transaction_id' => transaction_id
312
+ 'location_id' => { 'value' => location_id, 'encode' => true },
313
+ 'transaction_id' => { 'value' => transaction_id, 'encode' => true }
304
314
  )
305
315
  _query_url = APIHelper.clean_url _query_builder
306
316
 
@@ -322,7 +332,9 @@ module Square
322
332
  # Return appropriate response type.
323
333
  decoded = APIHelper.json_deserialize(_response.raw_body)
324
334
  _errors = APIHelper.map_response(decoded, ['errors'])
325
- ApiResponse.new(_response, data: decoded, errors: _errors)
335
+ ApiResponse.new(
336
+ _response, data: decoded, errors: _errors
337
+ )
326
338
  end
327
339
 
328
340
  # Cancels a transaction that was created with the [Charge](#endpoint-charge)
@@ -342,8 +354,8 @@ module Square
342
354
  _query_builder << '/v2/locations/{location_id}/transactions/{transaction_id}/void'
343
355
  _query_builder = APIHelper.append_url_with_template_parameters(
344
356
  _query_builder,
345
- 'location_id' => location_id,
346
- 'transaction_id' => transaction_id
357
+ 'location_id' => { 'value' => location_id, 'encode' => true },
358
+ 'transaction_id' => { 'value' => transaction_id, 'encode' => true }
347
359
  )
348
360
  _query_url = APIHelper.clean_url _query_builder
349
361
 
@@ -363,7 +375,9 @@ module Square
363
375
  # Return appropriate response type.
364
376
  decoded = APIHelper.json_deserialize(_response.raw_body)
365
377
  _errors = APIHelper.map_response(decoded, ['errors'])
366
- ApiResponse.new(_response, data: decoded, errors: _errors)
378
+ ApiResponse.new(
379
+ _response, data: decoded, errors: _errors
380
+ )
367
381
  end
368
382
  end
369
383
  end
@@ -75,7 +75,9 @@ module Square
75
75
  # Return appropriate response type.
76
76
  decoded = APIHelper.json_deserialize(_response.raw_body)
77
77
  _errors = APIHelper.map_response(decoded, ['errors'])
78
- ApiResponse.new(_response, data: decoded, errors: _errors)
78
+ ApiResponse.new(
79
+ _response, data: decoded, errors: _errors
80
+ )
79
81
  end
80
82
 
81
83
  # Use the CreateEmployee endpoint to add an employee to a Square
@@ -83,10 +85,8 @@ module Square
83
85
  # of `INACTIVE`. Inactive employees cannot sign in to Square Point of Sale
84
86
  # until they are activated from the Square Dashboard. Employee status
85
87
  # cannot be changed with the Connect API.
86
- # <aside class="important">
87
88
  # Employee entities cannot be deleted. To disable employee profiles,
88
89
  # set the employee's status to <code>INACTIVE</code>
89
- # </aside>
90
90
  # @param [V1Employee] body Required parameter: An object containing the
91
91
  # fields to POST for the request. See the corresponding object definition
92
92
  # for field details.
@@ -115,7 +115,9 @@ module Square
115
115
  # Return appropriate response type.
116
116
  decoded = APIHelper.json_deserialize(_response.raw_body)
117
117
  _errors = APIHelper.map_response(decoded, ['errors'])
118
- ApiResponse.new(_response, data: decoded, errors: _errors)
118
+ ApiResponse.new(
119
+ _response, data: decoded, errors: _errors
120
+ )
119
121
  end
120
122
 
121
123
  # Provides the details for a single employee.
@@ -127,7 +129,7 @@ module Square
127
129
  _query_builder << '/v1/me/employees/{employee_id}'
128
130
  _query_builder = APIHelper.append_url_with_template_parameters(
129
131
  _query_builder,
130
- 'employee_id' => employee_id
132
+ 'employee_id' => { 'value' => employee_id, 'encode' => true }
131
133
  )
132
134
  _query_url = APIHelper.clean_url _query_builder
133
135
 
@@ -147,7 +149,9 @@ module Square
147
149
  # Return appropriate response type.
148
150
  decoded = APIHelper.json_deserialize(_response.raw_body)
149
151
  _errors = APIHelper.map_response(decoded, ['errors'])
150
- ApiResponse.new(_response, data: decoded, errors: _errors)
152
+ ApiResponse.new(
153
+ _response, data: decoded, errors: _errors
154
+ )
151
155
  end
152
156
 
153
157
  # UpdateEmployee
@@ -164,7 +168,7 @@ module Square
164
168
  _query_builder << '/v1/me/employees/{employee_id}'
165
169
  _query_builder = APIHelper.append_url_with_template_parameters(
166
170
  _query_builder,
167
- 'employee_id' => employee_id
171
+ 'employee_id' => { 'value' => employee_id, 'encode' => true }
168
172
  )
169
173
  _query_url = APIHelper.clean_url _query_builder
170
174
 
@@ -186,7 +190,9 @@ module Square
186
190
  # Return appropriate response type.
187
191
  decoded = APIHelper.json_deserialize(_response.raw_body)
188
192
  _errors = APIHelper.map_response(decoded, ['errors'])
189
- ApiResponse.new(_response, data: decoded, errors: _errors)
193
+ ApiResponse.new(
194
+ _response, data: decoded, errors: _errors
195
+ )
190
196
  end
191
197
 
192
198
  # Provides summary information for all of a business's employee roles.
@@ -230,7 +236,9 @@ module Square
230
236
  # Return appropriate response type.
231
237
  decoded = APIHelper.json_deserialize(_response.raw_body)
232
238
  _errors = APIHelper.map_response(decoded, ['errors'])
233
- ApiResponse.new(_response, data: decoded, errors: _errors)
239
+ ApiResponse.new(
240
+ _response, data: decoded, errors: _errors
241
+ )
234
242
  end
235
243
 
236
244
  # Creates an employee role you can then assign to employees.
@@ -270,7 +278,9 @@ module Square
270
278
  # Return appropriate response type.
271
279
  decoded = APIHelper.json_deserialize(_response.raw_body)
272
280
  _errors = APIHelper.map_response(decoded, ['errors'])
273
- ApiResponse.new(_response, data: decoded, errors: _errors)
281
+ ApiResponse.new(
282
+ _response, data: decoded, errors: _errors
283
+ )
274
284
  end
275
285
 
276
286
  # Provides the details for a single employee role.
@@ -282,7 +292,7 @@ module Square
282
292
  _query_builder << '/v1/me/roles/{role_id}'
283
293
  _query_builder = APIHelper.append_url_with_template_parameters(
284
294
  _query_builder,
285
- 'role_id' => role_id
295
+ 'role_id' => { 'value' => role_id, 'encode' => true }
286
296
  )
287
297
  _query_url = APIHelper.clean_url _query_builder
288
298
 
@@ -302,7 +312,9 @@ module Square
302
312
  # Return appropriate response type.
303
313
  decoded = APIHelper.json_deserialize(_response.raw_body)
304
314
  _errors = APIHelper.map_response(decoded, ['errors'])
305
- ApiResponse.new(_response, data: decoded, errors: _errors)
315
+ ApiResponse.new(
316
+ _response, data: decoded, errors: _errors
317
+ )
306
318
  end
307
319
 
308
320
  # Modifies the details of an employee role.
@@ -319,7 +331,7 @@ module Square
319
331
  _query_builder << '/v1/me/roles/{role_id}'
320
332
  _query_builder = APIHelper.append_url_with_template_parameters(
321
333
  _query_builder,
322
- 'role_id' => role_id
334
+ 'role_id' => { 'value' => role_id, 'encode' => true }
323
335
  )
324
336
  _query_url = APIHelper.clean_url _query_builder
325
337
 
@@ -341,7 +353,9 @@ module Square
341
353
  # Return appropriate response type.
342
354
  decoded = APIHelper.json_deserialize(_response.raw_body)
343
355
  _errors = APIHelper.map_response(decoded, ['errors'])
344
- ApiResponse.new(_response, data: decoded, errors: _errors)
356
+ ApiResponse.new(
357
+ _response, data: decoded, errors: _errors
358
+ )
345
359
  end
346
360
 
347
361
  # Provides summary information for all of a business's employee timecards.
@@ -425,7 +439,9 @@ module Square
425
439
  # Return appropriate response type.
426
440
  decoded = APIHelper.json_deserialize(_response.raw_body)
427
441
  _errors = APIHelper.map_response(decoded, ['errors'])
428
- ApiResponse.new(_response, data: decoded, errors: _errors)
442
+ ApiResponse.new(
443
+ _response, data: decoded, errors: _errors
444
+ )
429
445
  end
430
446
 
431
447
  # Creates a timecard for an employee and clocks them in with an
@@ -468,7 +484,9 @@ module Square
468
484
  # Return appropriate response type.
469
485
  decoded = APIHelper.json_deserialize(_response.raw_body)
470
486
  _errors = APIHelper.map_response(decoded, ['errors'])
471
- ApiResponse.new(_response, data: decoded, errors: _errors)
487
+ ApiResponse.new(
488
+ _response, data: decoded, errors: _errors
489
+ )
472
490
  end
473
491
 
474
492
  # Deletes a timecard. Timecards can also be deleted through the
@@ -494,7 +512,7 @@ module Square
494
512
  _query_builder << '/v1/me/timecards/{timecard_id}'
495
513
  _query_builder = APIHelper.append_url_with_template_parameters(
496
514
  _query_builder,
497
- 'timecard_id' => timecard_id
515
+ 'timecard_id' => { 'value' => timecard_id, 'encode' => true }
498
516
  )
499
517
  _query_url = APIHelper.clean_url _query_builder
500
518
 
@@ -506,7 +524,9 @@ module Square
506
524
  _response = execute_request(_request)
507
525
 
508
526
  # Return appropriate response type.
509
- ApiResponse.new(_response, data: _response.raw_body)
527
+ ApiResponse.new(
528
+ _response, data: _response.raw_body
529
+ )
510
530
  end
511
531
 
512
532
  # Provides the details for a single timecard.
@@ -524,7 +544,7 @@ module Square
524
544
  _query_builder << '/v1/me/timecards/{timecard_id}'
525
545
  _query_builder = APIHelper.append_url_with_template_parameters(
526
546
  _query_builder,
527
- 'timecard_id' => timecard_id
547
+ 'timecard_id' => { 'value' => timecard_id, 'encode' => true }
528
548
  )
529
549
  _query_url = APIHelper.clean_url _query_builder
530
550
 
@@ -544,7 +564,9 @@ module Square
544
564
  # Return appropriate response type.
545
565
  decoded = APIHelper.json_deserialize(_response.raw_body)
546
566
  _errors = APIHelper.map_response(decoded, ['errors'])
547
- ApiResponse.new(_response, data: decoded, errors: _errors)
567
+ ApiResponse.new(
568
+ _response, data: decoded, errors: _errors
569
+ )
548
570
  end
549
571
 
550
572
  # Modifies the details of a timecard with an `API_EDIT` event for
@@ -564,7 +586,7 @@ module Square
564
586
  _query_builder << '/v1/me/timecards/{timecard_id}'
565
587
  _query_builder = APIHelper.append_url_with_template_parameters(
566
588
  _query_builder,
567
- 'timecard_id' => timecard_id
589
+ 'timecard_id' => { 'value' => timecard_id, 'encode' => true }
568
590
  )
569
591
  _query_url = APIHelper.clean_url _query_builder
570
592
 
@@ -586,16 +608,16 @@ module Square
586
608
  # Return appropriate response type.
587
609
  decoded = APIHelper.json_deserialize(_response.raw_body)
588
610
  _errors = APIHelper.map_response(decoded, ['errors'])
589
- ApiResponse.new(_response, data: decoded, errors: _errors)
611
+ ApiResponse.new(
612
+ _response, data: decoded, errors: _errors
613
+ )
590
614
  end
591
615
 
592
616
  # Provides summary information for all events associated with a
593
617
  # particular timecard.
594
- # <aside>
595
618
  # Only approved accounts can manage their employees with Square.
596
619
  # Unapproved accounts cannot use employee management features with the
597
620
  # API.
598
- # </aside>
599
621
  # @param [String] timecard_id Required parameter: The ID of the timecard to
600
622
  # list events for.
601
623
  # @return [List of V1TimecardEvent Hash] response from the API call
@@ -606,7 +628,7 @@ module Square
606
628
  _query_builder << '/v1/me/timecards/{timecard_id}/events'
607
629
  _query_builder = APIHelper.append_url_with_template_parameters(
608
630
  _query_builder,
609
- 'timecard_id' => timecard_id
631
+ 'timecard_id' => { 'value' => timecard_id, 'encode' => true }
610
632
  )
611
633
  _query_url = APIHelper.clean_url _query_builder
612
634
 
@@ -626,7 +648,9 @@ module Square
626
648
  # Return appropriate response type.
627
649
  decoded = APIHelper.json_deserialize(_response.raw_body)
628
650
  _errors = APIHelper.map_response(decoded, ['errors'])
629
- ApiResponse.new(_response, data: decoded, errors: _errors)
651
+ ApiResponse.new(
652
+ _response, data: decoded, errors: _errors
653
+ )
630
654
  end
631
655
 
632
656
  # Provides the details for all of a location's cash drawer shifts during a
@@ -653,7 +677,7 @@ module Square
653
677
  _query_builder << '/v1/{location_id}/cash-drawer-shifts'
654
678
  _query_builder = APIHelper.append_url_with_template_parameters(
655
679
  _query_builder,
656
- 'location_id' => location_id
680
+ 'location_id' => { 'value' => location_id, 'encode' => true }
657
681
  )
658
682
  _query_builder = APIHelper.append_url_with_query_parameters(
659
683
  _query_builder,
@@ -679,7 +703,9 @@ module Square
679
703
  # Return appropriate response type.
680
704
  decoded = APIHelper.json_deserialize(_response.raw_body)
681
705
  _errors = APIHelper.map_response(decoded, ['errors'])
682
- ApiResponse.new(_response, data: decoded, errors: _errors)
706
+ ApiResponse.new(
707
+ _response, data: decoded, errors: _errors
708
+ )
683
709
  end
684
710
 
685
711
  # Provides the details for a single cash drawer shift, including all events
@@ -696,8 +722,8 @@ module Square
696
722
  _query_builder << '/v1/{location_id}/cash-drawer-shifts/{shift_id}'
697
723
  _query_builder = APIHelper.append_url_with_template_parameters(
698
724
  _query_builder,
699
- 'location_id' => location_id,
700
- 'shift_id' => shift_id
725
+ 'location_id' => { 'value' => location_id, 'encode' => true },
726
+ 'shift_id' => { 'value' => shift_id, 'encode' => true }
701
727
  )
702
728
  _query_url = APIHelper.clean_url _query_builder
703
729
 
@@ -717,7 +743,9 @@ module Square
717
743
  # Return appropriate response type.
718
744
  decoded = APIHelper.json_deserialize(_response.raw_body)
719
745
  _errors = APIHelper.map_response(decoded, ['errors'])
720
- ApiResponse.new(_response, data: decoded, errors: _errors)
746
+ ApiResponse.new(
747
+ _response, data: decoded, errors: _errors
748
+ )
721
749
  end
722
750
  end
723
751
  end