square.rb 6.1.0.20200722 → 7.0.0.20201118

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 +38 -31
  3. data/lib/square.rb +62 -61
  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 +266 -0
  8. data/lib/square/api/cash_drawers_api.rb +13 -6
  9. data/lib/square/api/catalog_api.rb +50 -28
  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 +39 -34
  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 +31 -30
  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 +263 -0
  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 -27
  33. data/lib/square/api/v1_items_api.rb +195 -115
  34. data/lib/square/api/v1_locations_api.rb +6 -2
  35. data/lib/square/api/v1_transactions_api.rb +49 -27
  36. data/lib/square/api_helper.rb +14 -9
  37. data/lib/square/client.rb +20 -14
  38. data/lib/square/configuration.rb +2 -2
  39. data/lib/square/http/api_response.rb +2 -0
  40. data/lib/square/http/faraday_client.rb +9 -2
  41. data/spec/user_journey_spec.rb +2 -5
  42. data/test/api/api_test_base.rb +1 -6
  43. data/test/api/test_catalog_api.rb +1 -4
  44. data/test/api/test_customers_api.rb +1 -4
  45. data/test/api/test_employees_api.rb +1 -4
  46. data/test/api/test_labor_api.rb +2 -6
  47. data/test/api/test_locations_api.rb +22 -33
  48. data/test/api/test_merchants_api.rb +1 -4
  49. data/test/api/test_payments_api.rb +3 -6
  50. data/test/api/test_refunds_api.rb +3 -6
  51. data/test/http_response_catcher.rb +0 -5
  52. data/test/test_helper.rb +0 -5
  53. metadata +34 -15
  54. data/lib/square/api/reporting_api.rb +0 -138
@@ -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
@@ -115,7 +117,9 @@ module Square
115
117
  # Return appropriate response type.
116
118
  decoded = APIHelper.json_deserialize(_response.raw_body)
117
119
  _errors = APIHelper.map_response(decoded, ['errors'])
118
- ApiResponse.new(_response, data: decoded, errors: _errors)
120
+ ApiResponse.new(
121
+ _response, data: decoded, errors: _errors
122
+ )
119
123
  end
120
124
 
121
125
  # Provides the details for a single employee.
@@ -127,7 +131,7 @@ module Square
127
131
  _query_builder << '/v1/me/employees/{employee_id}'
128
132
  _query_builder = APIHelper.append_url_with_template_parameters(
129
133
  _query_builder,
130
- 'employee_id' => employee_id
134
+ 'employee_id' => { 'value' => employee_id, 'encode' => true }
131
135
  )
132
136
  _query_url = APIHelper.clean_url _query_builder
133
137
 
@@ -147,7 +151,9 @@ module Square
147
151
  # Return appropriate response type.
148
152
  decoded = APIHelper.json_deserialize(_response.raw_body)
149
153
  _errors = APIHelper.map_response(decoded, ['errors'])
150
- ApiResponse.new(_response, data: decoded, errors: _errors)
154
+ ApiResponse.new(
155
+ _response, data: decoded, errors: _errors
156
+ )
151
157
  end
152
158
 
153
159
  # UpdateEmployee
@@ -164,7 +170,7 @@ module Square
164
170
  _query_builder << '/v1/me/employees/{employee_id}'
165
171
  _query_builder = APIHelper.append_url_with_template_parameters(
166
172
  _query_builder,
167
- 'employee_id' => employee_id
173
+ 'employee_id' => { 'value' => employee_id, 'encode' => true }
168
174
  )
169
175
  _query_url = APIHelper.clean_url _query_builder
170
176
 
@@ -186,7 +192,9 @@ module Square
186
192
  # Return appropriate response type.
187
193
  decoded = APIHelper.json_deserialize(_response.raw_body)
188
194
  _errors = APIHelper.map_response(decoded, ['errors'])
189
- ApiResponse.new(_response, data: decoded, errors: _errors)
195
+ ApiResponse.new(
196
+ _response, data: decoded, errors: _errors
197
+ )
190
198
  end
191
199
 
192
200
  # Provides summary information for all of a business's employee roles.
@@ -230,7 +238,9 @@ module Square
230
238
  # Return appropriate response type.
231
239
  decoded = APIHelper.json_deserialize(_response.raw_body)
232
240
  _errors = APIHelper.map_response(decoded, ['errors'])
233
- ApiResponse.new(_response, data: decoded, errors: _errors)
241
+ ApiResponse.new(
242
+ _response, data: decoded, errors: _errors
243
+ )
234
244
  end
235
245
 
236
246
  # Creates an employee role you can then assign to employees.
