square.rb 8.1.0.20210121 → 18.1.0.20220316

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +59 -213
  4. data/lib/square/api/apple_pay_api.rb +9 -8
  5. data/lib/square/api/bank_accounts_api.rb +5 -5
  6. data/lib/square/api/base_api.rb +20 -9
  7. data/lib/square/api/bookings_api.rb +95 -12
  8. data/lib/square/api/cards_api.rb +170 -0
  9. data/lib/square/api/cash_drawers_api.rb +2 -2
  10. data/lib/square/api/catalog_api.rb +140 -66
  11. data/lib/square/api/checkout_api.rb +3 -3
  12. data/lib/square/api/customer_groups_api.rb +17 -8
  13. data/lib/square/api/customer_segments_api.rb +15 -6
  14. data/lib/square/api/customers_api.rb +61 -31
  15. data/lib/square/api/devices_api.rb +3 -2
  16. data/lib/square/api/disputes_api.rb +101 -92
  17. data/lib/square/api/gift_card_activities_api.rb +133 -0
  18. data/lib/square/api/gift_cards_api.rb +297 -0
  19. data/lib/square/api/inventory_api.rb +263 -24
  20. data/lib/square/api/invoices_api.rb +19 -19
  21. data/lib/square/api/labor_api.rb +70 -68
  22. data/lib/square/api/locations_api.rb +22 -14
  23. data/lib/square/api/loyalty_api.rb +86 -32
  24. data/lib/square/api/merchants_api.rb +11 -9
  25. data/lib/square/api/mobile_authorization_api.rb +4 -4
  26. data/lib/square/api/o_auth_api.rb +31 -25
  27. data/lib/square/api/orders_api.rb +78 -39
  28. data/lib/square/api/payments_api.rb +71 -23
  29. data/lib/square/api/refunds_api.rb +18 -7
  30. data/lib/square/api/sites_api.rb +43 -0
  31. data/lib/square/api/snippets_api.rb +146 -0
  32. data/lib/square/api/subscriptions_api.rb +190 -12
  33. data/lib/square/api/team_api.rb +46 -46
  34. data/lib/square/api/terminal_api.rb +19 -18
  35. data/lib/square/api/transactions_api.rb +15 -191
  36. data/lib/square/api/v1_transactions_api.rb +13 -85
  37. data/lib/square/api/vendors_api.rb +257 -0
  38. data/lib/square/api_helper.rb +45 -57
  39. data/lib/square/client.rb +54 -18
  40. data/lib/square/configuration.rb +59 -20
  41. data/lib/square/http/api_response.rb +1 -1
  42. data/lib/square/http/faraday_client.rb +24 -4
  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 +49 -44
  46. data/test/api/test_locations_api.rb +2 -5
  47. data/test/test_helper.rb +1 -1
  48. metadata +11 -6
  49. data/lib/square/api/v1_employees_api.rb +0 -749
  50. data/lib/square/api/v1_items_api.rb +0 -1766
