square.rb 6.3.0.20200826 → 17.1.0.20220120

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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +86 -51
  4. data/lib/square/api/apple_pay_api.rb +12 -9
  5. data/lib/square/api/bank_accounts_api.rb +21 -24
  6. data/lib/square/api/base_api.rb +20 -9
  7. data/lib/square/api/bookings_api.rb +391 -0
  8. data/lib/square/api/cards_api.rb +170 -0
  9. data/lib/square/api/cash_drawers_api.rb +13 -6
  10. data/lib/square/api/catalog_api.rb +195 -85
  11. data/lib/square/api/checkout_api.rb +7 -5
  12. data/lib/square/api/customer_groups_api.rb +34 -16
  13. data/lib/square/api/customer_segments_api.rb +21 -9
  14. data/lib/square/api/customers_api.rb +102 -55
  15. data/lib/square/api/devices_api.rb +20 -8
  16. data/lib/square/api/disputes_api.rb +156 -144
  17. data/lib/square/api/employees_api.rb +7 -3
  18. data/lib/square/api/gift_card_activities_api.rb +133 -0
  19. data/lib/square/api/gift_cards_api.rb +297 -0
  20. data/lib/square/api/inventory_api.rb +290 -37
  21. data/lib/square/api/invoices_api.rb +61 -57
  22. data/lib/square/api/labor_api.rb +127 -93
  23. data/lib/square/api/locations_api.rb +36 -25
  24. data/lib/square/api/loyalty_api.rb +134 -87
  25. data/lib/square/api/merchants_api.rb +8 -4
  26. data/lib/square/api/mobile_authorization_api.rb +9 -7
  27. data/lib/square/api/o_auth_api.rb +41 -32
  28. data/lib/square/api/orders_api.rb +132 -54
  29. data/lib/square/api/payments_api.rb +133 -75
  30. data/lib/square/api/refunds_api.rb +51 -30
  31. data/lib/square/api/sites_api.rb +43 -0
  32. data/lib/square/api/snippets_api.rb +146 -0
  33. data/lib/square/api/subscriptions_api.rb +216 -26
  34. data/lib/square/api/team_api.rb +81 -65
  35. data/lib/square/api/terminal_api.rb +166 -16
  36. data/lib/square/api/transactions_api.rb +32 -194
  37. data/lib/square/api/v1_transactions_api.rb +53 -103
  38. data/lib/square/api_helper.rb +38 -43
  39. data/lib/square/client.rb +54 -24
  40. data/lib/square/configuration.rb +61 -21
  41. data/lib/square/http/api_response.rb +3 -1
  42. data/lib/square/http/faraday_client.rb +34 -5
  43. data/lib/square/utilities/date_time_helper.rb +151 -0
  44. data/lib/square/utilities/file_wrapper.rb +1 -2
  45. data/lib/square.rb +65 -61
  46. data/spec/user_journey_spec.rb +2 -5
  47. data/test/api/api_test_base.rb +1 -6
  48. data/test/api/test_catalog_api.rb +1 -4
  49. data/test/api/test_customers_api.rb +1 -4
  50. data/test/api/test_employees_api.rb +1 -4
  51. data/test/api/test_labor_api.rb +2 -6
  52. data/test/api/test_locations_api.rb +21 -35
  53. data/test/api/test_merchants_api.rb +1 -4
  54. data/test/api/test_payments_api.rb +3 -6
  55. data/test/api/test_refunds_api.rb +3 -6
  56. data/test/http_response_catcher.rb +0 -5
  57. data/test/test_helper.rb +1 -6
  58. metadata +40 -18
  59. data/lib/square/api/v1_employees_api.rb +0 -723
  60. data/lib/square/api/v1_items_api.rb +0 -1686
  61. data/lib/square/api/v1_locations_api.rb +0 -65
@@ -6,13 +6,14 @@ module Square
6
6
  end
7
7
 
8
8
  # Returns a paginated list of `BreakType` instances for a business.