@@ -270,7 +280,9 @@ module Square
270
280
  # Return appropriate response type.
271
281
  decoded = APIHelper.json_deserialize(_response.raw_body)
272
282
  _errors = APIHelper.map_response(decoded, ['errors'])
273
- ApiResponse.new(_response, data: decoded, errors: _errors)
283
+ ApiResponse.new(
284
+ _response, data: decoded, errors: _errors
285
+ )
274
286
  end
275
287
 
276
288
  # Provides the details for a single employee role.
@@ -282,7 +294,7 @@ module Square
282
294
  _query_builder << '/v1/me/roles/{role_id}'
283
295
  _query_builder = APIHelper.append_url_with_template_parameters(
284
296
  _query_builder,
285
- 'role_id' => role_id
297
+ 'role_id' => { 'value' => role_id, 'encode' => true }
286
298
  )
287
299
  _query_url = APIHelper.clean_url _query_builder
288
300
 
@@ -302,7 +314,9 @@ module Square
302
314
  # Return appropriate response type.
303
315
  decoded = APIHelper.json_deserialize(_response.raw_body)
304
316
  _errors = APIHelper.map_response(decoded, ['errors'])
305
- ApiResponse.new(_response, data: decoded, errors: _errors)
317
+ ApiResponse.new(
318
+ _response, data: decoded, errors: _errors
319
+ )
306
320
  end
307
321
 
308
322
  # Modifies the details of an employee role.
@@ -319,7 +333,7 @@ module Square
319
333
  _query_builder << '/v1/me/roles/{role_id}'
320
334
  _query_builder = APIHelper.append_url_with_template_parameters(
321
335
  _query_builder,
322
- 'role_id' => role_id
336
+ 'role_id' => { 'value' => role_id, 'encode' => true }
323
337
  )
324
338
  _query_url = APIHelper.clean_url _query_builder
325
339
 
@@ -341,7 +355,9 @@ module Square
341
355
  # Return appropriate response type.
342
356
  decoded = APIHelper.json_deserialize(_response.raw_body)
343
357
  _errors = APIHelper.map_response(decoded, ['errors'])
344
- ApiResponse.new(_response, data: decoded, errors: _errors)
358
+ ApiResponse.new(
359
+ _response, data: decoded, errors: _errors
360
+ )
345
361
  end
346
362
 
347
363
  # Provides summary information for all of a business's employee timecards.
@@ -425,7 +441,9 @@ module Square
425
441
  # Return appropriate response type.
426
442
  decoded = APIHelper.json_deserialize(_response.raw_body)
427
443
  _errors = APIHelper.map_response(decoded, ['errors'])
428
- ApiResponse.new(_response, data: decoded, errors: _errors)
444
+ ApiResponse.new(
445
+ _response, data: decoded, errors: _errors
446
+ )
429
447
  end
430
448
 
431
449
  # Creates a timecard for an employee and clocks them in with an
@@ -468,7 +486,9 @@ module Square
468
486
  # Return appropriate response type.
469
487
  decoded = APIHelper.json_deserialize(_response.raw_body)
470
488
  _errors = APIHelper.map_response(decoded, ['errors'])
471
- ApiResponse.new(_response, data: decoded, errors: _errors)
489
+ ApiResponse.new(
490
+ _response, data: decoded, errors: _errors
491
+ )
472
492
  end
473
493
 
474
494
  # Deletes a timecard. Timecards can also be deleted through the
@@ -494,7 +514,7 @@ module Square
494
514
  _query_builder << '/v1/me/timecards/{timecard_id}'
495
515
  _query_builder = APIHelper.append_url_with_template_parameters(
496
516
  _query_builder,
497
- 'timecard_id' => timecard_id
517
+ 'timecard_id' => { 'value' => timecard_id, 'encode' => true }
498
518
  )
499
519
  _query_url = APIHelper.clean_url _query_builder
500
520
 
@@ -506,7 +526,9 @@ module Square
506
526
  _response = execute_request(_request)
507
527
 
508
528
  # Return appropriate response type.
509
- ApiResponse.new(_response, data: _response.raw_body)
529
+ ApiResponse.new(
530
+ _response, data: _response.raw_body
531
+ )
510
532
  end
511
533
 
512
534
  # Provides the details for a single timecard.
@@ -524,7 +546,7 @@ module Square
524
546
  _query_builder << '/v1/me/timecards/{timecard_id}'
525
547
  _query_builder = APIHelper.append_url_with_template_parameters(
526
548
  _query_builder,
527
- 'timecard_id' => timecard_id
549
+ 'timecard_id' => { 'value' => timecard_id, 'encode' => true }
528
550
  )
