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
72
73
# 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'])
  
  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 => '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:



80
81
82
83
# File 'lib/square_connect/api/catalog_api.rb', line 80

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:



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/catalog_api.rb', line 90

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'])
  
  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 => '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:



135
136
137
138
# File 'lib/square_connect/api/catalog_api.rb', line 135

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:



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/catalog_api.rb', line 145

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'])
  
  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 => '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:



189
190
191
192
# File 'lib/square_connect/api/catalog_api.rb', line 189

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



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
227
228
229
230
231
232
233
234
# File 'lib/square_connect/api/catalog_api.rb', line 198

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'])
  
  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 => '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:



241
242
243
244
# File 'lib/square_connect/api/catalog_api.rb', line 241

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:



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
280
281
282
283
284
285
286
287
288
289
# File 'lib/square_connect/api/catalog_api.rb', line 251

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'])
  
  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(: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`. Important: ListCatalog does not return deleted catalog items. To retrieve deleted catalog items, use SearchCatalogObjects and set `include_deleted_objects` to `true`.

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 [Pagination](/basics/api101/pagination) for more information.

  • :types (String)

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

Returns:



297
298
299
300
# File 'lib/square_connect/api/catalog_api.rb', line 297

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 &#x60;types&#x60; 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;. Important: ListCatalog does not return deleted catalog items. To retrieve deleted catalog items, use SearchCatalogObjects and set &#x60;include_deleted_objects&#x60; to &#x60;true&#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 [Pagination](/basics/api101/pagination) for more information.

  • :types (String)

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

Returns:

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

    ListCatalogResponse data, response status code and response headers



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
335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/square_connect/api/catalog_api.rb', line 308

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'])
  
  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 => '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, [CatalogImage](#type-catalogimage)s 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:



354
355
356
357
# File 'lib/square_connect/api/catalog_api.rb', line 354

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, [CatalogImage](#type-catalogimage)s 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:



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
391
392
393
394
395
396
397
398
399
400
401
402
403
404
# File 'lib/square_connect/api/catalog_api.rb', line 365

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'])
  
  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 => '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:



411
412
413
414
# File 'lib/square_connect/api/catalog_api.rb', line 411

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:



421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
# File 'lib/square_connect/api/catalog_api.rb', line 421

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'])
  
  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 => '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:



466
467
468
469
# File 'lib/square_connect/api/catalog_api.rb', line 466

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:



476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
# File 'lib/square_connect/api/catalog_api.rb', line 476

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'])
  
  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 => '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:



521
522
523
524
# File 'lib/square_connect/api/catalog_api.rb', line 521

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



531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/square_connect/api/catalog_api.rb', line 531

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'])
  
  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 => '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:



576
577
578
579
# File 'lib/square_connect/api/catalog_api.rb', line 576

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:



586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
# File 'lib/square_connect/api/catalog_api.rb', line 586

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'])
  
  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 => '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