@@ -0,0 +1,297 @@
1
+ module Square
2
+ # GiftCardsApi
3
+ class GiftCardsApi < BaseApi
4
+ def initialize(config, http_call_back: nil)
5
+ super(config, http_call_back: http_call_back)
6
+ end
7
+
8
+ # Lists all gift cards. You can specify optional filters to retrieve
9
+ # a subset of the gift cards.
10
+ # @param [String] type Optional parameter: If a [type]($m/GiftCardType) is
11
+ # provided, the endpoint returns gift cards of the specified type.
12
+ # Otherwise, the endpoint returns gift cards of all types.
13
+ # @param [String] state Optional parameter: If a [state]($m/GiftCardStatus)
14
+ # is provided, the endpoint returns the gift cards in the specified state.
15
+ # Otherwise, the endpoint returns the gift cards of all states.
16
+ # @param [Integer] limit Optional parameter: If a limit is provided, the
17
+ # endpoint returns only the specified number of results per page. The
18
+ # maximum value is 50. The default value is 30. For more information, see
19
+ # [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
20
+ # ion).
21
+ # @param [String] cursor Optional parameter: A pagination cursor returned by
22
+ # a previous call to this endpoint. Provide this cursor to retrieve the next
23
+ # set of results for the original query. If a cursor is not provided, the
24
+ # endpoint returns the first page of the results. For more information, see
25
+ # [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
26
+ # ion).
27
+ # @param [String] customer_id Optional parameter: If a customer ID is
28
+ # provided, the endpoint returns only the gift cards linked to the specified
29
+ # customer.
30
+ # @return [ListGiftCardsResponse Hash] response from the API call
31
+ def list_gift_cards(type: nil,
32
+ state: nil,
33
+ limit: nil,
34
+ cursor: nil,
35
+ customer_id: nil)
36
+ # Prepare query url.
37
+ _query_builder = config.get_base_uri
38
+ _query_builder << '/v2/gift-cards'
39
+ _query_builder = APIHelper.append_url_with_query_parameters(
40
+ _query_builder,
41
+ 'type' => type,
42
+ 'state' => state,
43
+ 'limit' => limit,
44
+ 'cursor' => cursor,
45
+ 'customer_id' => customer_id
46
+ )
47
+ _query_url = APIHelper.clean_url _query_builder
48
+
49
+ # Prepare headers.
50
+ _headers = {
51
+ 'accept' => 'application/json'
52
+ }
53
+
54
+ # Prepare and execute HttpRequest.
55
+ _request = config.http_client.get(
56
+ _query_url,
57
+ headers: _headers
58
+ )
59
+ OAuth2.apply(config, _request)
60
+ _response = execute_request(_request)
61
+
62
+ # Return appropriate response type.
63
+ decoded = APIHelper.json_deserialize(_response.raw_body)
64
+ _errors = APIHelper.map_response(decoded, ['errors'])
65
+ ApiResponse.new(
66
+ _response, data: decoded, errors: _errors
67
+ )
68
+ end
69
+
70
+ # Creates a digital gift card or registers a physical (plastic) gift card.
71
+ # You must activate the gift card before
72
+ # it can be used for payment. For more information, see
73
+ # [Selling gift
74
+ # cards](https://developer.squareup.com/docs/gift-cards/using-gift-cards-api
75
+ # #selling-square-gift-cards).
76
+ # @param [CreateGiftCardRequest] body Required parameter: An object
77
+ # containing the fields to POST for the request. See the corresponding
78
+ # object definition for field details.
79
+ # @return [CreateGiftCardResponse Hash] response from the API call
80
+ def create_gift_card(body:)
81
+ # Prepare query url.
82
+ _query_builder = config.get_base_uri
83
+ _query_builder << '/v2/gift-cards'
84
+ _query_url = APIHelper.clean_url _query_builder
85
+
86
+ # Prepare headers.
87
+ _headers = {
88
+ 'accept' => 'application/json',
89
+ 'Content-Type' => 'application/json'
90
+ }
91
+
92
+ # Prepare and execute HttpRequest.
93
+ _request = config.http_client.post(
94
+ _query_url,
95
+ headers: _headers,
96
+ parameters: body.to_json
97
+ )
98
+ OAuth2.apply(config, _request)
99
+ _response = execute_request(_request)
100
+
101
+ # Return appropriate response type.
102
+ decoded = APIHelper.json_deserialize(_response.raw_body)
103
+ _errors = APIHelper.map_response(decoded, ['errors'])
104
+ ApiResponse.new(
105
+ _response, data: decoded, errors: _errors
106
+ )
107
+ end
108
+
109
+ # Retrieves a gift card using the gift card account number (GAN).
110
+ # @param [RetrieveGiftCardFromGANRequest] body Required parameter: An object
111
+ # containing the fields to POST for the request. See the corresponding
112
+ # object definition for field details.
113
+ # @return [RetrieveGiftCardFromGANResponse Hash] response from the API call
114
+ def retrieve_gift_card_from_gan(body:)
115
+ # Prepare query url.
116
+ _query_builder = config.get_base_uri
117
+ _query_builder << '/v2/gift-cards/from-gan'
118
+ _query_url = APIHelper.clean_url _query_builder
119
+
120
+ # Prepare headers.
121
+ _headers = {
122
+ 'accept' => 'application/json',
123
+ 'Content-Type' => 'application/json'
124
+ }
125
+
126
+ # Prepare and execute HttpRequest.
127
+ _request = config.http_client.post(
128
+ _query_url,
129
+ headers: _headers,
130
+ parameters: body.to_json
131
+ )
132
+ OAuth2.apply(config, _request)
133
+ _response = execute_request(_request)
134
+
135
+ # Return appropriate response type.
136
+ decoded = APIHelper.json_deserialize(_response.raw_body)
137
+ _errors = APIHelper.map_response(decoded, ['errors'])
138
+ ApiResponse.new(
139
+ _response, data: decoded, errors: _errors
140
+ )
141
+ end
142
+
143
+ # Retrieves a gift card using a secure payment token that represents the
144
+ # gift card.
145
+ # @param [RetrieveGiftCardFromNonceRequest] body Required parameter: An
146
+ # object containing the fields to POST for the request. See the
147
+ # corresponding object definition for field details.
148
+ # @return [RetrieveGiftCardFromNonceResponse Hash] response from the API call
149
+ def retrieve_gift_card_from_nonce(body:)
150
+ # Prepare query url.
151
+ _query_builder = config.get_base_uri
152
+ _query_builder << '/v2/gift-cards/from-nonce'
153
+ _query_url = APIHelper.clean_url _query_builder
154
+
155
+ # Prepare headers.
156
+ _headers = {
157
+ 'accept' => 'application/json',
158
+ 'Content-Type' => 'application/json'
159
+ }
160
+
161
+ # Prepare and execute HttpRequest.
162
+ _request = config.http_client.post(
163
+ _query_url,
164
+ headers: _headers,
165
+ parameters: body.to_json
166
+ )
167
+ OAuth2.apply(config, _request)
168
+ _response = execute_request(_request)
169
+
170
+ # Return appropriate response type.
171
+ decoded = APIHelper.json_deserialize(_response.raw_body)
172
+ _errors = APIHelper.map_response(decoded, ['errors'])
173
+ ApiResponse.new(
174
+ _response, data: decoded, errors: _errors
175
+ )
176
+ end
177
+
178
+ # Links a customer to a gift card, which is also referred to as adding a
179
+ # card on file.
180
+ # @param [String] gift_card_id Required parameter: The ID of the gift card
181
+ # to be linked.
182
+ # @param [LinkCustomerToGiftCardRequest] body Required parameter: An object
183
+ # containing the fields to POST for the request. See the corresponding
184
+ # object definition for field details.
185
+ # @return [LinkCustomerToGiftCardResponse Hash] response from the API call
186
+ def link_customer_to_gift_card(gift_card_id:,
187
+ body:)
188
+ # Prepare query url.
189
+ _query_builder = config.get_base_uri
190
+ _query_builder << '/v2/gift-cards/{gift_card_id}/link-customer'
191
+ _query_builder = APIHelper.append_url_with_template_parameters(
192
+ _query_builder,
193
+ 'gift_card_id' => { 'value' => gift_card_id, 'encode' => true }
194
+ )
195
+ _query_url = APIHelper.clean_url _query_builder
196
+
197
+ # Prepare headers.
198
+ _headers = {
199
+ 'accept' => 'application/json',
200
+ 'Content-Type' => 'application/json'
201
+ }
202
+
203
+ # Prepare and execute HttpRequest.
204
+ _request = config.http_client.post(
205
+ _query_url,
206
+ headers: _headers,
207
+ parameters: body.to_json
208
+ )
209
+ OAuth2.apply(config, _request)
210
+ _response = execute_request(_request)
211
+
212
+ # Return appropriate response type.
213
+ decoded = APIHelper.json_deserialize(_response.raw_body)
214
+ _errors = APIHelper.map_response(decoded, ['errors'])
215
+ ApiResponse.new(
216
+ _response, data: decoded, errors: _errors
217
+ )
218
+ end
219
+
220
+ # Unlinks a customer from a gift card, which is also referred to as removing
221
+ # a card on file.
222
+ # @param [String] gift_card_id Required parameter: The ID of the gift card
223
+ # to be unlinked.
224
+ # @param [UnlinkCustomerFromGiftCardRequest] body Required parameter: An
225
+ # object containing the fields to POST for the request. See the
226
+ # corresponding object definition for field details.
227
+ # @return [UnlinkCustomerFromGiftCardResponse Hash] response from the API call
228
+ def unlink_customer_from_gift_card(gift_card_id:,
229
+ body:)
230
+ # Prepare query url.
231
+ _query_builder = config.get_base_uri
232
+ _query_builder << '/v2/gift-cards/{gift_card_id}/unlink-customer'
233
+ _query_builder = APIHelper.append_url_with_template_parameters(
234
+ _query_builder,
235
+ 'gift_card_id' => { 'value' => gift_card_id, 'encode' => true }
236
+ )
237
+ _query_url = APIHelper.clean_url _query_builder
238
+
239
+ # Prepare headers.
240
+ _headers = {
241
+ 'accept' => 'application/json',
242
+ 'Content-Type' => 'application/json'
243
+ }
244
+
245
+ # Prepare and execute HttpRequest.
246
+ _request = config.http_client.post(
247
+ _query_url,
248
+ headers: _headers,
249
+ parameters: body.to_json
250
+ )
251
+ OAuth2.apply(config, _request)
252
+ _response = execute_request(_request)
253
+
254
+ # Return appropriate response type.
255
+ decoded = APIHelper.json_deserialize(_response.raw_body)
256
+ _errors = APIHelper.map_response(decoded, ['errors'])
257
+ ApiResponse.new(
258
+ _response, data: decoded, errors: _errors
259
+ )
260
+ end
261
+
262
+ # Retrieves a gift card using its ID.
263
+ # @param [String] id Required parameter: The ID of the gift card to
264
+ # retrieve.
265
+ # @return [RetrieveGiftCardResponse Hash] response from the API call
266
+ def retrieve_gift_card(id:)
267
+ # Prepare query url.
268
+ _query_builder = config.get_base_uri
269
+ _query_builder << '/v2/gift-cards/{id}'
270
+ _query_builder = APIHelper.append_url_with_template_parameters(
271
+ _query_builder,
272
+ 'id' => { 'value' => id, 'encode' => true }
273
+ )
274
+ _query_url = APIHelper.clean_url _query_builder
275
+
276
+ # Prepare headers.
277
+ _headers = {
278
+ 'accept' => 'application/json'
279
+ }
280
+
281
+ # Prepare and execute HttpRequest.
282
+ _request = config.http_client.get(
283
+ _query_url,
284
+ headers: _headers
285
+ )
286
+ OAuth2.apply(config, _request)
287
+ _response = execute_request(_request)
288
+
289
+ # Return appropriate response type.
290
+ decoded = APIHelper.json_deserialize(_response.raw_body)
291
+ _errors = APIHelper.map_response(decoded, ['errors'])
292
+ ApiResponse.new(
293
+ _response, data: decoded, errors: _errors
294
+ )
295
+ end
296
+ end
297
+ end
@@ -5,15 +5,55 @@ module Square
5
5
  super(config, http_call_back: http_call_back)
