Class: KoronaCloudClient::ProductsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/korona-cloud-client/api/products_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ProductsApi

Returns a new instance of ProductsApi.



19
20
21
# File 'lib/korona-cloud-client/api/products_api.rb', line 19

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/korona-cloud-client/api/products_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_products(korona_account_id, product, opts = {}) ⇒ Array<AddOrUpdateResult>

adds a batch of new products

Parameters:

  • korona_account_id (String)

    account id of the KORONA Studio account

  • product (Array<Product>)

    array of new products

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

    the optional parameters

Options Hash (opts):

  • :upsert (Boolean)

    when set to true, updates the object instead of generating a already-exists-error; deprecated, use writeMode ADD_OR_UPDATE instead

  • :merge_list_items (Boolean)

    if set to true, merges lists instead of replacing them

  • :merge_tags (Boolean)

    if set to true, merges tags instead of overwriting the list

  • :write_mode (String)

    DEFAULT &#x3D; insert; ADD_OR_UPDATE &#x3D; insert or update, overwrite all non-null fields; ADD_OR_REPLACE &#x3D; insert or update, overwrite all fields

Returns:



31
32
33
34
# File 'lib/korona-cloud-client/api/products_api.rb', line 31

def add_products(, product, opts = {})
  data, _status_code, _headers = add_products_with_http_info(, product, opts)
  data
end

#add_products_with_http_info(korona_account_id, product, opts = {}) ⇒ Array<(Array<AddOrUpdateResult>, Integer, Hash)>

adds a batch of new products

Parameters:

  • korona_account_id (String)

    account id of the KORONA Studio account

  • product (Array<Product>)

    array of new products

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

    the optional parameters

Options Hash (opts):

  • :upsert (Boolean)

    when set to true, updates the object instead of generating a already-exists-error; deprecated, use writeMode ADD_OR_UPDATE instead

  • :merge_list_items (Boolean)

    if set to true, merges lists instead of replacing them

  • :merge_tags (Boolean)

    if set to true, merges tags instead of overwriting the list

  • :write_mode (String)

    DEFAULT &#x3D; insert; ADD_OR_UPDATE &#x3D; insert or update, overwrite all non-null fields; ADD_OR_REPLACE &#x3D; insert or update, overwrite all fields

Returns:

  • (Array<(Array<AddOrUpdateResult>, Integer, Hash)>)

    Array<AddOrUpdateResult> data, response status code and response headers



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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/korona-cloud-client/api/products_api.rb', line 45