9
- # @param [String] location_id Optional parameter: Filter Break Types
10
- # returned to only those that are associated with the specified location.
11
- # @param [Integer] limit Optional parameter: Maximum number of Break Types
12
- # to return per page. Can range between 1 and 200. The default is the
13
- # maximum at 200.
14
- # @param [String] cursor Optional parameter: Pointer to the next page of
15
- # Break Type results to fetch.
9
+ # @param [String] location_id Optional parameter: Filter the returned
10
+ # `BreakType` results to only those that are associated with the specified
11
+ # location.
12
+ # @param [Integer] limit Optional parameter: The maximum number of
13
+ # `BreakType` results to return per page. The number can range between 1 and
14
+ # 200. The default is 200.
15
+ # @param [String] cursor Optional parameter: A pointer to the next page of
16
+ # `BreakType` results to fetch.
16
17
  # @return [ListBreakTypesResponse Hash] response from the API call
17
18
  def list_break_types(location_id: nil,
18
19
  limit: nil,
@@ -44,7 +45,9 @@ module Square
44
45
  # Return appropriate response type.
45
46
  decoded = APIHelper.json_deserialize(_response.raw_body)
46
47
  _errors = APIHelper.map_response(decoded, ['errors'])
47
- ApiResponse.new(_response, data: decoded, errors: _errors)
48
+ ApiResponse.new(
49
+ _response, data: decoded, errors: _errors
50
+ )
48
51
  end
49
52
 
50
53
  # Creates a new `BreakType`.
@@ -55,8 +58,8 @@ module Square
55
58
  # - `break_name`
56
59
  # - `expected_duration`
57
60
  # - `is_paid`
58
- # You can only have 3 `BreakType` instances per location. If you attempt to
59
- # add a 4th
61
+ # You can only have three `BreakType` instances per location. If you attempt
62
+ # to add a fourth
60
63
  # `BreakType` for a location, an `INVALID_REQUEST_ERROR` "Exceeded limit of
61
64
  # 3 breaks per location."
62
65
  # is returned.
@@ -73,7 +76,7 @@ module Square
73
76
  # Prepare headers.
74
77
  _headers = {
75
78
  'accept' => 'application/json',
76
- 'content-type' => 'application/json; charset=utf-8'
79
+ 'Content-Type' => 'application/json'
77
80
  }
78
81
 
79
82
  # Prepare and execute HttpRequest.
@@ -88,12 +91,14 @@ module Square
88
91
  # Return appropriate response type.
89
92
  decoded = APIHelper.json_deserialize(_response.raw_body)
90
93
  _errors = APIHelper.map_response(decoded, ['errors'])
91
- ApiResponse.new(_response, data: decoded, errors: _errors)
94
+ ApiResponse.new(
95
+ _response, data: decoded, errors: _errors
96
+ )
92
97
  end
93
98
 
94
99
  # Deletes an existing `BreakType`.
95
100
  # A `BreakType` can be deleted even if it is referenced from a `Shift`.
96
- # @param [String] id Required parameter: UUID for the `BreakType` being
101
+ # @param [String] id Required parameter: The UUID for the `BreakType` being
97
102
  # deleted.
98
103
  # @return [DeleteBreakTypeResponse Hash] response from the API call
99
104
  def delete_break_type(id:)
@@ -102,7 +107,7 @@ module Square
102
107
  _query_builder << '/v2/labor/break-types/{id}'
103
108
  _query_builder = APIHelper.append_url_with_template_parameters(
104
109
  _query_builder,
105
- 'id' => id
110
+ 'id' => { 'value' => id, 'encode' => true }
106
111
  )
107
112
  _query_url = APIHelper.clean_url _query_builder
108
113
 
@@ -122,11 +127,13 @@ module Square
122
127
  # Return appropriate response type.
123
128
  decoded = APIHelper.json_deserialize(_response.raw_body)
124
129
  _errors = APIHelper.map_response(decoded, ['errors'])
125
- ApiResponse.new(_response, data: decoded, errors: _errors)
130
+ ApiResponse.new(
131
+ _response, data: decoded, errors: _errors
132
+ )
126
133
  end
127
134
 
128
- # Returns a single `BreakType` specified by id.
129
- # @param [String] id Required parameter: UUID for the `BreakType` being
135
+ # Returns a single `BreakType` specified by `id`.
136
+ # @param [String] id Required parameter: The UUID for the `BreakType` being
130
137
  # retrieved.
131
138
  # @return [GetBreakTypeResponse Hash] response from the API call
132
139
  def get_break_type(id:)
@@ -135,7 +142,7 @@ module Square
135
142
  _query_builder << '/v2/labor/break-types/{id}'
136
143
  _query_builder = APIHelper.append_url_with_template_parameters(
137
144
  _query_builder,
138
- 'id' => id
145
+ 'id' => { 'value' => id, 'encode' => true }
139
146
  )
140
147
  _query_url = APIHelper.clean_url _query_builder
141
148
 
@@ -155,11 +162,13 @@ module Square
155
162
  # Return appropriate response type.
156
163
  decoded = APIHelper.json_deserialize(_response.raw_body)
157
164
  _errors = APIHelper.map_response(decoded, ['errors'])
158
- ApiResponse.new(_response, data: decoded, errors: _errors)
165
+ ApiResponse.new(
166
+ _response, data: decoded, errors: _errors
167
+ )
159
168
  end
160
169
 
161
170
  # Updates an existing `BreakType`.
162
- # @param [String] id Required parameter: UUID for the `BreakType` being
171
+ # @param [String] id Required parameter: The UUID for the `BreakType` being
163
172
  # updated.
164
173
  # @param [UpdateBreakTypeRequest] body Required parameter: An object
165
174
  # containing the fields to POST for the request. See the corresponding
@@ -172,14 +181,14 @@ module Square
172
181
  _query_builder << '/v2/labor/break-types/{id}'
173
182
  _query_builder = APIHelper.append_url_with_template_parameters(
174
183
  _query_builder,
175
- 'id' => id
184
+ 'id' => { 'value' => id, 'encode' => true }
176
185
  )
177
186
  _query_url = APIHelper.clean_url _query_builder
178
187
 
179
188
  # Prepare headers.
180
189
  _headers = {
181
190
  'accept' => 'application/json',
182
- 'content-type' => 'application/json; charset=utf-8'
191
+ 'Content-Type' => 'application/json'
183
192
  }
184
193
 
185
194
  # Prepare and execute HttpRequest.
@@ -194,17 +203,19 @@ module Square
194
203
  # Return appropriate response type.
195
204
  decoded = APIHelper.json_deserialize(_response.raw_body)
196
205
  _errors = APIHelper.map_response(decoded, ['errors'])
197
- ApiResponse.new(_response, data: decoded, errors: _errors)
206
+ ApiResponse.new(
207
+ _response, data: decoded, errors: _errors
208
+ )
198
209
  end
199
210
 
200
211
  # Returns a paginated list of `EmployeeWage` instances for a business.
201
- # @param [String] employee_id Optional parameter: Filter wages returned to
202
- # only those that are associated with the specified employee.
203
- # @param [Integer] limit Optional parameter: Maximum number of Employee
204
- # Wages to return per page. Can range between 1 and 200. The default is the
205
- # maximum at 200.
206
- # @param [String] cursor Optional parameter: Pointer to the next page of
207
- # Employee Wage results to fetch.
212
+ # @param [String] employee_id Optional parameter: Filter the returned wages
213
+ # to only those that are associated with the specified employee.
214
+ # @param [Integer] limit Optional parameter: The maximum number of
215
+ # `EmployeeWage` results to return per page. The number can range between 1
216
+ # and 200. The default is 200.
217
+ # @param [String] cursor Optional parameter: A pointer to the next page of
218
+ # `EmployeeWage` results to fetch.
208
219
  # @return [ListEmployeeWagesResponse Hash] response from the API call
209
220
  def list_employee_wages(employee_id: nil,
210
221
  limit: nil,
@@ -237,12 +248,14 @@ module Square
237
248
  # Return appropriate response type.
238
249
  decoded = APIHelper.json_deserialize(_response.raw_body)
239
250
  _errors = APIHelper.map_response(decoded, ['errors'])
240
- ApiResponse.new(_response, data: decoded, errors: _errors)
251
+ ApiResponse.new(
252
+ _response, data: decoded, errors: _errors
253
+ )
241
254
  end
242
255
 
243
- # Returns a single `EmployeeWage` specified by id.
244
- # @param [String] id Required parameter: UUID for the `EmployeeWage` being
245
- # retrieved.
256
+ # Returns a single `EmployeeWage` specified by `id`.
257
+ # @param [String] id Required parameter: The UUID for the `EmployeeWage`
258
+ # being retrieved.
246
259
  # @return [GetEmployeeWageResponse Hash] response from the API call
247
260
  def get_employee_wage(id:)
248
261
  warn 'Endpoint get_employee_wage in LaborApi is deprecated'
@@ -251,7 +264,7 @@ module Square
251
264
  _query_builder << '/v2/labor/employee-wages/{id}'
252
265
  _query_builder = APIHelper.append_url_with_template_parameters(
253
266
  _query_builder,
254
- 'id' => id
267
+ 'id' => { 'value' => id, 'encode' => true }
255
268
  )
256
269
  _query_url = APIHelper.clean_url _query_builder
257
270
 
@@ -271,11 +284,13 @@ module Square
271
284
  # Return appropriate response type.
272
285
  decoded = APIHelper.json_deserialize(_response.raw_body)
273
286
  _errors = APIHelper.map_response(decoded, ['errors'])
274
- ApiResponse.new(_response, data: decoded, errors: _errors)
287
+ ApiResponse.new(
288
+ _response, data: decoded, errors: _errors
289
+ )
275
290
  end
276
291
 
277
292
  # Creates a new `Shift`.
278
- # A `Shift` represents a complete work day for a single employee.
293
+ # A `Shift` represents a complete workday for a single employee.
279
294
  # You must provide the following values in your request to this
280
295
  # endpoint:
281
296
  # - `location_id`
@@ -285,12 +300,12 @@ module Square
285
300
  # when:
286
301
  # - The `status` of the new `Shift` is `OPEN` and the employee has another
287
302
  # shift with an `OPEN` status.
288
- # - The `start_at` date is in the future
289
- # - the `start_at` or `end_at` overlaps another shift for the same employee
290
- # - If `Break`s are set in the request, a break `start_at`
291
- # must not be before the `Shift.start_at`. A break `end_at` must not be
292
- # after
293
- # the `Shift.end_at`
303
+ # - The `start_at` date is in the future.
304
+ # - The `start_at` or `end_at` date overlaps another shift for the same
305
+ # employee.
306
+ # - The `Break` instances are set in the request and a break `start_at`
307
+ # is before the `Shift.start_at`, a break `end_at` is after
308
+ # the `Shift.end_at`, or both.
294
309
  # @param [CreateShiftRequest] body Required parameter: An object containing
295
310
  # the fields to POST for the request. See the corresponding object
296
311
  # definition for field details.
@@ -304,7 +319,7 @@ module Square
304
319
  # Prepare headers.
305
320
  _headers = {
306
321
  'accept' => 'application/json',
307
- 'content-type' => 'application/json; charset=utf-8'
322
+ 'Content-Type' => 'application/json'
308
323
  }
309
324
 
310
325
  # Prepare and execute HttpRequest.
@@ -319,22 +334,24 @@ module Square
319
334
  # Return appropriate response type.
320
335
  decoded = APIHelper.json_deserialize(_response.raw_body)
321
336
  _errors = APIHelper.map_response(decoded, ['errors'])
322
- ApiResponse.new(_response, data: decoded, errors: _errors)
337
+ ApiResponse.new(
338
+ _response, data: decoded, errors: _errors
339
+ )
323
340
  end
324
341
 
325
342
  # Returns a paginated list of `Shift` records for a business.
326
343
  # The list to be returned can be filtered by:
327
- # - Location IDs **and**
328
- # - employee IDs **and**
329
- # - shift status (`OPEN`, `CLOSED`) **and**
330
- # - shift start **and**
331
- # - shift end **and**
332
- # - work day details
344
+ # - Location IDs.
345
+ # - Employee IDs.
346
+ # - Shift status (`OPEN` and `CLOSED`).
347
+ # - Shift start.
348
+ # - Shift end.
349
+ # - Workday details.
333
350
  # The list can be sorted by:
334
- # - `start_at`
335
- # - `end_at`
336
- # - `created_at`
337
- # - `updated_at`
351
+ # - `start_at`.
352
+ # - `end_at`.
353
+ # - `created_at`.
354
+ # - `updated_at`.
338
355
  # @param [SearchShiftsRequest] body Required parameter: An object containing
339
356
  # the fields to POST for the request. See the corresponding object
340
357
  # definition for field details.
@@ -348,7 +365,7 @@ module Square
348
365
  # Prepare headers.
349
366
  _headers = {
350
367
  'accept' => 'application/json',
351
- 'content-type' => 'application/json; charset=utf-8'
368
+ 'Content-Type' => 'application/json'
352
369
  }
353
370
 
354
371
  # Prepare and execute HttpRequest.
@@ -363,11 +380,13 @@ module Square
363
380
  # Return appropriate response type.
364
381
  decoded = APIHelper.json_deserialize(_response.raw_body)
365
382
  _errors = APIHelper.map_response(decoded, ['errors'])
366
- ApiResponse.new(_response, data: decoded, errors: _errors)
383
+ ApiResponse.new(
384
+ _response, data: decoded, errors: _errors
385
+ )
367
386
  end
368
387
 
369
388
  # Deletes a `Shift`.
370
- # @param [String] id Required parameter: UUID for the `Shift` being
389
+ # @param [String] id Required parameter: The UUID for the `Shift` being
371
390
  # deleted.
372
391
  # @return [DeleteShiftResponse Hash] response from the API call
373
392
  def delete_shift(id:)
@@ -376,7 +395,7 @@ module Square
376
395
  _query_builder << '/v2/labor/shifts/{id}'
377
396
  _query_builder = APIHelper.append_url_with_template_parameters(
378
397
  _query_builder,
379
- 'id' => id
398
+ 'id' => { 'value' => id, 'encode' => true }
380
399
  )
381
400
  _query_url = APIHelper.clean_url _query_builder
382
401
 
@@ -396,11 +415,13 @@ module Square
396
415
  # Return appropriate response type.
397
416
  decoded = APIHelper.json_deserialize(_response.raw_body)
398
417
  _errors = APIHelper.map_response(decoded, ['errors'])
399
- ApiResponse.new(_response, data: decoded, errors: _errors)
418
+ ApiResponse.new(
419
+ _response, data: decoded, errors: _errors
420
+ )
400
421
  end
401
422
 
402
- # Returns a single `Shift` specified by id.
403
- # @param [String] id Required parameter: UUID for the `Shift` being
423
+ # Returns a single `Shift` specified by `id`.
424
+ # @param [String] id Required parameter: The UUID for the `Shift` being
404
425
  # retrieved.
405
426
  # @return [GetShiftResponse Hash] response from the API call
406
427
  def get_shift(id:)
@@ -409,7 +430,7 @@ module Square
409
430
  _query_builder << '/v2/labor/shifts/{id}'
410
431
  _query_builder = APIHelper.append_url_with_template_parameters(
411
432
  _query_builder,
412
- 'id' => id
433
+ 'id' => { 'value' => id, 'encode' => true }
413
434
  )
414
435
  _query_url = APIHelper.clean_url _query_builder
415
436
 
@@ -429,17 +450,20 @@ module Square
429
450
  # Return appropriate response type.
430
451
  decoded = APIHelper.json_deserialize(_response.raw_body)
431
452
  _errors = APIHelper.map_response(decoded, ['errors'])
432
- ApiResponse.new(_response, data: decoded, errors: _errors)
453
+ ApiResponse.new(
454
+ _response, data: decoded, errors: _errors
455
+ )
433
456
  end
434
457
 
435
458
  # Updates an existing `Shift`.
436
- # When adding a `Break` to a `Shift`, any earlier `Breaks` in the `Shift`
437
- # have
459
+ # When adding a `Break` to a `Shift`, any earlier `Break` instances in the
460
+ # `Shift` have
438
461
  # the `end_at` property set to a valid RFC-3339 datetime string.
439
- # When closing a `Shift`, all `Break` instances in the shift must be
462
+ # When closing a `Shift`, all `Break` instances in the `Shift` must be
440
463
  # complete with `end_at`
441
464
  # set on each `Break`.
442
- # @param [String] id Required parameter: ID of the object being updated.
465
+ # @param [String] id Required parameter: The ID of the object being
466
+ # updated.
443
467
  # @param [UpdateShiftRequest] body Required parameter: An object containing
444
468
  # the fields to POST for the request. See the corresponding object
445
469
  # definition for field details.
@@ -451,14 +475,14 @@ module Square
451
475
  _query_builder << '/v2/labor/shifts/{id}'
452
476
  _query_builder = APIHelper.append_url_with_template_parameters(
453
477
  _query_builder,
454
- 'id' => id
478
+ 'id' => { 'value' => id, 'encode' => true }
455
479
  )
456
480
  _query_url = APIHelper.clean_url _query_builder
457
481
 
458
482
  # Prepare headers.
459
483
  _headers = {
460
484
  'accept' => 'application/json',
461
- 'content-type' => 'application/json; charset=utf-8'
485
+ 'Content-Type' => 'application/json'
462
486
  }
463
487
 
464
488
  # Prepare and execute HttpRequest.
@@ -473,17 +497,19 @@ module Square
473
497
  # Return appropriate response type.
474
498
  decoded = APIHelper.json_deserialize(_response.raw_body)
475
499
  _errors = APIHelper.map_response(decoded, ['errors'])
476
- ApiResponse.new(_response, data: decoded, errors: _errors)
500
+ ApiResponse.new(
501
+ _response, data: decoded, errors: _errors
502
+ )
477
503
  end
478
504
 
479
505
  # Returns a paginated list of `TeamMemberWage` instances for a business.
480
- # @param [String] team_member_id Optional parameter: Filter wages returned
481
- # to only those that are associated with the specified team member.
482
- # @param [Integer] limit Optional parameter: Maximum number of Team Member
483
- # Wages to return per page. Can range between 1 and 200. The default is the
484
- # maximum at 200.
485
- # @param [String] cursor Optional parameter: Pointer to the next page of
486
- # Employee Wage results to fetch.
506
+ # @param [String] team_member_id Optional parameter: Filter the returned
507
+ # wages to only those that are associated with the specified team member.
508
+ # @param [Integer] limit Optional parameter: The maximum number of
509
+ # `TeamMemberWage` results to return per page. The number can range between
510
+ # 1 and 200. The default is 200.
511
+ # @param [String] cursor Optional parameter: A pointer to the next page of
512
+ # `EmployeeWage` results to fetch.
487
513
  # @return [ListTeamMemberWagesResponse Hash] response from the API call
488
514
  def list_team_member_wages(team_member_id: nil,
489
515
  limit: nil,
@@ -515,12 +541,14 @@ module Square
515
541
  # Return appropriate response type.
516
542
  decoded = APIHelper.json_deserialize(_response.raw_body)
517
543
  _errors = APIHelper.map_response(decoded, ['errors'])
518
- ApiResponse.new(_response, data: decoded, errors: _errors)
544
+ ApiResponse.new(
545
+ _response, data: decoded, errors: _errors
546
+ )
519
547
  end
520
548
 
521
- # Returns a single `TeamMemberWage` specified by id.
522
- # @param [String] id Required parameter: UUID for the `TeamMemberWage` being
523
- # retrieved.
549
+ # Returns a single `TeamMemberWage` specified by `id `.
550
+ # @param [String] id Required parameter: The UUID for the `TeamMemberWage`
551
+ # being retrieved.
524
552
  # @return [GetTeamMemberWageResponse Hash] response from the API call
525
553
  def get_team_member_wage(id:)
526
554
  # Prepare query url.
@@ -528,7 +556,7 @@ module Square
528
556
  _query_builder << '/v2/labor/team-member-wages/{id}'
529
557
  _query_builder = APIHelper.append_url_with_template_parameters(
530
558
  _query_builder,
531
- 'id' => id
559
+ 'id' => { 'value' => id, 'encode' => true }
532
560
  )
533
561
  _query_url = APIHelper.clean_url _query_builder
534
562
 
@@ -548,14 +576,16 @@ module Square
548
576
  # Return appropriate response type.
549
577
  decoded = APIHelper.json_deserialize(_response.raw_body)
550
578
  _errors = APIHelper.map_response(decoded, ['errors'])
551
- ApiResponse.new(_response, data: decoded, errors: _errors)
579
+ ApiResponse.new(
580
+ _response, data: decoded, errors: _errors
581
+ )
552
582
  end
553
583
 
554
584
  # Returns a list of `WorkweekConfig` instances for a business.
555
- # @param [Integer] limit Optional parameter: Maximum number of Workweek
556
- # Configs to return per page.
557
- # @param [String] cursor Optional parameter: Pointer to the next page of
558
- # Workweek Config results to fetch.
585
+ # @param [Integer] limit Optional parameter: The maximum number of
586
+ # `WorkweekConfigs` results to return per page.
587
+ # @param [String] cursor Optional parameter: A pointer to the next page of
588
+ # `WorkweekConfig` results to fetch.
559
589
  # @return [ListWorkweekConfigsResponse Hash] response from the API call
560
590
  def list_workweek_configs(limit: nil,
561
591
  cursor: nil)
@@ -585,11 +615,13 @@ module Square
585
615
  # Return appropriate response type.
586
616
  decoded = APIHelper.json_deserialize(_response.raw_body)
587
617
  _errors = APIHelper.map_response(decoded, ['errors'])
588
- ApiResponse.new(_response, data: decoded, errors: _errors)
618
+ ApiResponse.new(
619
+ _response, data: decoded, errors: _errors
620
+ )
589
621
  end
590
622
 
591
623
  # Updates a `WorkweekConfig`.
592
- # @param [String] id Required parameter: UUID for the `WorkweekConfig`
624
+ # @param [String] id Required parameter: The UUID for the `WorkweekConfig`
593
625
  # object being updated.
594
626
  # @param [UpdateWorkweekConfigRequest] body Required parameter: An object
595
627
  # containing the fields to POST for the request. See the corresponding
@@ -602,14 +634,14 @@ module Square
602
634
  _query_builder << '/v2/labor/workweek-configs/{id}'
603
635
  _query_builder = APIHelper.append_url_with_template_parameters(
604
636
  _query_builder,
605
- 'id' => id
637
+ 'id' => { 'value' => id, 'encode' => true }
606
638
  )
607
639
  _query_url = APIHelper.clean_url _query_builder
608
640
 
609
641
  # Prepare headers.
610
642
  _headers = {
611
643
  'accept' => 'application/json',
612
- 'content-type' => 'application/json; charset=utf-8'
644
+ 'Content-Type' => 'application/json'
613
645
  }
614
646
 
615
647
  # Prepare and execute HttpRequest.
@@ -624,7 +656,9 @@ module Square
624
656
  # Return appropriate response type.
625
657
  decoded = APIHelper.json_deserialize(_response.raw_body)
626
658
  _errors = APIHelper.map_response(decoded, ['errors'])
627
- ApiResponse.new(_response, data: decoded, errors: _errors)
659
+ ApiResponse.new(
660
+ _response, data: decoded, errors: _errors
661
+ )
628
662
  end
629
663
  end
630
664
  end
@@ -5,12 +5,9 @@ module Square
5
5
  super(config, http_call_back: http_call_back)
6
6
  end
7
7
 
8
- # Provides information of all locations of a business.
9
- # Most other Connect API endpoints have a required `location_id` path
10
- # parameter.
11
- # The `id` field of the [`Location`](#type-location) objects returned by
12
- # this
13
- # endpoint correspond to that `location_id` parameter.
8
+ # Provides details about all of the seller's
9
+ # [locations](https://developer.squareup.com/docs/locations-api),
10
+ # including those with an inactive status.
14
11
  # @return [ListLocationsResponse Hash] response from the API call
15
12
  def list_locations
16
13
  # Prepare query url.
@@ -34,12 +31,22 @@ module Square
34
31
  # Return appropriate response type.
35
32
  decoded = APIHelper.json_deserialize(_response.raw_body)
36
33
  _errors = APIHelper.map_response(decoded, ['errors'])
37
- ApiResponse.new(_response, data: decoded, errors: _errors)
34
+ ApiResponse.new(
35
+ _response, data: decoded, errors: _errors
36
+ )
38
37
  end
39
38
 
40
- # Creates a location.
41
- # For more information about locations, see [Locations API
42
- # Overview](https://developer.squareup.com/docs/locations-api).
39
+ # Creates a [location](https://developer.squareup.com/docs/locations-api).
40
+ # Creating new locations allows for separate configuration of receipt
41
+ # layouts, item prices,
42
+ # and sales reports. Developers can use locations to separate sales activity
43
+ # via applications
44
+ # that integrate with Square from sales activity elsewhere in a seller's
45
+ # account.
46
+ # Locations created programmatically with the Locations API will last
47
+ # forever and
48
+ # are visible to the seller for their own management, so ensure that
49
+ # each location has a sensible and unique name.
43
50
  # @param [CreateLocationRequest] body Required parameter: An object
44
51
  # containing the fields to POST for the request. See the corresponding
45
52
  # object definition for field details.
@@ -53,7 +60,7 @@ module Square
53
60
  # Prepare headers.
54
61
  _headers = {
55
62
  'accept' => 'application/json',
56
- 'content-type' => 'application/json; charset=utf-8'
63
+ 'Content-Type' => 'application/json'
57
64
  }
58
65
 
59
66
  # Prepare and execute HttpRequest.
@@ -68,17 +75,17 @@ module Square
68
75
  # Return appropriate response type.
69
76
  decoded = APIHelper.json_deserialize(_response.raw_body)
70
77
  _errors = APIHelper.map_response(decoded, ['errors'])
71
- ApiResponse.new(_response, data: decoded, errors: _errors)
78
+ ApiResponse.new(
79
+ _response, data: decoded, errors: _errors
80
+ )
72
81
  end
73
82
 
74
- # Retrieves details of a location. You can specify "main"
75
- # as the location ID to retrieve details of the
76
- # main location. For more information,
77
- # see [Locations API
78
- # Overview](https://developer.squareup.com/docs/docs/locations-api).
83
+ # Retrieves details of a single location. Specify "main"
84
+ # as the location ID to retrieve details of the [main
85
+ # location](https://developer.squareup.com/docs/locations-api#about-the-main
86
+ # -location).
79
87
  # @param [String] location_id Required parameter: The ID of the location to
80
- # retrieve. If you specify the string "main", then the endpoint returns the
81
- # main location.
88
+ # retrieve. Specify the string "main" to return the main location.
82
89
  # @return [RetrieveLocationResponse Hash] response from the API call
83
90
  def retrieve_location(location_id:)
84
91
  # Prepare query url.
@@ -86,7 +93,7 @@ module Square
86
93
  _query_builder << '/v2/locations/{location_id}'
87
94
  _query_builder = APIHelper.append_url_with_template_parameters(
88
95
  _query_builder,
89
- 'location_id' => location_id
96
+ 'location_id' => { 'value' => location_id, 'encode' => true }
90
97
  )
91
98
  _query_url = APIHelper.clean_url _query_builder
92
99
 
@@ -106,10 +113,12 @@ module Square
106
113
  # Return appropriate response type.
107
114
  decoded = APIHelper.json_deserialize(_response.raw_body)
108
115
  _errors = APIHelper.map_response(decoded, ['errors'])
109
- ApiResponse.new(_response, data: decoded, errors: _errors)
116
+ ApiResponse.new(
117
+ _response, data: decoded, errors: _errors
118
+ )
110
119
  end
111
120
 
112
- # Updates a location.
121
+ # Updates a [location](https://developer.squareup.com/docs/locations-api).
113
122
  # @param [String] location_id Required parameter: The ID of the location to
114
123
  # update.
115
124
  # @param [UpdateLocationRequest] body Required parameter: An object
@@ -123,14 +132,14 @@ module Square
123
132
  _query_builder << '/v2/locations/{location_id}'
124
133
  _query_builder = APIHelper.append_url_with_template_parameters(
125
134
  _query_builder,
126
- 'location_id' => location_id
135
+ 'location_id' => { 'value' => location_id, 'encode' => true }
127
136
  )
128
137
  _query_url = APIHelper.clean_url _query_builder
129
138
 
130
139
  # Prepare headers.
131
140
  _headers = {
132
141
  'accept' => 'application/json',
133
- 'content-type' => 'application/json; charset=utf-8'
142
+ 'Content-Type' => 'application/json'
134
143
  }
135
144
 
136
145
  # Prepare and execute HttpRequest.
@@ -145,7 +154,9 @@ module Square
145
154
  # Return appropriate response type.
146
155
  decoded = APIHelper.json_deserialize(_response.raw_body)
147
156
  _errors = APIHelper.map_response(decoded, ['errors'])
148
- ApiResponse.new(_response, data: decoded, errors: _errors)
157
+ ApiResponse.new(
158
+ _response, data: decoded, errors: _errors
159
+ )
149
160
  end
150
161
  end
151
162
  end