6
6
  end
7
7
 
8
- # Returns the [InventoryAdjustment](#type-inventoryadjustment) object
8
+ # Deprecated version of
9
+ # [RetrieveInventoryAdjustment]($e/Inventory/RetrieveInventoryAdjustment)
10
+ # after the endpoint URL
11
+ # is updated to conform to the standard convention.
12
+ # @param [String] adjustment_id Required parameter: ID of the
13
+ # [InventoryAdjustment]($m/InventoryAdjustment) to retrieve.
14
+ # @return [RetrieveInventoryAdjustmentResponse Hash] response from the API call
15
+ def deprecated_retrieve_inventory_adjustment(adjustment_id:)
16
+ warn 'Endpoint deprecated_retrieve_inventory_adjustment in InventoryApi '\
17
+ 'is deprecated'
18
+ # Prepare query url.
19
+ _query_builder = config.get_base_uri
20
+ _query_builder << '/v2/inventory/adjustment/{adjustment_id}'
21
+ _query_builder = APIHelper.append_url_with_template_parameters(
22
+ _query_builder,
23
+ 'adjustment_id' => { 'value' => adjustment_id, 'encode' => true }
24
+ )
25
+ _query_url = APIHelper.clean_url _query_builder
26
+
27
+ # Prepare headers.
28
+ _headers = {
29
+ 'accept' => 'application/json'
30
+ }
31
+
32
+ # Prepare and execute HttpRequest.
33
+ _request = config.http_client.get(
34
+ _query_url,
35
+ headers: _headers
36
+ )
37
+ OAuth2.apply(config, _request)
38
+ _response = execute_request(_request)
39
+
40
+ # Return appropriate response type.
41
+ decoded = APIHelper.json_deserialize(_response.raw_body)
42
+ _errors = APIHelper.map_response(decoded, ['errors'])
43
+ ApiResponse.new(
44
+ _response, data: decoded, errors: _errors
45
+ )
46
+ end
47
+
48
+ # Returns the [InventoryAdjustment]($m/InventoryAdjustment) object
9
49
  # with the provided `adjustment_id`.
