Class: SquareConnect::CatalogApi

Inherits:
Object
  • Object
show all
Defined in:
lib/square_connect/api/catalog_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CatalogApi

Returns a new instance of CatalogApi.



16
17
18
# File 'lib/square_connect/api/catalog_api.rb', line 16

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



14
15
16
# File 'lib/square_connect/api/catalog_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#batch_delete_catalog_objects(body, opts = {}) ⇒ BatchDeleteCatalogObjectsResponse

BatchDeleteCatalogObjects Deletes a set of [CatalogItem](#type-catalogitem)s based on the provided list of target IDs and returns a set of successfully deleted IDs in the response. Deletion is a cascading event such that all children of the targeted object are also deleted. For example, deleting a CatalogItem will also delete all of its [CatalogItemVariation](#type-catalogitemvariation) children. ‘BatchDeleteCatalogObjects` succeeds even if only a portion of the targeted IDs can be deleted. The response will only include IDs that were actually deleted.

Parameters:

  • body

    An object containing the fields to POST for the request. See the corresponding object definition for field details.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



25
26
27
28
# File 'lib/square_connect/api/catalog_api.rb', line 25

def batch_delete_catalog_objects(body, opts = {})
  data, _status_code, _headers = batch_delete_catalog_objects_with_http_info(body, opts)
  return data
end

#batch_delete_catalog_objects_with_http_info(body, opts = {}) ⇒ Array<(BatchDeleteCatalogObjectsResponse, Fixnum, Hash)>

BatchDeleteCatalogObjects Deletes a set of [CatalogItem](#type-catalogitem)s based on the provided list of target IDs and returns a set of successfully deleted IDs in the response. Deletion is a cascading event such that all children of the targeted object are also deleted. For example, deleting a CatalogItem will also delete all of its [CatalogItemVariation](#type-catalogitemvariation) children. &#x60;BatchDeleteCatalogObjects&#x60; succeeds even if only a portion of the targeted IDs can be deleted. The response will only include IDs that were actually deleted.

Parameters:

  • body

    An object containing the fields to POST for the request. See the corresponding object definition for field details.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



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
# File 'lib/square_connect/api/catalog_api.rb', line 35

def batch_delete_catalog_objects_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CatalogApi.batch_delete_catalog_objects ..."
  end
  # verify the required parameter 'body' is set
  fail ArgumentError, "Missing the required parameter 'body' when calling CatalogApi.batch_delete_catalog_objects" if body.nil?
  # resource path
  local_var_path = "/v2/catalog/batch-delete".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'])

  # 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 => 'BatchDeleteCatalogObjectsResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CatalogApi#batch_delete_catalog_objects\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#batch_retrieve_catalog_objects(body, opts = {}) ⇒ BatchRetrieveCatalogObjectsResponse

BatchRetrieveCatalogObjects Returns a set of objects based on the provided ID. Each [CatalogItem](#type-catalogitem) returned in the set includes all of its child information including: all of its [CatalogItemVariation](#type-catalogitemvariation) objects, references to its [CatalogModifierList](#type-catalogmodifierlist) objects, and the ids of any [CatalogTax](#type-catalogtax) objects that apply to it.

Parameters:

  • body

    An object containing the fields to POST for the request. See the corresponding object definition for field details.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



78
79
80
81
# File 'lib/square_connect/api/catalog_api.rb', line 78

def batch_retrieve_catalog_objects(body, opts = {})
  data, _status_code, _headers = batch_retrieve_catalog_objects_with_http_info(body, opts)
  return data
end

#batch_retrieve_catalog_objects_with_http_info(body, opts = {}) ⇒ Array<(BatchRetrieveCatalogObjectsResponse, Fixnum, Hash)>

BatchRetrieveCatalogObjects Returns a set of objects based on the provided ID. Each [CatalogItem](#type-catalogitem) returned in the set includes all of its child information including: all of its [CatalogItemVariation](#type-catalogitemvariation) objects, references to its [CatalogModifierList](#type-catalogmodifierlist) objects, and the ids of any [CatalogTax](#type-catalogtax) objects that apply to it.

Parameters:

  • body

    An object containing the fields to POST for the request. See the corresponding object definition for field details.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



88
89
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
# File 'lib/square_connect/api/catalog_api.rb', line 88

def batch_retrieve_catalog_objects_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CatalogApi.batch_retrieve_catalog_objects ..."
  end
  # verify the required parameter 'body' is set
  fail ArgumentError, "Missing the required parameter 'body' when calling CatalogApi.batch_retrieve_catalog_objects" if body.nil?
  # resource path
  local_var_path = "/v2/catalog/batch-retrieve".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'])

  # 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 => 'BatchRetrieveCatalogObjectsResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CatalogApi#batch_retrieve_catalog_objects\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#batch_upsert_catalog_objects(body, opts = {}) ⇒ BatchUpsertCatalogObjectsResponse

BatchUpsertCatalogObjects Creates or updates up to 10,000 target objects based on the provided list of objects. The target objects are grouped into batches and each batch is inserted/updated in an all-or-nothing manner. If an object within a batch is malformed in some way, or violates a database constraint, the entire batch containing that item will be disregarded. However, other batches in the same request may still succeed. Each batch may contain up to 1,000 objects, and batches will be processed in order as long as the total object count for the request (items, variations, modifier lists, discounts, and taxes) is no more than 10,000.

Parameters:

  • body

    An object containing the fields to POST for the request. See the corresponding object definition for field details.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



131
132
133
134
# File 'lib/square_connect/api/catalog_api.rb', line 131

def batch_upsert_catalog_objects(body, opts = {})
  data, _status_code, _headers = batch_upsert_catalog_objects_with_http_info(body, opts)
  return data
end

#batch_upsert_catalog_objects_with_http_info(body, opts = {}) ⇒ Array<(BatchUpsertCatalogObjectsResponse, Fixnum, Hash)>

BatchUpsertCatalogObjects Creates or updates up to 10,000 target objects based on the provided list of objects. The target objects are grouped into batches and each batch is inserted/updated in an all-or-nothing manner. If an object within a batch is malformed in some way, or violates a database constraint, the entire batch containing that item will be disregarded. However, other batches in the same request may still succeed. Each batch may contain up to 1,000 objects, and batches will be processed in order as long as the total object count for the request (items, variations, modifier lists, discounts, and taxes) is no more than 10,000.

Parameters:

  • body

    An object containing the fields to POST for the request. See the corresponding object definition for field details.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



141
142
143
144
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
# File 'lib/square_connect/api/catalog_api.rb', line 141

def batch_upsert_catalog_objects_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CatalogApi.batch_upsert_catalog_objects ..."
  end
  # verify the required parameter 'body' is set
  fail ArgumentError, "Missing the required parameter 'body' when calling CatalogApi.batch_upsert_catalog_objects" if body.nil?
  # resource path
  local_var_path = "/v2/catalog/batch-upsert".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'])

  # 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 => 'BatchUpsertCatalogObjectsResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CatalogApi#batch_upsert_catalog_objects\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#catalog_info(opts = {}) ⇒ CatalogInfoResponse

CatalogInfo Returns information about the Square Catalog API, such as batch size limits for ‘BatchUpsertCatalogObjects`.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



183
184
185
186
# File 'lib/square_connect/api/catalog_api.rb', line 183

def catalog_info(opts = {})
  data, _status_code, _headers = catalog_info_with_http_info(opts)
  return data
end

#catalog_info_with_http_info(opts = {}) ⇒ Array<(CatalogInfoResponse, Fixnum, Hash)>

CatalogInfo Returns information about the Square Catalog API, such as batch size limits for &#x60;BatchUpsertCatalogObjects&#x60;.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(CatalogInfoResponse, Fixnum, Hash)>)

    CatalogInfoResponse data, response status code and response headers



192
193
194
195
196
197
198
199
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
# File 'lib/square_connect/api/catalog_api.rb', line 192

def catalog_info_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CatalogApi.catalog_info ..."
  end
  # resource path
  local_var_path = "/v2/catalog/info".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'])

  # 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 => 'CatalogInfoResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CatalogApi#catalog_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_catalog_object(object_id, opts = {}) ⇒ DeleteCatalogObjectResponse

DeleteCatalogObject Deletes a single [CatalogObject](#type-catalogobject) based on the provided ID and returns the set of successfully deleted IDs in the response. Deletion is a cascading event such that all children of the targeted object are also deleted. For example, deleting a [CatalogItem](#type-catalogitem) will also delete all of its [CatalogItemVariation](#type-catalogitemvariation) children.

Parameters:

  • object_id

    The ID of the [CatalogObject](#type-catalogobject) to be deleted. When an object is deleted, other objects in the graph that depend on that object will be deleted as well (for example, deleting a [CatalogItem](#type-catalogitem) will delete its [CatalogItemVariation](#type-catalogitemvariation)s).

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



233
234
235
236
# File 'lib/square_connect/api/catalog_api.rb', line 233

def delete_catalog_object(object_id, opts = {})
  data, _status_code, _headers = delete_catalog_object_with_http_info(object_id, opts)
  return data
end

#delete_catalog_object_with_http_info(object_id, opts = {}) ⇒ Array<(DeleteCatalogObjectResponse, Fixnum, Hash)>

DeleteCatalogObject Deletes a single [CatalogObject](#type-catalogobject) based on the provided ID and returns the set of successfully deleted IDs in the response. Deletion is a cascading event such that all children of the targeted object are also deleted. For example, deleting a [CatalogItem](#type-catalogitem) will also delete all of its [CatalogItemVariation](#type-catalogitemvariation) children.

Parameters:

  • object_id

    The ID of the [CatalogObject](#type-catalogobject) to be deleted. When an object is deleted, other objects in the graph that depend on that object will be deleted as well (for example, deleting a [CatalogItem](#type-catalogitem) will delete its [CatalogItemVariation](#type-catalogitemvariation)s).

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/square_connect/api/catalog_api.rb', line 243

def delete_catalog_object_with_http_info(object_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CatalogApi.delete_catalog_object ..."
  end
  # verify the required parameter 'object_id' is set
  fail ArgumentError, "Missing the required parameter 'object_id' when calling CatalogApi.delete_catalog_object" if object_id.nil?
  # resource path
  local_var_path = "/v2/catalog/object/{object_id}".sub('{format}','json').sub('{' + 'object_id' + '}', object_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'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth2']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'DeleteCatalogObjectResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CatalogApi#delete_catalog_object\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_catalog(opts = {}) ⇒ ListCatalogResponse

ListCatalog Returns a list of [CatalogObject](#type-catalogobject)s that includes all objects of a set of desired types (for example, all [CatalogItem](#type-catalogitem) and [CatalogTax](#type-catalogtax) objects) in the catalog. The types parameter is specified as a comma-separated list of valid [CatalogObject](#type-catalogobject) types: ‘ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`, `DISCOUNT`, `TAX`.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :cursor (String)

    The pagination cursor returned in the previous response. Leave unset for an initial request. See [Paginating results](#paginatingresults) for more information.

  • :types (String)

    An optional case-insensitive, comma-separated list of object types to retrieve, for example &#x60;ITEM,ITEM_VARIATION,CATEGORY&#x60;. The legal values are taken from the [CatalogObjectType](#type-catalogobjecttype) enumeration, namely &#x60;&quot;ITEM&quot;&#x60;, &#x60;&quot;ITEM_VARIATION&quot;&#x60;, &#x60;&quot;CATEGORY&quot;&#x60;, &#x60;&quot;DISCOUNT&quot;&#x60;, &#x60;&quot;TAX&quot;&#x60;, &#x60;&quot;MODIFIER&quot;&#x60;, or &#x60;&quot;MODIFIER_LIST&quot;&#x60;.

Returns:



287
288
289
290
# File 'lib/square_connect/api/catalog_api.rb', line 287

def list_catalog(opts = {})
  data, _status_code, _headers = list_catalog_with_http_info(opts)
  return data
end

#list_catalog_with_http_info(opts = {}) ⇒ Array<(ListCatalogResponse, Fixnum, Hash)>

ListCatalog Returns a list of [CatalogObject](#type-catalogobject)s that includes all objects of a set of desired types (for example, all [CatalogItem](#type-catalogitem) and [CatalogTax](#type-catalogtax) objects) in the catalog. The types parameter is specified as a comma-separated list of valid [CatalogObject](#type-catalogobject) types: &#x60;ITEM&#x60;, &#x60;ITEM_VARIATION&#x60;, &#x60;MODIFIER&#x60;, &#x60;MODIFIER_LIST&#x60;, &#x60;CATEGORY&#x60;, &#x60;DISCOUNT&#x60;, &#x60;TAX&#x60;.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :cursor (String)

    The pagination cursor returned in the previous response. Leave unset for an initial request. See [Paginating results](#paginatingresults) for more information.

  • :types (String)

    An optional case-insensitive, comma-separated list of object types to retrieve, for example &#x60;ITEM,ITEM_VARIATION,CATEGORY&#x60;. The legal values are taken from the [CatalogObjectType](#type-catalogobjecttype) enumeration, namely &#x60;&quot;ITEM&quot;&#x60;, &#x60;&quot;ITEM_VARIATION&quot;&#x60;, &#x60;&quot;CATEGORY&quot;&#x60;, &#x60;&quot;DISCOUNT&quot;&#x60;, &#x60;&quot;TAX&quot;&#x60;, &#x60;&quot;MODIFIER&quot;&#x60;, or &#x60;&quot;MODIFIER_LIST&quot;&#x60;.

Returns:

  • (Array<(ListCatalogResponse, Fixnum, Hash)>)

    ListCatalogResponse data, response status code and response headers



298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/square_connect/api/catalog_api.rb', line 298

def list_catalog_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CatalogApi.list_catalog ..."
  end
  # resource path
  local_var_path = "/v2/catalog/list".sub('{format}','json')

  # query parameters
  query_params = {}
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
  query_params[:'types'] = opts[:'types'] if !opts[:'types'].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'])

  # 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 => 'ListCatalogResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CatalogApi#list_catalog\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#retrieve_catalog_object(object_id, opts = {}) ⇒ RetrieveCatalogObjectResponse

RetrieveCatalogObject Returns a single [CatalogItem](#type-catalogitem) as a [CatalogObject](#type-catalogobject) based on the provided ID. The returned object includes all of the relevant [CatalogItem](#type-catalogitem) information including: [CatalogItemVariation](#type-catalogitemvariation) children, references to its [CatalogModifierList](#type-catalogmodifierlist) objects, and the ids of any [CatalogTax](#type-catalogtax) objects that apply to it.

Parameters:

  • object_id

    The object ID of any type of [CatalogObject](#type-catalogobject)s to be retrieved.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :include_related_objects (BOOLEAN)

    If &#x60;true&#x60;, the response will include additional objects that are related to the requested object, as follows: If the &#x60;object&#x60; field of the response contains a [CatalogItem](#type-catalogitem), its associated [CatalogCategory](#type-catalogcategory), [CatalogTax](#type-catalogtax)es, and [CatalogModifierList](#type-catalogmodifierlist)s will be returned in the &#x60;related_objects&#x60; field of the response. If the &#x60;object&#x60; field of the response contains a [CatalogItemVariation](#type-catalogitemvariation), its parent [CatalogItem](#type-catalogitem) will be returned in the &#x60;related_objects&#x60; field of the response. Default value: &#x60;false&#x60;

Returns:



342
343
344
345
# File 'lib/square_connect/api/catalog_api.rb', line 342

def retrieve_catalog_object(object_id, opts = {})
  data, _status_code, _headers = retrieve_catalog_object_with_http_info(object_id, opts)
  return data
end

#retrieve_catalog_object_with_http_info(object_id, opts = {}) ⇒ Array<(RetrieveCatalogObjectResponse, Fixnum, Hash)>

RetrieveCatalogObject Returns a single [CatalogItem](#type-catalogitem) as a [CatalogObject](#type-catalogobject) based on the provided ID. The returned object includes all of the relevant [CatalogItem](#type-catalogitem) information including: [CatalogItemVariation](#type-catalogitemvariation) children, references to its [CatalogModifierList](#type-catalogmodifierlist) objects, and the ids of any [CatalogTax](#type-catalogtax) objects that apply to it.

Parameters:

  • object_id

    The object ID of any type of [CatalogObject](#type-catalogobject)s to be retrieved.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :include_related_objects (BOOLEAN)

    If &#x60;true&#x60;, the response will include additional objects that are related to the requested object, as follows: If the &#x60;object&#x60; field of the response contains a [CatalogItem](#type-catalogitem), its associated [CatalogCategory](#type-catalogcategory), [CatalogTax](#type-catalogtax)es, and [CatalogModifierList](#type-catalogmodifierlist)s will be returned in the &#x60;related_objects&#x60; field of the response. If the &#x60;object&#x60; field of the response contains a [CatalogItemVariation](#type-catalogitemvariation), its parent [CatalogItem](#type-catalogitem) will be returned in the &#x60;related_objects&#x60; field of the response. Default value: &#x60;false&#x60;

Returns:



353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
# File 'lib/square_connect/api/catalog_api.rb', line 353

def retrieve_catalog_object_with_http_info(object_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CatalogApi.retrieve_catalog_object ..."
  end
  # verify the required parameter 'object_id' is set
  fail ArgumentError, "Missing the required parameter 'object_id' when calling CatalogApi.retrieve_catalog_object" if object_id.nil?
  # resource path
  local_var_path = "/v2/catalog/object/{object_id}".sub('{format}','json').sub('{' + 'object_id' + '}', object_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'include_related_objects'] = opts[:'include_related_objects'] if !opts[:'include_related_objects'].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'])

  # 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 => 'RetrieveCatalogObjectResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CatalogApi#retrieve_catalog_object\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_catalog_objects(body, opts = {}) ⇒ SearchCatalogObjectsResponse

SearchCatalogObjects Queries the targeted catalog using a variety of query types: [CatalogQuerySortedAttribute](#type-catalogquerysortedattribute), [CatalogQueryExact](#type-catalogqueryexact), [CatalogQueryRange](#type-catalogqueryrange), [CatalogQueryText](#type-catalogquerytext), [CatalogQueryItemsForTax](#type-catalogqueryitemsfortax), and [CatalogQueryItemsForModifierList](#type-catalogqueryitemsformodifierlist).

Parameters:

  • body

    An object containing the fields to POST for the request. See the corresponding object definition for field details.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



397
398
399
400
# File 'lib/square_connect/api/catalog_api.rb', line 397

def search_catalog_objects(body, opts = {})
  data, _status_code, _headers = search_catalog_objects_with_http_info(body, opts)
  return data
end

#search_catalog_objects_with_http_info(body, opts = {}) ⇒ Array<(SearchCatalogObjectsResponse, Fixnum, Hash)>

SearchCatalogObjects Queries the targeted catalog using a variety of query types: [CatalogQuerySortedAttribute](#type-catalogquerysortedattribute), [CatalogQueryExact](#type-catalogqueryexact), [CatalogQueryRange](#type-catalogqueryrange), [CatalogQueryText](#type-catalogquerytext), [CatalogQueryItemsForTax](#type-catalogqueryitemsfortax), and [CatalogQueryItemsForModifierList](#type-catalogqueryitemsformodifierlist).

Parameters:

  • body

    An object containing the fields to POST for the request. See the corresponding object definition for field details.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
# File 'lib/square_connect/api/catalog_api.rb', line 407

def search_catalog_objects_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CatalogApi.search_catalog_objects ..."
  end
  # verify the required parameter 'body' is set
  fail ArgumentError, "Missing the required parameter 'body' when calling CatalogApi.search_catalog_objects" if body.nil?
  # resource path
  local_var_path = "/v2/catalog/search".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'])

  # 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 => 'SearchCatalogObjectsResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CatalogApi#search_catalog_objects\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_item_modifier_lists(body, opts = {}) ⇒ UpdateItemModifierListsResponse

UpdateItemModifierLists Updates the [CatalogModifierList](#type-catalogmodifierlist) objects that apply to the targeted [CatalogItem](#type-catalogitem) without having to perform an upsert on the entire item.

Parameters:

  • body

    An object containing the fields to POST for the request. See the corresponding object definition for field details.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



450
451
452
453
# File 'lib/square_connect/api/catalog_api.rb', line 450

def update_item_modifier_lists(body, opts = {})
  data, _status_code, _headers = update_item_modifier_lists_with_http_info(body, opts)
  return data
end

#update_item_modifier_lists_with_http_info(body, opts = {}) ⇒ Array<(UpdateItemModifierListsResponse, Fixnum, Hash)>

UpdateItemModifierLists Updates the [CatalogModifierList](#type-catalogmodifierlist) objects that apply to the targeted [CatalogItem](#type-catalogitem) without having to perform an upsert on the entire item.

Parameters:

  • body

    An object containing the fields to POST for the request. See the corresponding object definition for field details.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
# File 'lib/square_connect/api/catalog_api.rb', line 460

def update_item_modifier_lists_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CatalogApi.update_item_modifier_lists ..."
  end
  # verify the required parameter 'body' is set
  fail ArgumentError, "Missing the required parameter 'body' when calling CatalogApi.update_item_modifier_lists" if body.nil?
  # resource path
  local_var_path = "/v2/catalog/update-item-modifier-lists".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'])

  # 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 => 'UpdateItemModifierListsResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CatalogApi#update_item_modifier_lists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_item_taxes(body, opts = {}) ⇒ UpdateItemTaxesResponse

UpdateItemTaxes Updates the [CatalogTax](#type-catalogtax) objects that apply to the targeted [CatalogItem](#type-catalogitem) without having to perform an upsert on the entire item.

Parameters:

  • body

    An object containing the fields to POST for the request. See the corresponding object definition for field details.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



503
504
505
506
# File 'lib/square_connect/api/catalog_api.rb', line 503

def update_item_taxes(body, opts = {})
  data, _status_code, _headers = update_item_taxes_with_http_info(body, opts)
  return data
end

#update_item_taxes_with_http_info(body, opts = {}) ⇒ Array<(UpdateItemTaxesResponse, Fixnum, Hash)>

UpdateItemTaxes Updates the [CatalogTax](#type-catalogtax) objects that apply to the targeted [CatalogItem](#type-catalogitem) without having to perform an upsert on the entire item.

Parameters:

  • body

    An object containing the fields to POST for the request. See the corresponding object definition for field details.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(UpdateItemTaxesResponse, Fixnum, Hash)>)

    UpdateItemTaxesResponse data, response status code and response headers



513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
# File 'lib/square_connect/api/catalog_api.rb', line 513

def update_item_taxes_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CatalogApi.update_item_taxes ..."
  end
  # verify the required parameter 'body' is set
  fail ArgumentError, "Missing the required parameter 'body' when calling CatalogApi.update_item_taxes" if body.nil?
  # resource path
  local_var_path = "/v2/catalog/update-item-taxes".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'])

  # 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 => 'UpdateItemTaxesResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CatalogApi#update_item_taxes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#upsert_catalog_object(body, opts = {}) ⇒ UpsertCatalogObjectResponse

UpsertCatalogObject Creates or updates the target [CatalogObject](#type-catalogobject).

Parameters:

  • body

    An object containing the fields to POST for the request. See the corresponding object definition for field details.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



556
557
558
559
# File 'lib/square_connect/api/catalog_api.rb', line 556

def upsert_catalog_object(body, opts = {})
  data, _status_code, _headers = upsert_catalog_object_with_http_info(body, opts)
  return data
end

#upsert_catalog_object_with_http_info(body, opts = {}) ⇒ Array<(UpsertCatalogObjectResponse, Fixnum, Hash)>

UpsertCatalogObject Creates or updates the target [CatalogObject](#type-catalogobject).

Parameters:

  • body

    An object containing the fields to POST for the request. See the corresponding object definition for field details.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
# File 'lib/square_connect/api/catalog_api.rb', line 566

def upsert_catalog_object_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CatalogApi.upsert_catalog_object ..."
  end
  # verify the required parameter 'body' is set
  fail ArgumentError, "Missing the required parameter 'body' when calling CatalogApi.upsert_catalog_object" if body.nil?
  # resource path
  local_var_path = "/v2/catalog/object".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'])

  # 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 => 'UpsertCatalogObjectResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CatalogApi#upsert_catalog_object\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end