square.rb 12.0.0.20210616 → 14.1.0.20210915
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -2
- data/lib/square/api/base_api.rb +4 -6
- data/lib/square/api/catalog_api.rb +2 -2
- data/lib/square/api/customer_groups_api.rb +10 -2
- data/lib/square/api/customer_segments_api.rb +10 -2
- data/lib/square/api/customers_api.rb +11 -3
- data/lib/square/api/gift_cards_api.rb +3 -2
- data/lib/square/api/inventory_api.rb +244 -5
- data/lib/square/api/labor_api.rb +64 -62
- data/lib/square/api/loyalty_api.rb +15 -5
- data/lib/square/api/o_auth_api.rb +19 -12
- data/lib/square/api/orders_api.rb +37 -0
- data/lib/square/api_helper.rb +19 -29
- data/lib/square/client.rb +2 -8
- data/lib/square/configuration.rb +6 -13
- data/lib/square/http/faraday_client.rb +1 -1
- data/lib/square/utilities/date_time_helper.rb +151 -0
- data/lib/square/utilities/file_wrapper.rb +1 -2
- data/lib/square.rb +48 -48
- metadata +12 -9
- data/lib/square/api/v1_employees_api.rb +0 -362
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb09b4404e4f7f5cb0923e135ada308b9a9c3482106b0ab8cc2e80eee63f8de0
|
4
|
+
data.tar.gz: fc7d73e6a5d955857fe4bfb4341a75cdd80764f3cced0e19afbbb37cdca4d9bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcf0ff7ca1313121f98083f32cdf8201c30be1814a7f7f6aac89c09e752e129a92ba1f5117f9049559d835846a3e49abfc1d83c906a59c362b8fd05e2c31fbf6
|
7
|
+
data.tar.gz: 2870c75eef04c8798e3699c17a4e88296bfe144400b81c7bf4463c0d3bcface04ef151cae4a0b0349266890d16485a4257d5aa4756d4985684dceb789021b0eb
|
data/README.md
CHANGED
@@ -8,6 +8,10 @@
|
|
8
8
|
|
9
9
|
Use this gem to integrate Square payments into your app and grow your business with Square APIs including Catalog, Customers, Employees, Inventory, Labor, Locations, and Orders.
|
10
10
|
|
11
|
+
## Requirements
|
12
|
+
|
13
|
+
We support Ruby 2.5.x, 2.6.x, and 2.7.x.
|
14
|
+
|
11
15
|
## Installation
|
12
16
|
|
13
17
|
Install the gem from the command line:
|
@@ -33,6 +37,9 @@ gem 'square.rb'
|
|
33
37
|
* [Disputes]
|
34
38
|
* [Checkout]
|
35
39
|
* [Apple Pay]
|
40
|
+
* [Cards]
|
41
|
+
|
42
|
+
### Terminal
|
36
43
|
* [Terminal]
|
37
44
|
|
38
45
|
### Orders
|
@@ -56,6 +63,10 @@ gem 'square.rb'
|
|
56
63
|
### Loyalty
|
57
64
|
* [Loyalty]
|
58
65
|
|
66
|
+
### Gift Cards
|
67
|
+
* [Gift Cards]
|
68
|
+
* [Gift Card Activities]
|
69
|
+
|
59
70
|
### Bookings
|
60
71
|
* [Bookings]
|
61
72
|
|
@@ -63,12 +74,11 @@ gem 'square.rb'
|
|
63
74
|
* [Merchants]
|
64
75
|
* [Locations]
|
65
76
|
* [Devices]
|
77
|
+
* [Cash Drawers]
|
66
78
|
|
67
79
|
### Team
|
68
80
|
* [Team]
|
69
|
-
* [Employees]
|
70
81
|
* [Labor]
|
71
|
-
* [Cash Drawers]
|
72
82
|
|
73
83
|
### Financials
|
74
84
|
* [Bank Accounts]
|
@@ -82,6 +92,7 @@ gem 'square.rb'
|
|
82
92
|
* [OAuth]
|
83
93
|
|
84
94
|
### Deprecated APIs
|
95
|
+
* [Employees]
|
85
96
|
* [V1 Employees]
|
86
97
|
* [V1 Transactions]
|
87
98
|
* [V1 Items]
|
@@ -333,3 +344,6 @@ You can also use the Square API to create applications or services that work wit
|
|
333
344
|
[Transactions]: doc/api/transactions.md
|
334
345
|
[Sites]: doc/api/sites.md
|
335
346
|
[Snippets]: doc/api/snippets.md
|
347
|
+
[Cards]: doc/api/cards.md
|
348
|
+
[Gift Cards]: doc/api/gift-cards.md
|
349
|
+
[Gift Card Activities]: doc/api/gift-card-activities.md
|
data/lib/square/api/base_api.rb
CHANGED
@@ -8,21 +8,19 @@ module Square
|
|
8
8
|
@http_call_back = http_call_back
|
9
9
|
|
10
10
|
@global_headers = {
|
11
|
-
'user-agent' => 'Square-Ruby-SDK/
|
11
|
+
'user-agent' => 'Square-Ruby-SDK/14.1.0.20210915',
|
12
12
|
'Square-Version' => config.square_version
|
13
13
|
}
|
14
14
|
end
|
15
15
|
|
16
16
|
def validate_parameters(args)
|
17
17
|
args.each do |_name, value|
|
18
|
-
if value.nil?
|
19
|
-
raise ArgumentError, "Required parameter #{_name} cannot be nil."
|
20
|
-
end
|
18
|
+
raise ArgumentError, "Required parameter #{_name} cannot be nil." if value.nil?
|
21
19
|
end
|
22
20
|
end
|
23
21
|
|
24
22
|
def execute_request(request, binary: false)
|
25
|
-
@http_call_back
|
23
|
+
@http_call_back&.on_before_request(request)
|
26
24
|
|
27
25
|
APIHelper.clean_hash(request.headers)
|
28
26
|
request.headers.merge!(@global_headers)
|
@@ -35,7 +33,7 @@ module Square
|
|
35
33
|
else
|
36
34
|
config.http_client.execute_as_string(request)
|
37
35
|
end
|
38
|
-
@http_call_back
|
36
|
+
@http_call_back&.on_after_response(response)
|
39
37
|
|
40
38
|
response
|
41
39
|
end
|
@@ -435,7 +435,7 @@ module Square
|
|
435
435
|
# Searches for [CatalogObject]($m/CatalogObject) of any type by matching
|
436
436
|
# supported search attribute values,
|
437
437
|
# excluding custom attribute values on items or item variations, against one
|
438
|
-
# or more of the specified query
|
438
|
+
# or more of the specified query filters.
|
439
439
|
# This (`SearchCatalogObjects`) endpoint differs from the
|
440
440
|
# [SearchCatalogItems]($e/Catalog/SearchCatalogItems)
|
441
441
|
# endpoint in the following aspects:
|
@@ -485,7 +485,7 @@ module Square
|
|
485
485
|
# Searches for catalog items or item variations by matching supported search
|
486
486
|
# attribute values, including
|
487
487
|
# custom attribute values, against one or more of the specified query
|
488
|
-
#
|
488
|
+
# filters.
|
489
489
|
# This (`SearchCatalogItems`) endpoint differs from the
|
490
490
|
# [SearchCatalogObjects]($e/Catalog/SearchCatalogObjects)
|
491
491
|
# endpoint in the following aspects:
|
@@ -11,14 +11,22 @@ module Square
|
|
11
11
|
# set of results for your original query. For more information, see
|
12
12
|
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
13
13
|
# ion).
|
14
|
+
# @param [Integer] limit Optional parameter: The maximum number of results
|
15
|
+
# to return in a single page. This limit is advisory. The response might
|
16
|
+
# contain more or fewer results. The limit is ignored if it is less than 1
|
17
|
+
# or greater than 50. The default value is 50. For more information, see
|
18
|
+
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
19
|
+
# ion).
|
14
20
|
# @return [ListCustomerGroupsResponse Hash] response from the API call
|
15
|
-
def list_customer_groups(cursor: nil
|
21
|
+
def list_customer_groups(cursor: nil,
|
22
|
+
limit: nil)
|
16
23
|
# Prepare query url.
|
17
24
|
_query_builder = config.get_base_uri
|
18
25
|
_query_builder << '/v2/customers/groups'
|
19
26
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
20
27
|
_query_builder,
|
21
|
-
'cursor' => cursor
|
28
|
+
'cursor' => cursor,
|
29
|
+
'limit' => limit
|
22
30
|
)
|
23
31
|
_query_url = APIHelper.clean_url _query_builder
|
24
32
|
|
@@ -11,14 +11,22 @@ module Square
|
|
11
11
|
# the next set of query results. For more information, see
|
12
12
|
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
13
13
|
# ion).
|
14
|
+
# @param [Integer] limit Optional parameter: The maximum number of results
|
15
|
+
# to return in a single page. This limit is advisory. The response might
|
16
|
+
# contain more or fewer results. The limit is ignored if it is less than 1
|
17
|
+
# or greater than 50. The default value is 50. For more information, see
|
18
|
+
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
19
|
+
# ion).
|
14
20
|
# @return [ListCustomerSegmentsResponse Hash] response from the API call
|
15
|
-
def list_customer_segments(cursor: nil
|
21
|
+
def list_customer_segments(cursor: nil,
|
22
|
+
limit: nil)
|
16
23
|
# Prepare query url.
|
17
24
|
_query_builder = config.get_base_uri
|
18
25
|
_query_builder << '/v2/customers/segments'
|
19
26
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
20
27
|
_query_builder,
|
21
|
-
'cursor' => cursor
|
28
|
+
'cursor' => cursor,
|
29
|
+
'limit' => limit
|
22
30
|
)
|
23
31
|
_query_url = APIHelper.clean_url _query_builder
|
24
32
|
|
@@ -17,13 +17,20 @@ module Square
|
|
17
17
|
# set of results for your original query. For more information, see
|
18
18
|
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
19
19
|
# ion).
|
20
|
+
# @param [Integer] limit Optional parameter: The maximum number of results
|
21
|
+
# to return in a single page. This limit is advisory. The response might
|
22
|
+
# contain more or fewer results. The limit is ignored if it is less than 1
|
23
|
+
# or greater than 100. The default value is 100. For more information, see
|
24
|
+
# [Pagination](https://developer.squareup.com/docs/working-with-apis/paginat
|
25
|
+
# ion).
|
20
26
|
# @param [CustomerSortField] sort_field Optional parameter: Indicates how
|
21
|
-
# customers should be sorted.
|
27
|
+
# customers should be sorted. The default value is `DEFAULT`.
|
22
28
|
# @param [SortOrder] sort_order Optional parameter: Indicates whether
|
23
29
|
# customers should be sorted in ascending (`ASC`) or descending (`DESC`)
|
24
|
-
# order.
|
30
|
+
# order. The default value is `ASC`.
|
25
31
|
# @return [ListCustomersResponse Hash] response from the API call
|
26
32
|
def list_customers(cursor: nil,
|
33
|
+
limit: nil,
|
27
34
|
sort_field: nil,
|
28
35
|
sort_order: nil)
|
29
36
|
# Prepare query url.
|
@@ -32,6 +39,7 @@ module Square
|
|
32
39
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
33
40
|
_query_builder,
|
34
41
|
'cursor' => cursor,
|
42
|
+
'limit' => limit,
|
35
43
|
'sort_field' => sort_field,
|
36
44
|
'sort_order' => sort_order
|
37
45
|
)
|
@@ -156,7 +164,7 @@ module Square
|
|
156
164
|
# @param [String] customer_id Required parameter: The ID of the customer to
|
157
165
|
# delete.
|
158
166
|
# @param [Long] version Optional parameter: The current version of the
|
159
|
-
# customer profile.
|
167
|
+
# customer profile. As a best practice, you should include this parameter
|
160
168
|
# to enable [optimistic
|
161
169
|
# concurrency](https://developer.squareup.com/docs/working-with-apis/optimis
|
162
170
|
# tic-concurrency) control. For more information, see [Delete a customer
|
@@ -65,8 +65,9 @@ module Square
|
|
65
65
|
)
|
66
66
|
end
|
67
67
|
|
68
|
-
# Creates a digital gift card
|
69
|
-
#
|
68
|
+
# Creates a digital gift card or registers a physical (plastic) gift card.
|
69
|
+
# You must activate the gift card before
|
70
|
+
# it can be used for payment. For more information, see
|
70
71
|
# [Selling gift
|
71
72
|
# cards](https://developer.squareup.com/docs/gift-cards/using-gift-cards-api
|
72
73
|
# #selling-square-gift-cards).
|
@@ -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/
|
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-
|
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
|
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
|
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-
|
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'
|