10
50
  # @param [String] adjustment_id Required parameter: ID of the
11
- # [InventoryAdjustment](#type-inventoryadjustment) to retrieve.
51
+ # [InventoryAdjustment]($m/InventoryAdjustment) to retrieve.
12
52
  # @return [RetrieveInventoryAdjustmentResponse Hash] response from the API call
13
53
  def retrieve_inventory_adjustment(adjustment_id:)
14
54
  # Prepare query url.
15
55
  _query_builder = config.get_base_uri
16
- _query_builder << '/v2/inventory/adjustment/{adjustment_id}'
56
+ _query_builder << '/v2/inventory/adjustments/{adjustment_id}'
17
57
  _query_builder = APIHelper.append_url_with_template_parameters(
18
58
  _query_builder,
19
59
  'adjustment_id' => { 'value' => adjustment_id, 'encode' => true }
@@ -41,6 +81,123 @@ module Square
41
81
  )
42
82
  end
43
83
 
84
+ # Deprecated version of
85
+ # [BatchChangeInventory]($e/Inventory/BatchChangeInventory) after the
86
+ # endpoint URL
87
+ # is updated to conform to the standard convention.
88
+ # @param [BatchChangeInventoryRequest] body Required parameter: An object
89
+ # containing the fields to POST for the request. See the corresponding
90
+ # object definition for field details.
91
+ # @return [BatchChangeInventoryResponse Hash] response from the API call
92
+ def deprecated_batch_change_inventory(body:)
93
+ warn 'Endpoint deprecated_batch_change_inventory in InventoryApi is depr'\
94
+ 'ecated'
95
+ # Prepare query url.
96
+ _query_builder = config.get_base_uri
97
+ _query_builder << '/v2/inventory/batch-change'
98
+ _query_url = APIHelper.clean_url _query_builder
99
+
100
+ # Prepare headers.
101
+ _headers = {
102
+ 'accept' => 'application/json',
103
+ 'Content-Type' => 'application/json'
104
+ }
105
+
106
+ # Prepare and execute HttpRequest.
107
+ _request = config.http_client.post(
108
+ _query_url,
109
+ headers: _headers,
110
+ parameters: body.to_json
111
+ )
112
+ OAuth2.apply(config, _request)
113
+ _response = execute_request(_request)
114
+
115
+ # Return appropriate response type.
116
+ decoded = APIHelper.json_deserialize(_response.raw_body)
117
+ _errors = APIHelper.map_response(decoded, ['errors'])
118
+ ApiResponse.new(
119
+ _response, data: decoded, errors: _errors
120
+ )
121
+ end
122
+
123
+ # Deprecated version of
124
+ # [BatchRetrieveInventoryChanges]($e/Inventory/BatchRetrieveInventoryChanges
125
+ # ) after the endpoint URL
126
+ # is updated to conform to the standard convention.
127
+ # @param [BatchRetrieveInventoryChangesRequest] body Required parameter: An
128
+ # object containing the fields to POST for the request. See the
129
+ # corresponding object definition for field details.
130
+ # @return [BatchRetrieveInventoryChangesResponse Hash] response from the API call
131
+ def deprecated_batch_retrieve_inventory_changes(body:)
132
+ warn 'Endpoint deprecated_batch_retrieve_inventory_changes in InventoryA'\
133
+ 'pi is deprecated'
134
+ # Prepare query url.
135
+ _query_builder = config.get_base_uri
136
+ _query_builder << '/v2/inventory/batch-retrieve-changes'
137
+ _query_url = APIHelper.clean_url _query_builder
138
+
139
+ # Prepare headers.
140
+ _headers = {
141
+ 'accept' => 'application/json',
142
+ 'Content-Type' => 'application/json'
143
+ }
144
+
145
+ # Prepare and execute HttpRequest.
146
+ _request = config.http_client.post(
147
+ _query_url,
148
+ headers: _headers,
149
+ parameters: body.to_json
150
+ )
151
+ OAuth2.apply(config, _request)
152
+ _response = execute_request(_request)
153
+
154
+ # Return appropriate response type.
155
+ decoded = APIHelper.json_deserialize(_response.raw_body)
156
+ _errors = APIHelper.map_response(decoded, ['errors'])
157
+ ApiResponse.new(
158
+ _response, data: decoded, errors: _errors
159
+ )
160
+ end
161
+
162
+ # Deprecated version of
163
+ # [BatchRetrieveInventoryCounts]($e/Inventory/BatchRetrieveInventoryCounts)
164
+ # after the endpoint URL
165
+ # is updated to conform to the standard convention.
166
+ # @param [BatchRetrieveInventoryCountsRequest] body Required parameter: An
167
+ # object containing the fields to POST for the request. See the
168
+ # corresponding object definition for field details.
169
+ # @return [BatchRetrieveInventoryCountsResponse Hash] response from the API call
170
+ def deprecated_batch_retrieve_inventory_counts(body:)
171
+ warn 'Endpoint deprecated_batch_retrieve_inventory_counts in InventoryAp'\
172
+ 'i is deprecated'
173
+ # Prepare query url.
174
+ _query_builder = config.get_base_uri
175
+ _query_builder << '/v2/inventory/batch-retrieve-counts'
176
+ _query_url = APIHelper.clean_url _query_builder
177
+
178
+ # Prepare headers.
179
+ _headers = {
180
+ 'accept' => 'application/json',
181
+ 'Content-Type' => 'application/json'
182
+ }
183
+
184
+ # Prepare and execute HttpRequest.
185
+ _request = config.http_client.post(
186
+ _query_url,
187
+ headers: _headers,
188
+ parameters: body.to_json
189
+ )
190
+ OAuth2.apply(config, _request)
191
+ _response = execute_request(_request)
192
+
193
+ # Return appropriate response type.
194
+ decoded = APIHelper.json_deserialize(_response.raw_body)
195
+ _errors = APIHelper.map_response(decoded, ['errors'])
196
+ ApiResponse.new(
197
+ _response, data: decoded, errors: _errors
198
+ )
199
+ end
200
+
44
201
  # Applies adjustments and counts to the provided item quantities.
