Class: SquareConnect::InventoryApi
- Inherits:
-
Object
- Object
- SquareConnect::InventoryApi
- Defined in:
- lib/square_connect/api/inventory_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#batch_change_inventory(body, opts = {}) ⇒ BatchChangeInventoryResponse
BatchChangeInventory Applies adjustments and counts to the provided item quantities.
-
#batch_change_inventory_with_http_info(body, opts = {}) ⇒ Array<(BatchChangeInventoryResponse, Fixnum, Hash)>
BatchChangeInventory Applies adjustments and counts to the provided item quantities.
-
#batch_retrieve_inventory_changes(body, opts = {}) ⇒ BatchRetrieveInventoryChangesResponse
BatchRetrieveInventoryChanges Returns historical physical counts and adjustments based on the provided filter criteria.
-
#batch_retrieve_inventory_changes_with_http_info(body, opts = {}) ⇒ Array<(BatchRetrieveInventoryChangesResponse, Fixnum, Hash)>
BatchRetrieveInventoryChanges Returns historical physical counts and adjustments based on the provided filter criteria.
-
#batch_retrieve_inventory_counts(body, opts = {}) ⇒ BatchRetrieveInventoryCountsResponse
BatchRetrieveInventoryCounts Returns current counts for the provided [CatalogObject](#type-catalogobject)s at the requested [Location](#type-location)s.
-
#batch_retrieve_inventory_counts_with_http_info(body, opts = {}) ⇒ Array<(BatchRetrieveInventoryCountsResponse, Fixnum, Hash)>
BatchRetrieveInventoryCounts Returns current counts for the provided [CatalogObject](#type-catalogobject)s at the requested [Location](#type-location)s.
-
#initialize(api_client = ApiClient.default) ⇒ InventoryApi
constructor
A new instance of InventoryApi.
-
#retrieve_inventory_adjustment(adjustment_id, opts = {}) ⇒ RetrieveInventoryAdjustmentResponse
RetrieveInventoryAdjustment Returns the [InventoryAdjustment](#type-inventoryadjustment) object with the provided ‘adjustment_id`.
-
#retrieve_inventory_adjustment_with_http_info(adjustment_id, opts = {}) ⇒ Array<(RetrieveInventoryAdjustmentResponse, Fixnum, Hash)>
RetrieveInventoryAdjustment Returns the [InventoryAdjustment](#type-inventoryadjustment) object with the provided `adjustment_id`.
-
#retrieve_inventory_changes(catalog_object_id, opts = {}) ⇒ RetrieveInventoryChangesResponse
RetrieveInventoryChanges Returns a set of physical counts and inventory adjustments for the provided [CatalogObject](#type-catalogobject) at the requested [Location](#type-location)s.
-
#retrieve_inventory_changes_with_http_info(catalog_object_id, opts = {}) ⇒ Array<(RetrieveInventoryChangesResponse, Fixnum, Hash)>
RetrieveInventoryChanges Returns a set of physical counts and inventory adjustments for the provided [CatalogObject](#type-catalogobject) at the requested [Location](#type-location)s.
-
#retrieve_inventory_count(catalog_object_id, opts = {}) ⇒ RetrieveInventoryCountResponse
RetrieveInventoryCount Retrieves the current calculated stock count for a given [CatalogObject](#type-catalogobject) at a given set of [Location](#type-location)s.
-
#retrieve_inventory_count_with_http_info(catalog_object_id, opts = {}) ⇒ Array<(RetrieveInventoryCountResponse, Fixnum, Hash)>
RetrieveInventoryCount Retrieves the current calculated stock count for a given [CatalogObject](#type-catalogobject) at a given set of [Location](#type-location)s.
-
#retrieve_inventory_physical_count(physical_count_id, opts = {}) ⇒ RetrieveInventoryPhysicalCountResponse
RetrieveInventoryPhysicalCount Returns the [InventoryPhysicalCount](#type-inventoryphysicalcount) object with the provided ‘physical_count_id`.
-
#retrieve_inventory_physical_count_with_http_info(physical_count_id, opts = {}) ⇒ Array<(RetrieveInventoryPhysicalCountResponse, Fixnum, Hash)>
RetrieveInventoryPhysicalCount Returns the [InventoryPhysicalCount](#type-inventoryphysicalcount) object with the provided `physical_count_id`.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ InventoryApi
Returns a new instance of InventoryApi.
16 17 18 |
# File 'lib/square_connect/api/inventory_api.rb', line 16 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
14 15 16 |
# File 'lib/square_connect/api/inventory_api.rb', line 14 def api_client @api_client end |
Instance Method Details
#batch_change_inventory(body, opts = {}) ⇒ BatchChangeInventoryResponse
BatchChangeInventory Applies adjustments and counts to the provided item quantities. On success: returns the current calculated counts for all objects referenced in the request. On failure: returns a list of related errors.
25 26 27 28 |
# File 'lib/square_connect/api/inventory_api.rb', line 25 def batch_change_inventory(body, opts = {}) data, _status_code, _headers = batch_change_inventory_with_http_info(body, opts) return data end |
#batch_change_inventory_with_http_info(body, opts = {}) ⇒ Array<(BatchChangeInventoryResponse, Fixnum, Hash)>
BatchChangeInventory Applies adjustments and counts to the provided item quantities. On success: returns the current calculated counts for all objects referenced in the request. On failure: returns a list of related errors.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/square_connect/api/inventory_api.rb', line 35 def batch_change_inventory_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: InventoryApi.batch_change_inventory ..." end # verify the required parameter 'body' is set fail ArgumentError, "Missing the required parameter 'body' when calling InventoryApi.batch_change_inventory" if body.nil? # resource path local_var_path = "/v2/inventory/batch-change".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-06-12" # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['oauth2'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'BatchChangeInventoryResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: InventoryApi#batch_change_inventory\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#batch_retrieve_inventory_changes(body, opts = {}) ⇒ BatchRetrieveInventoryChangesResponse
BatchRetrieveInventoryChanges Returns historical physical counts and adjustments based on the provided filter criteria. Results are paginated and sorted in ascending order according their ‘occurred_at` timestamp (oldest first). BatchRetrieveInventoryChanges is a catch-all query endpoint for queries that cannot be handled by other, simpler endpoints.
80 81 82 83 |
# File 'lib/square_connect/api/inventory_api.rb', line 80 def batch_retrieve_inventory_changes(body, opts = {}) data, _status_code, _headers = batch_retrieve_inventory_changes_with_http_info(body, opts) return data end |
#batch_retrieve_inventory_changes_with_http_info(body, opts = {}) ⇒ Array<(BatchRetrieveInventoryChangesResponse, Fixnum, Hash)>
BatchRetrieveInventoryChanges Returns historical physical counts and adjustments based on the provided filter criteria. Results are paginated and sorted in ascending order according their `occurred_at` timestamp (oldest first). BatchRetrieveInventoryChanges is a catch-all query endpoint for queries that cannot be handled by other, simpler endpoints.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/square_connect/api/inventory_api.rb', line 90 def batch_retrieve_inventory_changes_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: InventoryApi.batch_retrieve_inventory_changes ..." end # verify the required parameter 'body' is set fail ArgumentError, "Missing the required parameter 'body' when calling InventoryApi.batch_retrieve_inventory_changes" if body.nil? # resource path local_var_path = "/v2/inventory/batch-retrieve-changes".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-06-12" # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['oauth2'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'BatchRetrieveInventoryChangesResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: InventoryApi#batch_retrieve_inventory_changes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#batch_retrieve_inventory_counts(body, opts = {}) ⇒ BatchRetrieveInventoryCountsResponse
BatchRetrieveInventoryCounts Returns current counts for the provided [CatalogObject](#type-catalogobject)s at the requested [Location](#type-location)s. Results are paginated and sorted in descending order according to their ‘calculated_at` timestamp (newest first). When `updated_after` is specified, only counts that have changed since that time (based on the server timestamp for the most recent change) are returned. This allows clients to perform a "sync" operation, for example in response to receiving a Webhook notification.
135 136 137 138 |
# File 'lib/square_connect/api/inventory_api.rb', line 135 def batch_retrieve_inventory_counts(body, opts = {}) data, _status_code, _headers = batch_retrieve_inventory_counts_with_http_info(body, opts) return data end |
#batch_retrieve_inventory_counts_with_http_info(body, opts = {}) ⇒ Array<(BatchRetrieveInventoryCountsResponse, Fixnum, Hash)>
BatchRetrieveInventoryCounts Returns current counts for the provided [CatalogObject](#type-catalogobject)s at the requested [Location](#type-location)s. Results are paginated and sorted in descending order according to their `calculated_at` timestamp (newest first). When `updated_after` is specified, only counts that have changed since that time (based on the server timestamp for the most recent change) are returned. This allows clients to perform a "sync" operation, for example in response to receiving a Webhook notification.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/square_connect/api/inventory_api.rb', line 145 def batch_retrieve_inventory_counts_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: InventoryApi.batch_retrieve_inventory_counts ..." end # verify the required parameter 'body' is set fail ArgumentError, "Missing the required parameter 'body' when calling InventoryApi.batch_retrieve_inventory_counts" if body.nil? # resource path local_var_path = "/v2/inventory/batch-retrieve-counts".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-06-12" # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['oauth2'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'BatchRetrieveInventoryCountsResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: InventoryApi#batch_retrieve_inventory_counts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#retrieve_inventory_adjustment(adjustment_id, opts = {}) ⇒ RetrieveInventoryAdjustmentResponse
RetrieveInventoryAdjustment Returns the [InventoryAdjustment](#type-inventoryadjustment) object with the provided ‘adjustment_id`.
190 191 192 193 |
# File 'lib/square_connect/api/inventory_api.rb', line 190 def retrieve_inventory_adjustment(adjustment_id, opts = {}) data, _status_code, _headers = retrieve_inventory_adjustment_with_http_info(adjustment_id, opts) return data end |
#retrieve_inventory_adjustment_with_http_info(adjustment_id, opts = {}) ⇒ Array<(RetrieveInventoryAdjustmentResponse, Fixnum, Hash)>
RetrieveInventoryAdjustment Returns the [InventoryAdjustment](#type-inventoryadjustment) object with the provided `adjustment_id`.
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/square_connect/api/inventory_api.rb', line 200 def retrieve_inventory_adjustment_with_http_info(adjustment_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: InventoryApi.retrieve_inventory_adjustment ..." end # verify the required parameter 'adjustment_id' is set fail ArgumentError, "Missing the required parameter 'adjustment_id' when calling InventoryApi.retrieve_inventory_adjustment" if adjustment_id.nil? # resource path local_var_path = "/v2/inventory/adjustment/{adjustment_id}".sub('{format}','json').sub('{' + 'adjustment_id' + '}', adjustment_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-06-12" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'RetrieveInventoryAdjustmentResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: InventoryApi#retrieve_inventory_adjustment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#retrieve_inventory_changes(catalog_object_id, opts = {}) ⇒ RetrieveInventoryChangesResponse
RetrieveInventoryChanges Returns a set of physical counts and inventory adjustments for the provided [CatalogObject](#type-catalogobject) at the requested [Location](#type-location)s. Results are paginated and sorted in descending order according to their ‘occurred_at` timestamp (newest first). There are no limits on how far back the caller can page. This endpoint is useful when displaying recent changes for a specific item. For more sophisticated queries, use a batch endpoint.
247 248 249 250 |
# File 'lib/square_connect/api/inventory_api.rb', line 247 def retrieve_inventory_changes(catalog_object_id, opts = {}) data, _status_code, _headers = retrieve_inventory_changes_with_http_info(catalog_object_id, opts) return data end |
#retrieve_inventory_changes_with_http_info(catalog_object_id, opts = {}) ⇒ Array<(RetrieveInventoryChangesResponse, Fixnum, Hash)>
RetrieveInventoryChanges Returns a set of physical counts and inventory adjustments for the provided [CatalogObject](#type-catalogobject) at the requested [Location](#type-location)s. Results are paginated and sorted in descending order according to their `occurred_at` timestamp (newest first). There are no limits on how far back the caller can page. This endpoint is useful when displaying recent changes for a specific item. For more sophisticated queries, use a batch endpoint.
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
# File 'lib/square_connect/api/inventory_api.rb', line 259 def retrieve_inventory_changes_with_http_info(catalog_object_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: InventoryApi.retrieve_inventory_changes ..." end # verify the required parameter 'catalog_object_id' is set fail ArgumentError, "Missing the required parameter 'catalog_object_id' when calling InventoryApi.retrieve_inventory_changes" if catalog_object_id.nil? # resource path local_var_path = "/v2/inventory/{catalog_object_id}/changes".sub('{format}','json').sub('{' + 'catalog_object_id' + '}', catalog_object_id.to_s) # query parameters query_params = {} query_params[:'location_ids'] = opts[:'location_ids'] if !opts[:'location_ids'].nil? query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-06-12" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'RetrieveInventoryChangesResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: InventoryApi#retrieve_inventory_changes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#retrieve_inventory_count(catalog_object_id, opts = {}) ⇒ RetrieveInventoryCountResponse
RetrieveInventoryCount Retrieves the current calculated stock count for a given [CatalogObject](#type-catalogobject) at a given set of [Location](#type-location)s. Responses are paginated and unsorted. For more sophisticated queries, use a batch endpoint.
308 309 310 311 |
# File 'lib/square_connect/api/inventory_api.rb', line 308 def retrieve_inventory_count(catalog_object_id, opts = {}) data, _status_code, _headers = retrieve_inventory_count_with_http_info(catalog_object_id, opts) return data end |
#retrieve_inventory_count_with_http_info(catalog_object_id, opts = {}) ⇒ Array<(RetrieveInventoryCountResponse, Fixnum, Hash)>
RetrieveInventoryCount Retrieves the current calculated stock count for a given [CatalogObject](#type-catalogobject) at a given set of [Location](#type-location)s. Responses are paginated and unsorted. For more sophisticated queries, use a batch endpoint.
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
# File 'lib/square_connect/api/inventory_api.rb', line 320 def retrieve_inventory_count_with_http_info(catalog_object_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: InventoryApi.retrieve_inventory_count ..." end # verify the required parameter 'catalog_object_id' is set fail ArgumentError, "Missing the required parameter 'catalog_object_id' when calling InventoryApi.retrieve_inventory_count" if catalog_object_id.nil? # resource path local_var_path = "/v2/inventory/{catalog_object_id}".sub('{format}','json').sub('{' + 'catalog_object_id' + '}', catalog_object_id.to_s) # query parameters query_params = {} query_params[:'location_ids'] = opts[:'location_ids'] if !opts[:'location_ids'].nil? query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-06-12" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'RetrieveInventoryCountResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: InventoryApi#retrieve_inventory_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#retrieve_inventory_physical_count(physical_count_id, opts = {}) ⇒ RetrieveInventoryPhysicalCountResponse
RetrieveInventoryPhysicalCount Returns the [InventoryPhysicalCount](#type-inventoryphysicalcount) object with the provided ‘physical_count_id`.
367 368 369 370 |
# File 'lib/square_connect/api/inventory_api.rb', line 367 def retrieve_inventory_physical_count(physical_count_id, opts = {}) data, _status_code, _headers = retrieve_inventory_physical_count_with_http_info(physical_count_id, opts) return data end |
#retrieve_inventory_physical_count_with_http_info(physical_count_id, opts = {}) ⇒ Array<(RetrieveInventoryPhysicalCountResponse, Fixnum, Hash)>
RetrieveInventoryPhysicalCount Returns the [InventoryPhysicalCount](#type-inventoryphysicalcount) object with the provided `physical_count_id`.
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
# File 'lib/square_connect/api/inventory_api.rb', line 377 def retrieve_inventory_physical_count_with_http_info(physical_count_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: InventoryApi.retrieve_inventory_physical_count ..." end # verify the required parameter 'physical_count_id' is set fail ArgumentError, "Missing the required parameter 'physical_count_id' when calling InventoryApi.retrieve_inventory_physical_count" if physical_count_id.nil? # resource path local_var_path = "/v2/inventory/physical-count/{physical_count_id}".sub('{format}','json').sub('{' + 'physical_count_id' + '}', physical_count_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-06-12" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'RetrieveInventoryPhysicalCountResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: InventoryApi#retrieve_inventory_physical_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |