square.rb 8.0.0.20201216 → 26.1.0.20230119

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +79 -221
  4. data/lib/square/api/apple_pay_api.rb +15 -8
  5. data/lib/square/api/bank_accounts_api.rb +5 -5
  6. data/lib/square/api/base_api.rb +27 -9
  7. data/lib/square/api/booking_custom_attributes_api.rb +555 -0
  8. data/lib/square/api/bookings_api.rb +107 -15
  9. data/lib/square/api/cards_api.rb +171 -0
  10. data/lib/square/api/cash_drawers_api.rb +2 -2
  11. data/lib/square/api/catalog_api.rb +167 -73
  12. data/lib/square/api/checkout_api.rb +205 -3
  13. data/lib/square/api/customer_custom_attributes_api.rb +561 -0
  14. data/lib/square/api/customer_groups_api.rb +17 -8
  15. data/lib/square/api/customer_segments_api.rb +15 -6
  16. data/lib/square/api/customers_api.rb +67 -33
  17. data/lib/square/api/devices_api.rb +3 -2
  18. data/lib/square/api/disputes_api.rb +109 -105
  19. data/lib/square/api/gift_card_activities_api.rb +132 -0
  20. data/lib/square/api/gift_cards_api.rb +298 -0
  21. data/lib/square/api/inventory_api.rb +263 -24
  22. data/lib/square/api/invoices_api.rb +21 -21
  23. data/lib/square/api/labor_api.rb +70 -68
  24. data/lib/square/api/location_custom_attributes_api.rb +584 -0
  25. data/lib/square/api/locations_api.rb +21 -14
  26. data/lib/square/api/loyalty_api.rb +333 -50
  27. data/lib/square/api/merchants_api.rb +11 -9
  28. data/lib/square/api/mobile_authorization_api.rb +4 -4
  29. data/lib/square/api/o_auth_api.rb +78 -25
  30. data/lib/square/api/order_custom_attributes_api.rb +601 -0
  31. data/lib/square/api/orders_api.rb +84 -45
  32. data/lib/square/api/payments_api.rb +72 -24
  33. data/lib/square/api/payouts_api.rb +173 -0
  34. data/lib/square/api/refunds_api.rb +18 -7
  35. data/lib/square/api/sites_api.rb +43 -0
  36. data/lib/square/api/snippets_api.rb +146 -0
  37. data/lib/square/api/subscriptions_api.rb +190 -15
  38. data/lib/square/api/team_api.rb +46 -46
  39. data/lib/square/api/terminal_api.rb +172 -22
  40. data/lib/square/api/transactions_api.rb +15 -191
  41. data/lib/square/api/v1_transactions_api.rb +52 -124
  42. data/lib/square/api/vendors_api.rb +257 -0
  43. data/lib/square/api/webhook_subscriptions_api.rb +327 -0
  44. data/lib/square/api_helper.rb +217 -57
  45. data/lib/square/client.rb +90 -18
  46. data/lib/square/configuration.rb +64 -20
  47. data/lib/square/exceptions/validation_exception.rb +13 -0
  48. data/lib/square/http/api_response.rb +7 -9
  49. data/lib/square/http/faraday_client.rb +40 -9
  50. data/lib/square/http/http_client.rb +31 -12
  51. data/lib/square/http/http_request.rb +6 -2
  52. data/lib/square/utilities/date_time_helper.rb +151 -0
  53. data/lib/square/utilities/file_wrapper.rb +1 -2
  54. data/lib/square.rb +56 -44
  55. data/test/api/test_locations_api.rb +2 -5
  56. data/test/test_helper.rb +2 -2
  57. metadata +83 -15
  58. data/lib/square/api/v1_employees_api.rb +0 -751
  59. data/lib/square/api/v1_items_api.rb +0 -1766
@@ -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,
@@ -57,8 +58,8 @@ module Square
57
58
  # - `break_name`
58
59
  # - `expected_duration`
59
60
  # - `is_paid`
60
- # You can only have 3 `BreakType` instances per location. If you attempt to
61
- # add a 4th
61
+ # You can only have three `BreakType` instances per location. If you attempt
62
+ # to add a fourth
62
63
  # `BreakType` for a location, an `INVALID_REQUEST_ERROR` "Exceeded limit of
63
64
  # 3 breaks per location."
64
65
  # is returned.
@@ -75,7 +76,7 @@ module Square
75
76
  # Prepare headers.
76
77
  _headers = {
77
78
  'accept' => 'application/json',
78
- 'content-type' => 'application/json; charset=utf-8'
79
+ 'Content-Type' => 'application/json'
79
80
  }
80
81
 
81
82
  # Prepare and execute HttpRequest.
@@ -97,7 +98,7 @@ module Square
97
98
 
98
99
  # Deletes an existing `BreakType`.
99
100
  # A `BreakType` can be deleted even if it is referenced from a `Shift`.
100
- # @param [String] id Required parameter: UUID for the `BreakType` being
101
+ # @param [String] id Required parameter: The UUID for the `BreakType` being
101
102
  # deleted.
102
103
  # @return [DeleteBreakTypeResponse Hash] response from the API call
103
104
  def delete_break_type(id:)
@@ -131,8 +132,8 @@ module Square
131
132
  )
132
133
  end
133
134
 
134
- # Returns a single `BreakType` specified by id.
135
- # @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
136
137
  # retrieved.
137
138
  # @return [GetBreakTypeResponse Hash] response from the API call
138
139
  def get_break_type(id:)
@@ -167,7 +168,7 @@ module Square
167
168
  end
168
169
 
169
170
  # Updates an existing `BreakType`.
170
- # @param [String] id Required parameter: UUID for the `BreakType` being
171
+ # @param [String] id Required parameter: The UUID for the `BreakType` being
171
172
  # updated.
172
173
  # @param [UpdateBreakTypeRequest] body Required parameter: An object
173
174
  # containing the fields to POST for the request. See the corresponding
@@ -187,7 +188,7 @@ module Square
187
188
  # Prepare headers.
188
189
  _headers = {
189
190
  'accept' => 'application/json',
190
- 'content-type' => 'application/json; charset=utf-8'
191
+ 'Content-Type' => 'application/json'
191
192
  }
192
193
 
193
194
  # Prepare and execute HttpRequest.
@@ -208,13 +209,13 @@ module Square
208
209
  end
209
210
 
210
211
  # Returns a paginated list of `EmployeeWage` instances for a business.
211
- # @param [String] employee_id Optional parameter: Filter wages returned to
212
- # only those that are associated with the specified employee.
213
- # @param [Integer] limit Optional parameter: Maximum number of Employee
214
- # Wages to return per page. Can range between 1 and 200. The default is the
215
- # maximum at 200.
216
- # @param [String] cursor Optional parameter: Pointer to the next page of
217
- # 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.
218
219
  # @return [ListEmployeeWagesResponse Hash] response from the API call
219
220
  def list_employee_wages(employee_id: nil,
220
221
  limit: nil,
@@ -252,9 +253,9 @@ module Square
252
253
  )
253
254
  end
254
255
 
255
- # Returns a single `EmployeeWage` specified by id.
256
- # @param [String] id Required parameter: UUID for the `EmployeeWage` being
257
- # retrieved.
256
+ # Returns a single `EmployeeWage` specified by `id`.
257
+ # @param [String] id Required parameter: The UUID for the `EmployeeWage`
258
+ # being retrieved.
258
259
  # @return [GetEmployeeWageResponse Hash] response from the API call
259
260
  def get_employee_wage(id:)
260
261
  warn 'Endpoint get_employee_wage in LaborApi is deprecated'
@@ -289,7 +290,7 @@ module Square
289
290
  end
290
291
 
291
292
  # Creates a new `Shift`.
292
- # A `Shift` represents a complete work day for a single employee.
293
+ # A `Shift` represents a complete workday for a single employee.
293
294
  # You must provide the following values in your request to this
294
295
  # endpoint:
295
296
  # - `location_id`
@@ -299,12 +300,12 @@ module Square
299
300
  # when:
300
301
  # - The `status` of the new `Shift` is `OPEN` and the employee has another
301
302
  # shift with an `OPEN` status.
302
- # - The `start_at` date is in the future
303
- # - the `start_at` or `end_at` overlaps another shift for the same employee
304
- # - If `Break`s are set in the request, a break `start_at`
305
- # must not be before the `Shift.start_at`. A break `end_at` must not be
306
- # after
307
- # 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.
308
309
  # @param [CreateShiftRequest] body Required parameter: An object containing
309
310
  # the fields to POST for the request. See the corresponding object
310
311
  # definition for field details.
@@ -318,7 +319,7 @@ module Square
318
319
  # Prepare headers.
319
320
  _headers = {
320
321
  'accept' => 'application/json',
321
- 'content-type' => 'application/json; charset=utf-8'
322
+ 'Content-Type' => 'application/json'
322
323
  }
323
324
 
324
325
  # Prepare and execute HttpRequest.
@@ -340,17 +341,17 @@ module Square
340
341
 
341
342
  # Returns a paginated list of `Shift` records for a business.
342
343
  # The list to be returned can be filtered by:
343
- # - Location IDs **and**
344
- # - employee IDs **and**
345
- # - shift status (`OPEN`, `CLOSED`) **and**
346
- # - shift start **and**
347
- # - shift end **and**
348
- # - work day details
344
+ # - Location IDs.
345
+ # - Employee IDs.
346
+ # - Shift status (`OPEN` and `CLOSED`).
347
+ # - Shift start.
348
+ # - Shift end.
349
+ # - Workday details.
349
350
  # The list can be sorted by:
350
- # - `start_at`
351
- # - `end_at`
352
- # - `created_at`
353
- # - `updated_at`
351
+ # - `start_at`.
352
+ # - `end_at`.
353
+ # - `created_at`.
354
+ # - `updated_at`.
354
355
  # @param [SearchShiftsRequest] body Required parameter: An object containing
