square.rb 10.0.0.20210421 → 13.0.0.20210721

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.
@@ -0,0 +1,127 @@
1
+ module Square
2
+ # GiftCardActivitiesApi
3
+ class GiftCardActivitiesApi < BaseApi
4
+ def initialize(config, http_call_back: nil)
5
+ super(config, http_call_back: http_call_back)
6
+ end
7
+
8
+ # Lists gift card activities. By default, you get gift card activities for
9
+ # all
10
+ # gift cards in the seller's account. You can optionally specify query
11
+ # parameters to
12
+ # filter the list. For example, you can get a list of gift card activities
13
+ # for a gift card,
14
+ # for all gift cards in a specific region, or for activities within a time
15
+ # window.
16
+ # @param [String] gift_card_id Optional parameter: If you provide a gift
17
+ # card ID, the endpoint returns activities that belong to the specified
18
+ # gift card. Otherwise, the endpoint returns all gift card activities for
19
+ # the seller.
20
+ # @param [String] type Optional parameter: If you provide a type, the
21
+ # endpoint returns gift card activities of this type. Otherwise, the
22
+ # endpoint returns all types of gift card activities.
23
+ # @param [String] location_id Optional parameter: If you provide a location
24
+ # ID, the endpoint returns gift card activities for that location.
25
+ # Otherwise, the endpoint returns gift card activities for all locations.
26
+ # @param [String] begin_time Optional parameter: The timestamp for the
27
+ # beginning of the reporting period, in RFC 3339 format. Inclusive. Default:
28
+ # The current time minus one year.
29
+ # @param [String] end_time Optional parameter: The timestamp for the end of
30
+ # the reporting period, in RFC 3339 format. Inclusive. Default: The current
31
+ # time.
32
+ # @param [Integer] limit Optional parameter: If you provide a limit value,
33
+ # the endpoint returns the specified number of results (or less) per page.
34
+ # A maximum value is 100. The default value is 50.
35
+ # @param [String] cursor Optional parameter: A pagination cursor returned by
36
+ # a previous call to this endpoint. Provide this cursor to retrieve the next
37
+ # set of results for the original query. If you do not provide the cursor,
38
+ # the call returns the first page of the results.
39
+ # @param [String] sort_order Optional parameter: The order in which the
40
+ # endpoint returns the activities, based on `created_at`. - `ASC` - Oldest
41
+ # to newest. - `DESC` - Newest to oldest (default).
42
+ # @return [ListGiftCardActivitiesResponse Hash] response from the API call
43
+ def list_gift_card_activities(gift_card_id: nil,
44
+ type: nil,
45
+ location_id: nil,
46
+ begin_time: nil,
47
+ end_time: nil,
48
+ limit: nil,
49
+ cursor: nil,
50
+ sort_order: nil)
51
+ # Prepare query url.
52
+ _query_builder = config.get_base_uri
53
+ _query_builder << '/v2/gift-cards/activities'
54
+ _query_builder = APIHelper.append_url_with_query_parameters(
55
+ _query_builder,
56
+ 'gift_card_id' => gift_card_id,
57
+ 'type' => type,
58
+ 'location_id' => location_id,
59
+ 'begin_time' => begin_time,
60
+ 'end_time' => end_time,
61
+ 'limit' => limit,
62
+ 'cursor' => cursor,
63
+ 'sort_order' => sort_order
64
+ )
65
+ _query_url = APIHelper.clean_url _query_builder
66
+
67
+ # Prepare headers.
68
+ _headers = {
69
+ 'accept' => 'application/json'
70
+ }
71
+
72
+ # Prepare and execute HttpRequest.
73
+ _request = config.http_client.get(
74
+ _query_url,
75
+ headers: _headers
76
+ )
77
+ OAuth2.apply(config, _request)
78
+ _response = execute_request(_request)
79
+
80
+ # Return appropriate response type.
81
+ decoded = APIHelper.json_deserialize(_response.raw_body)
82
+ _errors = APIHelper.map_response(decoded, ['errors'])
83
+ ApiResponse.new(
84
+ _response, data: decoded, errors: _errors
85
+ )
86
+ end
87
+
88
+ # Creates a gift card activity. For more information, see
89
+ # [GiftCardActivity](https://developer.squareup.com/docs/gift-cards/using-gi
90
+ # ft-cards-api#giftcardactivity) and
91
+ # [Using activated gift
92
+ # cards](https://developer.squareup.com/docs/gift-cards/using-gift-cards-api
93
+ # #using-activated-gift-cards).
94
+ # @param [CreateGiftCardActivityRequest] body Required parameter: An object
95
+ # containing the fields to POST for the request. See the corresponding
96
+ # object definition for field details.
97
+ # @return [CreateGiftCardActivityResponse Hash] response from the API call
98
+ def create_gift_card_activity(body:)
99
+ # Prepare query url.
100
+ _query_builder = config.get_base_uri
101
+ _query_builder << '/v2/gift-cards/activities'
102
+ _query_url = APIHelper.clean_url _query_builder
103
+
104
+ # Prepare headers.
105
+ _headers = {
106
+ 'accept' => 'application/json',
107
+ 'content-type' => 'application/json; charset=utf-8'
108
+ }
109
+
110
+ # Prepare and execute HttpRequest.
111
+ _request = config.http_client.post(
112
+ _query_url,
113
+ headers: _headers,
114
+ parameters: body.to_json
115
+ )
116
+ OAuth2.apply(config, _request)
117
+ _response = execute_request(_request)
118
+
119
+ # Return appropriate response type.
120
+ decoded = APIHelper.json_deserialize(_response.raw_body)
121
+ _errors = APIHelper.map_response(decoded, ['errors'])
122
+ ApiResponse.new(
123
+ _response, data: decoded, errors: _errors
124
+ )
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,291 @@
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 is provided, gift cards
11
+ # of this type are returned (see [GiftCardType]($m/GiftCardType)). If no
12
+ # type is provided, it returns gift cards of all types.
13
+ # @param [String] state Optional parameter: If the state is provided, it
14
+ # returns the gift cards in the specified state (see
15
+ # [GiftCardStatus]($m/GiftCardStatus)). Otherwise, it returns the gift cards
16
+ # of all states.
17
+ # @param [Integer] limit Optional parameter: If a value is provided, it
18
+ # returns only that number of results per page. The maximum number of
19
+ # results allowed per page is 50. The default value is 30.
20
+ # @param [String] cursor Optional parameter: A pagination cursor returned by
21
+ # a previous call to this endpoint. Provide this cursor to retrieve the next
22
+ # set of results for the original query. If a cursor is not provided, it
23
+ # returns the first page of the results. For more information, see
24
+ # [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
25
+ # ion).
26
+ # @param [String] customer_id Optional parameter: If a value is provided,
27
+ # returns only the gift cards linked to the specified customer
28
+ # @return [ListGiftCardsResponse Hash] response from the API call
29
+ def list_gift_cards(type: nil,
30
+ state: nil,
31
+ limit: nil,
32
+ cursor: nil,
33
+ customer_id: nil)
34
+ # Prepare query url.
35
+ _query_builder = config.get_base_uri
36
+ _query_builder << '/v2/gift-cards'
37
+ _query_builder = APIHelper.append_url_with_query_parameters(
38
+ _query_builder,
39
+ 'type' => type,
40
+ 'state' => state,
41
+ 'limit' => limit,
42
+ 'cursor' => cursor,
43
+ 'customer_id' => customer_id
44
+ )
45
+ _query_url = APIHelper.clean_url _query_builder
46
+
47
+ # Prepare headers.
48
+ _headers = {
49
+ 'accept' => 'application/json'
50
+ }
51
+
52
+ # Prepare and execute HttpRequest.
53
+ _request = config.http_client.get(
54
+ _query_url,
55
+ headers: _headers
56
+ )
57
+ OAuth2.apply(config, _request)
58
+ _response = execute_request(_request)
59
+
60
+ # Return appropriate response type.
61
+ decoded = APIHelper.json_deserialize(_response.raw_body)
62
+ _errors = APIHelper.map_response(decoded, ['errors'])
63
+ ApiResponse.new(
64
+ _response, data: decoded, errors: _errors
65
+ )
66
+ end
67
+
68
+ # Creates a digital gift card. You must activate the gift card before
69
+ # it can be used. For more information, see
70
+ # [Selling gift
71
+ # cards](https://developer.squareup.com/docs/gift-cards/using-gift-cards-api
72
+ # #selling-square-gift-cards).
73
+ # @param [CreateGiftCardRequest] body Required parameter: An object
74
+ # containing the fields to POST for the request. See the corresponding
75
+ # object definition for field details.
76
+ # @return [CreateGiftCardResponse Hash] response from the API call
77
+ def create_gift_card(body:)
78
+ # Prepare query url.
79
+ _query_builder = config.get_base_uri
80
+ _query_builder << '/v2/gift-cards'
81
+ _query_url = APIHelper.clean_url _query_builder
82
+
83
+ # Prepare headers.
84
+ _headers = {
85
+ 'accept' => 'application/json',
86
+ 'content-type' => 'application/json; charset=utf-8'
87
+ }
88
+
89
+ # Prepare and execute HttpRequest.
90
+ _request = config.http_client.post(
91
+ _query_url,
92
+ headers: _headers,
93
+ parameters: body.to_json
94
+ )
95
+ OAuth2.apply(config, _request)
96
+ _response = execute_request(_request)
97
+
98
+ # Return appropriate response type.
99
+ decoded = APIHelper.json_deserialize(_response.raw_body)
100
+ _errors = APIHelper.map_response(decoded, ['errors'])
101
+ ApiResponse.new(
102
+ _response, data: decoded, errors: _errors
103
+ )
104
+ end
105
+
106
+ # Retrieves a gift card using the gift card account number (GAN).
107
+ # @param [RetrieveGiftCardFromGANRequest] body Required parameter: An object
108
+ # containing the fields to POST for the request. See the corresponding
109
+ # object definition for field details.
110
+ # @return [RetrieveGiftCardFromGANResponse Hash] response from the API call
111
+ def retrieve_gift_card_from_gan(body:)
112
+ # Prepare query url.
113
+ _query_builder = config.get_base_uri
114
+ _query_builder << '/v2/gift-cards/from-gan'
115
+ _query_url = APIHelper.clean_url _query_builder
116
+
117
+ # Prepare headers.
118
+ _headers = {
119
+ 'accept' => 'application/json',
120
+ 'content-type' => 'application/json; charset=utf-8'
121
+ }
122
+
123
+ # Prepare and execute HttpRequest.
124
+ _request = config.http_client.post(
125
+ _query_url,
126
+ headers: _headers,
127
+ parameters: body.to_json
128
+ )
129
+ OAuth2.apply(config, _request)
130
+ _response = execute_request(_request)
131
+
132
+ # Return appropriate response type.
133
+ decoded = APIHelper.json_deserialize(_response.raw_body)
134
+ _errors = APIHelper.map_response(decoded, ['errors'])
135
+ ApiResponse.new(
136
+ _response, data: decoded, errors: _errors
137
+ )
138
+ end
139
+
140
+ # Retrieves a gift card using a nonce (a secure token) that represents the
141
+ # gift card.
142
+ # @param [RetrieveGiftCardFromNonceRequest] body Required parameter: An
143
+ # object containing the fields to POST for the request. See the
144
+ # corresponding object definition for field details.
145
+ # @return [RetrieveGiftCardFromNonceResponse Hash] response from the API call
146
+ def retrieve_gift_card_from_nonce(body:)
147
+ # Prepare query url.
148
+ _query_builder = config.get_base_uri
149
+ _query_builder << '/v2/gift-cards/from-nonce'
150
+ _query_url = APIHelper.clean_url _query_builder
151
+
152
+ # Prepare headers.
153
+ _headers = {
154
+ 'accept' => 'application/json',
155
+ 'content-type' => 'application/json; charset=utf-8'
156
+ }
157
+
158
+ # Prepare and execute HttpRequest.
159
+ _request = config.http_client.post(
160
+ _query_url,
161
+ headers: _headers,
162
+ parameters: body.to_json
163
+ )
164
+ OAuth2.apply(config, _request)
165
+ _response = execute_request(_request)
166
+
167
+ # Return appropriate response type.
168
+ decoded = APIHelper.json_deserialize(_response.raw_body)
169
+ _errors = APIHelper.map_response(decoded, ['errors'])
170
+ ApiResponse.new(
171
+ _response, data: decoded, errors: _errors
172
+ )
173
+ end
174
+
175
+ # Links a customer to a gift card
176
+ # @param [String] gift_card_id Required parameter: The ID of the gift card
177
+ # to link.
178
+ # @param [LinkCustomerToGiftCardRequest] body Required parameter: An object
179
+ # containing the fields to POST for the request. See the corresponding
180
+ # object definition for field details.
181
+ # @return [LinkCustomerToGiftCardResponse Hash] response from the API call
182
+ def link_customer_to_gift_card(gift_card_id:,
183
+ body:)
184
+ # Prepare query url.
185
+ _query_builder = config.get_base_uri
186
+ _query_builder << '/v2/gift-cards/{gift_card_id}/link-customer'
187
+ _query_builder = APIHelper.append_url_with_template_parameters(
188
+ _query_builder,
189
+ 'gift_card_id' => { 'value' => gift_card_id, 'encode' => true }
190
+ )
191
+ _query_url = APIHelper.clean_url _query_builder
192
+
193
+ # Prepare headers.
194
+ _headers = {
195
+ 'accept' => 'application/json',
196
+ 'content-type' => 'application/json; charset=utf-8'
197
+ }
198
+
199
+ # Prepare and execute HttpRequest.
200
+ _request = config.http_client.post(
201
+ _query_url,
202
+ headers: _headers,
203
+ parameters: body.to_json
204
+ )
205
+ OAuth2.apply(config, _request)
206
+ _response = execute_request(_request)
207
+
208
+ # Return appropriate response type.
209
+ decoded = APIHelper.json_deserialize(_response.raw_body)
210
+ _errors = APIHelper.map_response(decoded, ['errors'])
211
+ ApiResponse.new(
212
+ _response, data: decoded, errors: _errors
213
+ )
214
+ end
215
+
216
+ # Unlinks a customer from a gift card
217
+ # @param [String] gift_card_id Required parameter: Example:
218
+ # @param [UnlinkCustomerFromGiftCardRequest] body Required parameter: An
219
+ # object containing the fields to POST for the request. See the
220
+ # corresponding object definition for field details.
221
+ # @return [UnlinkCustomerFromGiftCardResponse Hash] response from the API call
222
+ def unlink_customer_from_gift_card(gift_card_id:,
223
+ body:)
224
+ # Prepare query url.
225
+ _query_builder = config.get_base_uri
226
+ _query_builder << '/v2/gift-cards/{gift_card_id}/unlink-customer'
227
+ _query_builder = APIHelper.append_url_with_template_parameters(
228
+ _query_builder,
229
+ 'gift_card_id' => { 'value' => gift_card_id, 'encode' => true }
230
+ )
231
+ _query_url = APIHelper.clean_url _query_builder
232
+
233
+ # Prepare headers.
234
+ _headers = {
235
+ 'accept' => 'application/json',
236
+ 'content-type' => 'application/json; charset=utf-8'
237
+ }
238
+
239
+ # Prepare and execute HttpRequest.
240
+ _request = config.http_client.post(
241
+ _query_url,
242
+ headers: _headers,
243
+ parameters: body.to_json
244
+ )
245
+ OAuth2.apply(config, _request)
246
+ _response = execute_request(_request)
247
+
248
+ # Return appropriate response type.
249
+ decoded = APIHelper.json_deserialize(_response.raw_body)
250
+ _errors = APIHelper.map_response(decoded, ['errors'])
251
+ ApiResponse.new(
252
+ _response, data: decoded, errors: _errors
253
+ )
254
+ end
255
+
256
+ # Retrieves a gift card using its ID.
257
+ # @param [String] id Required parameter: The ID of the gift card to
258
+ # retrieve.
259
+ # @return [RetrieveGiftCardResponse Hash] response from the API call
260
+ def retrieve_gift_card(id:)
261
+ # Prepare query url.
262
+ _query_builder = config.get_base_uri
263
+ _query_builder << '/v2/gift-cards/{id}'
264
+ _query_builder = APIHelper.append_url_with_template_parameters(
265
+ _query_builder,
266
+ 'id' => { 'value' => id, 'encode' => true }
267
+ )
268
+ _query_url = APIHelper.clean_url _query_builder
269
+
270
+ # Prepare headers.
271
+ _headers = {
272
+ 'accept' => 'application/json'
273
+ }
274
+
275
+ # Prepare and execute HttpRequest.
276
+ _request = config.http_client.get(
277
+ _query_url,
278
+ headers: _headers
279
+ )
280
+ OAuth2.apply(config, _request)
281
+ _response = execute_request(_request)
282
+
283
+ # Return appropriate response type.
284
+ decoded = APIHelper.json_deserialize(_response.raw_body)
285
+ _errors = APIHelper.map_response(decoded, ['errors'])
286
+ ApiResponse.new(
287
+ _response, data: decoded, errors: _errors
288
+ )
289
+ end
290
+ end
291
+ end
@@ -5,6 +5,46 @@ module Square
5
5
  super(config, http_call_back: http_call_back)
6
6
  end
7
7
 
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
+
8
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
@@ -13,7 +53,7 @@ module Square
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; charset=utf-8'
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; charset=utf-8'
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; charset=utf-8'
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,7 +209,7 @@ 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.
@@ -91,7 +248,7 @@ 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.
@@ -134,7 +291,7 @@ 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.
@@ -160,6 +317,46 @@ module Square
160
317
  )
161
318
  end
162
319
 
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
+
163
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
@@ -168,7 +365,7 @@ module Square
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,6 +393,42 @@ 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
433
  # [CatalogObject]($m/CatalogObject) at a given set of
201
434
  # [Location]($m/Location)s. Responses are paginated and unsorted.
@@ -252,6 +485,11 @@ module Square
252
485
  # Returns a set of physical counts and inventory adjustments for the
253
486
  # provided [CatalogObject]($m/CatalogObject) at the requested
254
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
@@ -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'