45
202
  # On success: returns the current calculated counts for all objects
46
203
  # referenced in the request.
@@ -52,13 +209,13 @@ module Square
52
209
  def batch_change_inventory(body:)
53
210
  # Prepare query url.
54
211
  _query_builder = config.get_base_uri
55
- _query_builder << '/v2/inventory/batch-change'
212
+ _query_builder << '/v2/inventory/changes/batch-create'
56
213
  _query_url = APIHelper.clean_url _query_builder
57
214
 
58
215
  # Prepare headers.
59
216
  _headers = {
60
217
  'accept' => 'application/json',
61
- 'content-type' => 'application/json; charset=utf-8'
218
+ 'Content-Type' => 'application/json'
62
219
  }
63
220
 
64
221
  # Prepare and execute HttpRequest.
@@ -91,13 +248,13 @@ module Square
91
248
  def batch_retrieve_inventory_changes(body:)
92
249
  # Prepare query url.
93
250
  _query_builder = config.get_base_uri
94
- _query_builder << '/v2/inventory/batch-retrieve-changes'
251
+ _query_builder << '/v2/inventory/changes/batch-retrieve'
95
252
  _query_url = APIHelper.clean_url _query_builder
96
253
 
97
254
  # Prepare headers.
98
255
  _headers = {
99
256
  'accept' => 'application/json',
100
- 'content-type' => 'application/json; charset=utf-8'
257
+ 'Content-Type' => 'application/json'
101
258
  }