def add_products_with_http_info(, product, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.add_products ...'
  end
  # verify the required parameter 'korona_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'korona_account_id' when calling ProductsApi.add_products"
  end
  # verify the required parameter 'product' is set
  if @api_client.config.client_side_validation && product.nil?
    fail ArgumentError, "Missing the required parameter 'product' when calling ProductsApi.add_products"
  end
  allowable_values = ["DEFAULT", "ADD_OR_UPDATE", "ADD_OR_REPLACE"]
  if @api_client.config.client_side_validation && opts[:'write_mode'] && !allowable_values.include?(opts[:'write_mode'])
    fail ArgumentError, "invalid value for \"write_mode\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/accounts/{koronaAccountId}/products'.sub('{' + 'koronaAccountId' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'upsert'] = opts[:'upsert'] if !opts[:'upsert'].nil?
  query_params[:'mergeListItems'] = opts[:'merge_list_items'] if !opts[:'merge_list_items'].nil?
  query_params[:'mergeTags'] = opts[:'merge_tags'] if !opts[:'merge_tags'].nil?
  query_params[:'writeMode'] = opts[:'write_mode'] if !opts[:'write_mode'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(product)

  # return_type
  return_type = opts[:debug_return_type] || 'Array<AddOrUpdateResult>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['basicAuth']

  new_options = opts.merge(
    :operation => :"ProductsApi.add_products",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#add_products\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_product(korona_account_id, product_id, opts = {}) ⇒ nil

deletes the single product

Parameters:

  • korona_account_id (String)

    account id of the KORONA Studio account

  • product_id (String)

    id of the related object (important: id should match the uuid-format)

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

    the optional parameters

Returns:

  • (nil)


115
116
117
118
# File 'lib/korona-cloud-client/api/products_api.rb', line 115

def delete_product(, product_id, opts = {})
  delete_product_with_http_info(, product_id, opts)
  nil
end

#delete_product_with_http_info(korona_account_id, product_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

deletes the single product

Parameters:

  • korona_account_id (String)

    account id of the KORONA Studio account

  • product_id (String)

    id of the related object (important: id should match the uuid-format)

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

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
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
# File 'lib/korona-cloud-client/api/products_api.rb', line 125

def delete_product_with_http_info(, product_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.delete_product ...'
  end
  # verify the required parameter 'korona_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'korona_account_id' when calling ProductsApi.delete_product"
  end
  # verify the required parameter 'product_id' is set
  if @api_client.config.client_side_validation && product_id.nil?
    fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.delete_product"
  end
  # resource path
  local_var_path = '/accounts/{koronaAccountId}/products/{productId}'.sub('{' + 'koronaAccountId' + '}', CGI.escape(.to_s)).sub('{' + 'productId' + '}', CGI.escape(product_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['basicAuth']

  new_options = opts.merge(
    :operation => :"ProductsApi.delete_product",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#delete_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_products(korona_account_id, product, opts = {}) ⇒ Array<AddOrUpdateResult>

deletes a batch of products

Parameters:

  • korona_account_id (String)

    account id of the KORONA Studio account

  • product (Array<Product>)

    array of existing products (id or number required)

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

    the optional parameters

Returns:



182
183
184
185
# File 'lib/korona-cloud-client/api/products_api.rb', line 182

def delete_products(, product, opts = {})
  data, _status_code, _headers = delete_products_with_http_info(, product, opts)
  data
end

#delete_products_with_http_info(korona_account_id, product, opts = {}) ⇒ Array<(Array<AddOrUpdateResult>, Integer, Hash)>

deletes a batch of products

Parameters:

  • korona_account_id (String)

    account id of the KORONA Studio account

  • product (Array<Product>)

    array of existing products (id or number required)

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

    the optional parameters

Returns:

  • (Array<(Array<AddOrUpdateResult>, Integer, Hash)>)

    Array<AddOrUpdateResult> 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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/korona-cloud-client/api/products_api.rb', line 192

def delete_products_with_http_info(, product, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.delete_products ...'
  end
  # verify the required parameter 'korona_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'korona_account_id' when calling ProductsApi.delete_products"
  end
  # verify the required parameter 'product' is set
  if @api_client.config.client_side_validation && product.nil?
    fail ArgumentError, "Missing the required parameter 'product' when calling ProductsApi.delete_products"
  end
  # resource path
  local_var_path = '/accounts/{koronaAccountId}/products'.sub('{' + 'koronaAccountId' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(product)

  # return_type
  return_type = opts[:debug_return_type] || 'Array<AddOrUpdateResult>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['basicAuth']

  new_options = opts.merge(
    :operation => :"ProductsApi.delete_products",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#delete_products\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_product(korona_account_id, product_id, opts = {}) ⇒ Product

returns the single product

Parameters:

  • korona_account_id (String)

    account id of the KORONA Studio account

  • product_id (String)

    id of the related object (important: id should match the uuid-format)

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

    the optional parameters

Returns:



254
255
256
257
# File 'lib/korona-cloud-client/api/products_api.rb', line 254

def get_product(, product_id, opts = {})
  data, _status_code, _headers = get_product_with_http_info(, product_id, opts)
  data
end

#get_product_stocks(korona_account_id, product_id, opts = {}) ⇒ ResultListProductStock

lists the product stocks in different warehouses (KORONA Retail required)

Parameters:

  • korona_account_id (String)

    account id of the KORONA Studio account

  • product_id (String)

    id of the related object (important: id should match the uuid-format)

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

    the optional parameters

Options Hash (opts):

  • :revision (Integer)

    last revision number, objects with a greater revision than this will be returned

  • :model_reference (Array<ModelReference>)

    warehouses to filter

Returns:



323
324
325
326
# File 'lib/korona-cloud-client/api/products_api.rb', line 323

def get_product_stocks(, product_id, opts = {})
  data, _status_code, _headers = get_product_stocks_with_http_info(, product_id, opts)
  data
end

#get_product_stocks1(korona_account_id, product_id, opts = {}) ⇒ ResultListProductStock

lists the product stocks in different warehouses (KORONA Retail required)

Parameters:

  • korona_account_id (String)

    account id of the KORONA Studio account

  • product_id (String)

    id of the related object (important: id should match the uuid-format)

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    number of the page to fetch

  • :size (Integer)

    amount of objects to return per page

  • :sort (String)

    attribute to sort by (multiple separated by comma; max. 5)

  • :revision (Integer)

    last revision number, objects with a greater revision than this will be returned

Returns:



402
403
404
405
# File 'lib/korona-cloud-client/api/products_api.rb', line 402

def get_product_stocks1(, product_id, opts = {})
  data, _status_code, _headers = get_product_stocks1_with_http_info(, product_id, opts)
  data
end

#get_product_stocks1_with_http_info(korona_account_id, product_id, opts = {}) ⇒ Array<(ResultListProductStock, Integer, Hash)>

lists the product stocks in different warehouses (KORONA Retail required)

Parameters:

  • korona_account_id (String)

    account id of the KORONA Studio account

  • product_id (String)

    id of the related object (important: id should match the uuid-format)

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    number of the page to fetch

  • :size (Integer)

    amount of objects to return per page

  • :sort (String)

    attribute to sort by (multiple separated by comma; max. 5)

  • :revision (Integer)

    last revision number, objects with a greater revision than this will be returned

Returns:

  • (Array<(ResultListProductStock, Integer, Hash)>)

    ResultListProductStock data, response status code and response headers



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
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
# File 'lib/korona-cloud-client/api/products_api.rb', line 416

def get_product_stocks1_with_http_info(, product_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.get_product_stocks1 ...'
  end
  # verify the required parameter 'korona_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'korona_account_id' when calling ProductsApi.get_product_stocks1"
  end
  # verify the required parameter 'product_id' is set
  if @api_client.config.client_side_validation && product_id.nil?
    fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.get_product_stocks1"
  end
  # resource path
  local_var_path = '/accounts/{koronaAccountId}/products/{productId}/stocks'.sub('{' + 'koronaAccountId' + '}', CGI.escape(.to_s)).sub('{' + 'productId' + '}', CGI.escape(product_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'revision'] = opts[:'revision'] if !opts[:'revision'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ResultListProductStock'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['basicAuth']

  new_options = opts.merge(
    :operation => :"ProductsApi.get_product_stocks1",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#get_product_stocks1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_product_stocks_with_http_info(korona_account_id, product_id, opts = {}) ⇒ Array<(ResultListProductStock, Integer, Hash)>

lists the product stocks in different warehouses (KORONA Retail required)

Parameters:

  • korona_account_id (String)

    account id of the KORONA Studio account

  • product_id (String)

    id of the related object (important: id should match the uuid-format)

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

    the optional parameters

Options Hash (opts):

  • :revision (Integer)

    last revision number, objects with a greater revision than this will be returned

  • :model_reference (Array<ModelReference>)

    warehouses to filter

Returns:

  • (Array<(ResultListProductStock, Integer, Hash)>)

    ResultListProductStock data, response status code and response headers



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
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
391
# File 'lib/korona-cloud-client/api/products_api.rb', line 335

def get_product_stocks_with_http_info(, product_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.get_product_stocks ...'
  end
  # verify the required parameter 'korona_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'korona_account_id' when calling ProductsApi.get_product_stocks"
  end
  # verify the required parameter 'product_id' is set
  if @api_client.config.client_side_validation && product_id.nil?
    fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.get_product_stocks"
  end
  # resource path
  local_var_path = '/accounts/{koronaAccountId}/products/{productId}/stocks'.sub('{' + 'koronaAccountId' + '}', CGI.escape(.to_s)).sub('{' + 'productId' + '}', CGI.escape(product_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'revision'] = opts[:'revision'] if !opts[:'revision'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'model_reference'])

  # return_type
  return_type = opts[:debug_return_type] || 'ResultListProductStock'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['basicAuth']

  new_options = opts.merge(
    :operation => :"ProductsApi.get_product_stocks",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#get_product_stocks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_product_with_http_info(korona_account_id, product_id, opts = {}) ⇒ Array<(Product, Integer, Hash)>

returns the single product

Parameters:

  • korona_account_id (String)

    account id of the KORONA Studio account

  • product_id (String)

    id of the related object (important: id should match the uuid-format)

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

    the optional parameters

Returns:

  • (Array<(Product, Integer, Hash)>)

    Product data, response status code and response headers



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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/korona-cloud-client/api/products_api.rb', line 264

def get_product_with_http_info(, product_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.get_product ...'
  end
  # verify the required parameter 'korona_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'korona_account_id' when calling ProductsApi.get_product"
  end
  # verify the required parameter 'product_id' is set
  if @api_client.config.client_side_validation && product_id.nil?
    fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.get_product"
  end
  # resource path
  local_var_path = '/accounts/{koronaAccountId}/products/{productId}'.sub('{' + 'koronaAccountId' + '}', CGI.escape(.to_s)).sub('{' + 'productId' + '}', CGI.escape(product_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Product'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['basicAuth']

  new_options = opts.merge(
    :operation => :"ProductsApi.get_product",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#get_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_products(korona_account_id, opts = {}) ⇒ ResultListProduct

lists all products

Parameters:

  • korona_account_id (String)

    account id of the KORONA Studio account

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    number of the page to fetch

  • :size (Integer)

    amount of objects to return per page

  • :sort (String)

    attribute to sort by (multiple separated by comma; max. 5)

  • :revision (Integer)

    last revision number, objects with a greater revision than this will be returned

  • :include_deleted (Boolean)

    indicates deleted objects should be loaded or not (default: false)

  • :product_codes (String)

    at least one product code to filter by (multiple separated by comma; max. 10)

  • :commodity_group (String)

    commodity group id to filter by

  • :assortment (String)

    assortment id to filter by

  • :tag (String)

    tag id to filter by

  • :number (String)

    number of the related object

  • :name (String)

    name of the related object

  • :omit_page_counts (Boolean)

    Set &#39;pagesTotal&#39; and &#39;resultsTotal&#39; to -1, allowing us to omit the count operation and speeding up the query.

Returns:



488
489
490
491
# File 'lib/korona-cloud-client/api/products_api.rb', line 488

def get_products(, opts = {})
  data, _status_code, _headers = get_products_with_http_info(, opts)
  data
end

#get_products_with_http_info(korona_account_id, opts = {}) ⇒ Array<(ResultListProduct, Integer, Hash)>

lists all products

Parameters:

  • korona_account_id (String)

    account id of the KORONA Studio account

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    number of the page to fetch

  • :size (Integer)

    amount of objects to return per page

  • :sort (String)

    attribute to sort by (multiple separated by comma; max. 5)

  • :revision (Integer)

    last revision number, objects with a greater revision than this will be returned

  • :include_deleted (Boolean)

    indicates deleted objects should be loaded or not (default: false)

  • :product_codes (String)

    at least one product code to filter by (multiple separated by comma; max. 10)

  • :commodity_group (String)

    commodity group id to filter by

  • :assortment (String)

    assortment id to filter by

  • :tag (String)

    tag id to filter by

  • :number (String)

    number of the related object

  • :name (String)

    name of the related object

  • :omit_page_counts (Boolean)

    Set &#39;pagesTotal&#39; and &#39;resultsTotal&#39; to -1, allowing us to omit the count operation and speeding up the query.

Returns:

  • (Array<(ResultListProduct, Integer, Hash)>)

    ResultListProduct data, response status code and response headers



509
510
511
512
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
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
# File 'lib/korona-cloud-client/api/products_api.rb', line 509

def get_products_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.get_products ...'
  end
  # verify the required parameter 'korona_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'korona_account_id' when calling ProductsApi.get_products"
  end
  # resource path
  local_var_path = '/accounts/{koronaAccountId}/products'.sub('{' + 'koronaAccountId' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'revision'] = opts[:'revision'] if !opts[:'revision'].nil?
  query_params[:'includeDeleted'] = opts[:'include_deleted'] if !opts[:'include_deleted'].nil?
  query_params[:'productCodes'] = opts[:'product_codes'] if !opts[:'product_codes'].nil?
  query_params[:'commodityGroup'] = opts[:'commodity_group'] if !opts[:'commodity_group'].nil?
  query_params[:'assortment'] = opts[:'assortment'] if !opts[:'assortment'].nil?
  query_params[:'tag'] = opts[:'tag'] if !opts[:'tag'].nil?
  query_params[:'number'] = opts[:'number'] if !opts[:'number'].nil?
  query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
  query_params[:'omitPageCounts'] = opts[:'omit_page_counts'] if !opts[:'omit_page_counts'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ResultListProduct'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['basicAuth']

  new_options = opts.merge(
    :operation => :"ProductsApi.get_products",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#get_products\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#remove_tag_from_product(korona_account_id, product_id, tag_id, opts = {}) ⇒ nil

removes the tag from the product

Parameters:

  • korona_account_id (String)

    account id of the KORONA Studio account

  • product_id (String)

    id of the related object (important: id should match the uuid-format)

  • tag_id (String)

    id of the related object (important: id should match the uuid-format)

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

    the optional parameters

Returns:

  • (nil)


575
576
577
578
# File 'lib/korona-cloud-client/api/products_api.rb', line 575

def remove_tag_from_product(, product_id, tag_id, opts = {})
  remove_tag_from_product_with_http_info(, product_id, tag_id, opts)
  nil
end

#remove_tag_from_product_with_http_info(korona_account_id, product_id, tag_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

removes the tag from the product

Parameters:

  • korona_account_id (String)

    account id of the KORONA Studio account

  • product_id (String)

    id of the related object (important: id should match the uuid-format)

  • tag_id (String)

    id of the related object (important: id should match the uuid-format)

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

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



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
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
# File 'lib/korona-cloud-client/api/products_api.rb', line 586

def remove_tag_from_product_with_http_info(, product_id, tag_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.remove_tag_from_product ...'
  end
  # verify the required parameter 'korona_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'korona_account_id' when calling ProductsApi.remove_tag_from_product"
  end
  # verify the required parameter 'product_id' is set
  if @api_client.config.client_side_validation && product_id.nil?
    fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.remove_tag_from_product"
  end
  # verify the required parameter 'tag_id' is set
  if @api_client.config.client_side_validation && tag_id.nil?
    fail ArgumentError, "Missing the required parameter 'tag_id' when calling ProductsApi.remove_tag_from_product"
  end
  # resource path
  local_var_path = '/accounts/{koronaAccountId}/products/{productId}/tags/{tagId}'.sub('{' + 'koronaAccountId' + '}', CGI.escape(.to_s)).sub('{' + 'productId' + '}', CGI.escape(product_id.to_s)).sub('{' + 'tagId' + '}', CGI.escape(tag_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['basicAuth']

  new_options = opts.merge(
    :operation => :"ProductsApi.remove_tag_from_product",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#remove_tag_from_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_product(korona_account_id, product_id, product, opts = {}) ⇒ nil

updates the single product; if [number] is set, the number of the object will change and the resource location as well

Parameters:

  • korona_account_id (String)

    account id of the KORONA Studio account

  • product_id (String)

    id of the related object (important: id should match the uuid-format)

  • product (Product)

    the properties to update of the product

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

    the optional parameters

Options Hash (opts):

  • :merge_list_items (Boolean)

    if set to true, merges lists instead of replacing them

  • :merge_tags (Boolean)

    if set to true, merges tags instead of overwriting the list

Returns:

  • (nil)


650
651
652
653
# File 'lib/korona-cloud-client/api/products_api.rb', line 650

def update_product(, product_id, product, opts = {})
  update_product_with_http_info(, product_id, product, opts)
  nil
end

#update_product_with_http_info(korona_account_id, product_id, product, opts = {}) ⇒ Array<(nil, Integer, Hash)>

updates the single product; if [number] is set, the number of the object will change and the resource location as well

Parameters:

  • korona_account_id (String)

    account id of the KORONA Studio account

  • product_id (String)

    id of the related object (important: id should match the uuid-format)

  • product (Product)

    the properties to update of the product

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

    the optional parameters

Options Hash (opts):

  • :merge_list_items (Boolean)

    if set to true, merges lists instead of replacing them

  • :merge_tags (Boolean)

    if set to true, merges tags instead of overwriting the list

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
# File 'lib/korona-cloud-client/api/products_api.rb', line 663

def update_product_with_http_info(, product_id, product, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.update_product ...'
  end
  # verify the required parameter 'korona_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'korona_account_id' when calling ProductsApi.update_product"
  end
  # verify the required parameter 'product_id' is set
  if @api_client.config.client_side_validation && product_id.nil?
    fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.update_product"
  end
  # verify the required parameter 'product' is set
  if @api_client.config.client_side_validation && product.nil?
    fail ArgumentError, "Missing the required parameter 'product' when calling ProductsApi.update_product"
  end
  # resource path
  local_var_path = '/accounts/{koronaAccountId}/products/{productId}'.sub('{' + 'koronaAccountId' + '}', CGI.escape(.to_s)).sub('{' + 'productId' + '}', CGI.escape(product_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'mergeListItems'] = opts[:'merge_list_items'] if !opts[:'merge_list_items'].nil?
  query_params[:'mergeTags'] = opts[:'merge_tags'] if !opts[:'merge_tags'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(product)

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['basicAuth']

  new_options = opts.merge(
    :operation => :"ProductsApi.update_product",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#update_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_products(korona_account_id, product, opts = {}) ⇒ Array<AddOrUpdateResult>

updates a batch of products; [number] must be set in the objects, otherwise the object cannot be updated

Parameters:

  • korona_account_id (String)

    account id of the KORONA Studio account

  • product (Array<Product>)

    an array of existing products

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

    the optional parameters

Options Hash (opts):

  • :merge_list_items (Boolean)

    if set to true, merges lists instead of replacing them

  • :merge_tags (Boolean)

    if set to true, merges tags instead of overwriting the list

Returns:



733
734
735
736
# File 'lib/korona-cloud-client/api/products_api.rb', line 733

def update_products(, product, opts = {})
  data, _status_code, _headers = update_products_with_http_info(, product, opts)
  data
end

#update_products_with_http_info(korona_account_id, product, opts = {}) ⇒ Array<(Array<AddOrUpdateResult>, Integer, Hash)>

updates a batch of products; [number] must be set in the objects, otherwise the object cannot be updated

Parameters:

  • korona_account_id (String)

    account id of the KORONA Studio account

  • product (Array<Product>)

    an array of existing products

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

    the optional parameters

Options Hash (opts):

  • :merge_list_items (Boolean)

    if set to true, merges lists instead of replacing them

  • :merge_tags (Boolean)

    if set to true, merges tags instead of overwriting the list

Returns:

  • (Array<(Array<AddOrUpdateResult>, Integer, Hash)>)

    Array<AddOrUpdateResult> data, response status code and response headers



745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
# File 'lib/korona-cloud-client/api/products_api.rb', line 745

def update_products_with_http_info(, product, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.update_products ...'
  end
  # verify the required parameter 'korona_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'korona_account_id' when calling ProductsApi.update_products"
  end
  # verify the required parameter 'product' is set
  if @api_client.config.client_side_validation && product.nil?
    fail ArgumentError, "Missing the required parameter 'product' when calling ProductsApi.update_products"
  end
  # resource path
  local_var_path = '/accounts/{koronaAccountId}/products'.sub('{' + 'koronaAccountId' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'mergeListItems'] = opts[:'merge_list_items'] if !opts[:'merge_list_items'].nil?
  query_params[:'mergeTags'] = opts[:'merge_tags'] if !opts[:'merge_tags'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(product)

  # return_type
  return_type = opts[:debug_return_type] || 'Array<AddOrUpdateResult>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['basicAuth']

  new_options = opts.merge(
    :operation => :"ProductsApi.update_products",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#update_products\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end