529
551
  _query_url = APIHelper.clean_url _query_builder
530
552
 
@@ -544,7 +566,9 @@ module Square
544
566
  # Return appropriate response type.
545
567
  decoded = APIHelper.json_deserialize(_response.raw_body)
546
568
  _errors = APIHelper.map_response(decoded, ['errors'])
547
- ApiResponse.new(_response, data: decoded, errors: _errors)
569
+ ApiResponse.new(
570
+ _response, data: decoded, errors: _errors
571
+ )
548
572
  end
549
573
 
550
574
  # Modifies the details of a timecard with an `API_EDIT` event for
@@ -564,7 +588,7 @@ module Square
564
588
  _query_builder << '/v1/me/timecards/{timecard_id}'
565
589
  _query_builder = APIHelper.append_url_with_template_parameters(
566
590
  _query_builder,
567
- 'timecard_id' => timecard_id
591
+ 'timecard_id' => { 'value' => timecard_id, 'encode' => true }
568
592
  )
569
593
  _query_url = APIHelper.clean_url _query_builder
570
594
 
@@ -586,7 +610,9 @@ module Square
586
610
  # Return appropriate response type.
587
611
  decoded = APIHelper.json_deserialize(_response.raw_body)
588
612
  _errors = APIHelper.map_response(decoded, ['errors'])
589
- ApiResponse.new(_response, data: decoded, errors: _errors)
613
+ ApiResponse.new(
614
+ _response, data: decoded, errors: _errors
615
+ )
590
616
  end
591
617
 
592
618
  # Provides summary information for all events associated with a
@@ -606,7 +632,7 @@ module Square
606
632
  _query_builder << '/v1/me/timecards/{timecard_id}/events'
607
633
  _query_builder = APIHelper.append_url_with_template_parameters(
608
634
  _query_builder,
609
- 'timecard_id' => timecard_id
635
+ 'timecard_id' => { 'value' => timecard_id, 'encode' => true }
610
636
  )
611
637
  _query_url = APIHelper.clean_url _query_builder
612
638
 
@@ -626,7 +652,9 @@ module Square
626
652
  # Return appropriate response type.
627
653
  decoded = APIHelper.json_deserialize(_response.raw_body)
628
654
  _errors = APIHelper.map_response(decoded, ['errors'])
629
- ApiResponse.new(_response, data: decoded, errors: _errors)
655
+ ApiResponse.new(
656
+ _response, data: decoded, errors: _errors
657
+ )
630
658
  end
631
659
 
632
660
  # Provides the details for all of a location's cash drawer shifts during a
@@ -653,7 +681,7 @@ module Square
653
681
  _query_builder << '/v1/{location_id}/cash-drawer-shifts'
654
682
  _query_builder = APIHelper.append_url_with_template_parameters(
655
683
  _query_builder,
656
- 'location_id' => location_id
684
+ 'location_id' => { 'value' => location_id, 'encode' => true }
657
685
  )
658
686
  _query_builder = APIHelper.append_url_with_query_parameters(
659
687
  _query_builder,
@@ -679,7 +707,9 @@ module Square
679
707
  # Return appropriate response type.
680
708
  decoded = APIHelper.json_deserialize(_response.raw_body)
681
709
  _errors = APIHelper.map_response(decoded, ['errors'])
682
- ApiResponse.new(_response, data: decoded, errors: _errors)
710
+ ApiResponse.new(
711
+ _response, data: decoded, errors: _errors
712
+ )
683
713
  end
684
714
 
685
715
  # Provides the details for a single cash drawer shift, including all events
@@ -696,8 +726,8 @@ module Square
696
726
  _query_builder << '/v1/{location_id}/cash-drawer-shifts/{shift_id}'
697
727
  _query_builder = APIHelper.append_url_with_template_parameters(
698
728
  _query_builder,
699
- 'location_id' => location_id,
700
- 'shift_id' => shift_id
729
+ 'location_id' => { 'value' => location_id, 'encode' => true },
730
+ 'shift_id' => { 'value' => shift_id, 'encode' => true }
701
731
  )
702
732
  _query_url = APIHelper.clean_url _query_builder
703
733
 
@@ -717,7 +747,9 @@ module Square
717
747
  # Return appropriate response type.
718
748
  decoded = APIHelper.json_deserialize(_response.raw_body)
719
749
  _errors = APIHelper.map_response(decoded, ['errors'])
720
- ApiResponse.new(_response, data: decoded, errors: _errors)
750
+ ApiResponse.new(
751
+ _response, data: decoded, errors: _errors
752
+ )
721
753
  end
722
754
  end
723
755
  end