102
259
 
103
260
  # Prepare and execute HttpRequest.
@@ -118,8 +275,8 @@ module Square
118
275
  end
119
276
 
120
277
  # Returns current counts for the provided
121
- # [CatalogObject](#type-catalogobject)s at the requested
122
- # [Location](#type-location)s.
278
+ # [CatalogObject]($m/CatalogObject)s at the requested
279
+ # [Location]($m/Location)s.
123
280
  # Results are paginated and sorted in descending order according to their
124
281
  # `calculated_at` timestamp (newest first).
125
282
  # When `updated_after` is specified, only counts that have changed since
@@ -134,13 +291,13 @@ module Square
134
291
  def batch_retrieve_inventory_counts(body:)
135
292
  # Prepare query url.
136
293
  _query_builder = config.get_base_uri
137
- _query_builder << '/v2/inventory/batch-retrieve-counts'
294
+ _query_builder << '/v2/inventory/counts/batch-retrieve'
138
295
  _query_url = APIHelper.clean_url _query_builder
139
296
 
140
297
  # Prepare headers.
141
298
  _headers = {
142
299
  'accept' => 'application/json',
143
- 'content-type' => 'application/json; charset=utf-8'
300
+ 'Content-Type' => 'application/json'
144
301
  }
145
302
 