355
356
  # the fields to POST for the request. See the corresponding object
356
357
  # definition for field details.
@@ -364,7 +365,7 @@ module Square
364
365
  # Prepare headers.
365
366
  _headers = {
366
367
  'accept' => 'application/json',
367
- 'content-type' => 'application/json; charset=utf-8'
368
+ 'Content-Type' => 'application/json'
368
369
  }
369
370
 
370
371
  # Prepare and execute HttpRequest.
@@ -385,7 +386,7 @@ module Square
385
386
  end
386
387
 
387
388
  # Deletes a `Shift`.
388
- # @param [String] id Required parameter: UUID for the `Shift` being
389
+ # @param [String] id Required parameter: The UUID for the `Shift` being
389
390
  # deleted.
390
391
  # @return [DeleteShiftResponse Hash] response from the API call
391
392
  def delete_shift(id:)
@@ -419,8 +420,8 @@ module Square
419
420
  )
420
421
  end
421
422
 
422
- # Returns a single `Shift` specified by id.
423
- # @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
424
425
  # retrieved.
425
426
  # @return [GetShiftResponse Hash] response from the API call
426
427
  def get_shift(id:)
@@ -455,13 +456,14 @@ module Square
455
456
  end
456
457
 
457
458
  # Updates an existing `Shift`.
458
- # When adding a `Break` to a `Shift`, any earlier `Breaks` in the `Shift`
459
- # have
459
+ # When adding a `Break` to a `Shift`, any earlier `Break` instances in the
460
+ # `Shift` have
460
461
  # the `end_at` property set to a valid RFC-3339 datetime string.
461
- # 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
462
463
  # complete with `end_at`
463
464
  # set on each `Break`.
464
- # @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.
465
467
  # @param [UpdateShiftRequest] body Required parameter: An object containing
466
468
  # the fields to POST for the request. See the corresponding object
467
469
  # definition for field details.
@@ -480,7 +482,7 @@ module Square
480
482
  # Prepare headers.
481
483
  _headers = {
482
484
  'accept' => 'application/json',
483
- 'content-type' => 'application/json; charset=utf-8'
485
+ 'Content-Type' => 'application/json'
484
486
  }
485
487
 
486
488
  # Prepare and execute HttpRequest.
@@ -501,13 +503,13 @@ module Square
501
503
  end
502
504
 
503
505
  # Returns a paginated list of `TeamMemberWage` instances for a business.
504
- # @param [String] team_member_id Optional parameter: Filter wages returned
505
- # to only those that are associated with the specified team member.
506
- # @param [Integer] limit Optional parameter: Maximum number of Team Member
507
- # Wages to return per page. Can range between 1 and 200. The default is the
508
- # maximum at 200.
509
- # @param [String] cursor Optional parameter: Pointer to the next page of
510
- # 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.
511
513
  # @return [ListTeamMemberWagesResponse Hash] response from the API call
512
514
  def list_team_member_wages(team_member_id: nil,
513
515
  limit: nil,
@@ -544,9 +546,9 @@ module Square
544
546
  )
545
547
  end
546
548
 
547
- # Returns a single `TeamMemberWage` specified by id.
548
- # @param [String] id Required parameter: UUID for the `TeamMemberWage` being
549
- # retrieved.
549
+ # Returns a single `TeamMemberWage` specified by `id `.
550
+ # @param [String] id Required parameter: The UUID for the `TeamMemberWage`
551
+ # being retrieved.
550
552
  # @return [GetTeamMemberWageResponse Hash] response from the API call
551
553
  def get_team_member_wage(id:)
552
554
  # Prepare query url.
@@ -580,10 +582,10 @@ module Square
580
582
  end
581
583
 
582
584
  # Returns a list of `WorkweekConfig` instances for a business.
583
- # @param [Integer] limit Optional parameter: Maximum number of Workweek
584
- # Configs to return per page.
585
- # @param [String] cursor Optional parameter: Pointer to the next page of
586
- # 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.
587
589
  # @return [ListWorkweekConfigsResponse Hash] response from the API call
588
590
  def list_workweek_configs(limit: nil,
589
591
  cursor: nil)
@@ -619,7 +621,7 @@ module Square
619
621
  end
620
622
 
621
623
  # Updates a `WorkweekConfig`.
622
- # @param [String] id Required parameter: UUID for the `WorkweekConfig`
624
+ # @param [String] id Required parameter: The UUID for the `WorkweekConfig`
623
625
  # object being updated.
624
626
  # @param [UpdateWorkweekConfigRequest] body Required parameter: An object
625
627
  # containing the fields to POST for the request. See the corresponding
@@ -639,7 +641,7 @@ module Square
639
641
  # Prepare headers.
640
642
  _headers = {
641
643
  'accept' => 'application/json',
642
- 'content-type' => 'application/json; charset=utf-8'
644
+ 'Content-Type' => 'application/json'
643
645
  }
644
646
 
645
647
  # Prepare and execute HttpRequest.