146
303
  # Prepare and execute HttpRequest.
@@ -160,15 +317,55 @@ module Square
160
317
  )
161
318
  end
162
319
 
163
- # Returns the [InventoryPhysicalCount](#type-inventoryphysicalcount)
320
+ # Deprecated version of
321
+ # [RetrieveInventoryPhysicalCount]($e/Inventory/RetrieveInventoryPhysicalCou
322
+ # nt) after the endpoint URL
323
+ # is updated to conform to the standard convention.
324
+ # @param [String] physical_count_id Required parameter: ID of the
325
+ # [InventoryPhysicalCount]($m/InventoryPhysicalCount) to retrieve.
326
+ # @return [RetrieveInventoryPhysicalCountResponse Hash] response from the API call
327
+ def deprecated_retrieve_inventory_physical_count(physical_count_id:)
328
+ warn 'Endpoint deprecated_retrieve_inventory_physical_count in Inventory'\
329
+ 'Api is deprecated'
330
+ # Prepare query url.
331
+ _query_builder = config.get_base_uri
332
+ _query_builder << '/v2/inventory/physical-count/{physical_count_id}'
333
+ _query_builder = APIHelper.append_url_with_template_parameters(
334
+ _query_builder,
335
+ 'physical_count_id' => { 'value' => physical_count_id, 'encode' => true }
336
+ )
337
+ _query_url = APIHelper.clean_url _query_builder
338
+
339
+ # Prepare headers.
340
+ _headers = {
341
+ 'accept' => 'application/json'
342
+ }
343
+
344
+ # Prepare and execute HttpRequest.
345
+ _request = config.http_client.get(
346
+ _query_url,
347
+ headers: _headers
348
+ )
349
+ OAuth2.apply(config, _request)
350
+ _response = execute_request(_request)
351
+
352
+ # Return appropriate response type.
353
+ decoded = APIHelper.json_deserialize(_response.raw_body)
354
+ _errors = APIHelper.map_response(decoded, ['errors'])
355
+ ApiResponse.new(
356
+ _response, data: decoded, errors: _errors
357
+ )
358
+ end
359
+
360
+ # Returns the [InventoryPhysicalCount]($m/InventoryPhysicalCount)
164
361
  # object with the provided `physical_count_id`.
165
362
  # @param [String] physical_count_id Required parameter: ID of the
166
- # [InventoryPhysicalCount](#type-inventoryphysicalcount) to retrieve.
363
+ # [InventoryPhysicalCount]($m/InventoryPhysicalCount) to retrieve.
167
364
  # @return [RetrieveInventoryPhysicalCountResponse Hash] response from the API call
168
365
  def retrieve_inventory_physical_count(physical_count_id:)
169
366
  # Prepare query url.
170
367
  _query_builder = config.get_base_uri
171
- _query_builder << '/v2/inventory/physical-count/{physical_count_id}'
368
+ _query_builder << '/v2/inventory/physical-counts/{physical_count_id}'
172
369
  _query_builder = APIHelper.append_url_with_template_parameters(
173
370
  _query_builder,
174
371
  'physical_count_id' => { 'value' => physical_count_id, 'encode' => true }
@@ -196,15 +393,51 @@ module Square
196
393
  )
197
394
  end
198
395
 
396
+ # Returns the [InventoryTransfer]($m/InventoryTransfer) object
397
+ # with the provided `transfer_id`.
398
+ # @param [String] transfer_id Required parameter: ID of the
399
+ # [InventoryTransfer]($m/InventoryTransfer) to retrieve.
400
+ # @return [RetrieveInventoryTransferResponse Hash] response from the API call
401
+ def retrieve_inventory_transfer(transfer_id:)
402
+ # Prepare query url.
403
+ _query_builder = config.get_base_uri
404
+ _query_builder << '/v2/inventory/transfers/{transfer_id}'
405
+ _query_builder = APIHelper.append_url_with_template_parameters(
406
+ _query_builder,
407
+ 'transfer_id' => { 'value' => transfer_id, 'encode' => true }
408
+ )
409
+ _query_url = APIHelper.clean_url _query_builder
410
+
411
+ # Prepare headers.
412
+ _headers = {
413
+ 'accept' => 'application/json'
414
+ }
415
+
416
+ # Prepare and execute HttpRequest.
417
+ _request = config.http_client.get(
418
+ _query_url,
419
+ headers: _headers
420
+ )
421
+ OAuth2.apply(config, _request)
422
+ _response = execute_request(_request)
423
+
424
+ # Return appropriate response type.
425
+ decoded = APIHelper.json_deserialize(_response.raw_body)
426
+ _errors = APIHelper.map_response(decoded, ['errors'])
427
+ ApiResponse.new(
428
+ _response, data: decoded, errors: _errors
429
+ )
430
+ end
431
+
199
432
  # Retrieves the current calculated stock count for a given
200
- # [CatalogObject](#type-catalogobject) at a given set of
201
- # [Location](#type-location)s. Responses are paginated and unsorted.
433
+ # [CatalogObject]($m/CatalogObject) at a given set of
434
+ # [Location]($m/Location)s. Responses are paginated and unsorted.
202
435
  # For more sophisticated queries, use a batch endpoint.
203
436
  # @param [String] catalog_object_id Required parameter: ID of the
204
- # [CatalogObject](#type-catalogobject) to retrieve.
437
+ # [CatalogObject]($m/CatalogObject) to retrieve.
205
438
  # @param [String] location_ids Optional parameter: The
206
- # [Location](#type-location) IDs to look up as a comma-separated list. An
207
- # empty list queries all locations.
439
+ # [Location]($m/Location) IDs to look up as a comma-separated list. An empty
440
+ # list queries all locations.
208
441
  # @param [String] cursor Optional parameter: A pagination cursor returned by
209
442
  # a previous call to this endpoint. Provide this to retrieve the next set of
210
443
  # results for the original query. See the
@@ -250,8 +483,13 @@ module Square
250
483
  end
251
484
 
252
485
  # Returns a set of physical counts and inventory adjustments for the
253
- # provided [CatalogObject](#type-catalogobject) at the requested
254
- # [Location](#type-location)s.
486
+ # provided [CatalogObject]($m/CatalogObject) at the requested
487
+ # [Location]($m/Location)s.
488
+ # You can achieve the same result by calling
489
+ # [BatchRetrieveInventoryChanges]($e/Inventory/BatchRetrieveInventoryChanges
490
+ # )
491
+ # and having the `catalog_object_ids` list contain a single element of the
492
+ # `CatalogObject` ID.
255
493
  # Results are paginated and sorted in descending order according to their
256
494
  # `occurred_at` timestamp (newest first).
257
495
  # There are no limits on how far back the caller can page. This endpoint can
@@ -259,10 +497,10 @@ module Square
259
497
  # used to display recent changes for a specific item. For more
260
498
  # sophisticated queries, use a batch endpoint.
261
499
  # @param [String] catalog_object_id Required parameter: ID of the
262
- # [CatalogObject](#type-catalogobject) to retrieve.
500
+ # [CatalogObject]($m/CatalogObject) to retrieve.
263
501
  # @param [String] location_ids Optional parameter: The
264
- # [Location](#type-location) IDs to look up as a comma-separated list. An
265
- # empty list queries all locations.
502
+ # [Location]($m/Location) IDs to look up as a comma-separated list. An empty
503
+ # list queries all locations.
266
504
  # @param [String] cursor Optional parameter: A pagination cursor returned by
267
505
  # a previous call to this endpoint. Provide this to retrieve the next set of
268
506
  # results for the original query. See the
@@ -272,6 +510,7 @@ module Square
272
510
  def retrieve_inventory_changes(catalog_object_id:,
273
511
  location_ids: nil,
274
512
  cursor: nil)
513
+ warn 'Endpoint retrieve_inventory_changes in InventoryApi is deprecated'
275
514
  # Prepare query url.
276
515
  _query_builder = config.get_base_uri
277
516
  _query_builder << '/v2/inventory/{catalog_object_id}/changes'