Class: Solifyn::CollectionsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/solifyn/api/collections_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CollectionsApi

Returns a new instance of CollectionsApi.



19
20
21
# File 'lib/solifyn/api/collections_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/solifyn/api/collections_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#collections_add_products(id, add_collection_products_dto, opts = {}) ⇒ CollectionResponseDto

Add Products to Collection Add one or more products to a collection. If a product already exists, its quantity is updated.

Parameters:

  • id (String)

    Collection ID

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

    the optional parameters

Returns:



28
29
30
31
# File 'lib/solifyn/api/collections_api.rb', line 28

def collections_add_products(id, add_collection_products_dto, opts = {})
  data, _status_code, _headers = collections_add_products_with_http_info(id, add_collection_products_dto, opts)
  data
end

#collections_add_products_with_http_info(id, add_collection_products_dto, opts = {}) ⇒ Array<(CollectionResponseDto, Integer, Hash)>

Add Products to Collection Add one or more products to a collection. If a product already exists, its quantity is updated.

Parameters:

  • id (String)

    Collection ID

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

    the optional parameters

Returns:

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

    CollectionResponseDto data, response status code and response headers



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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/solifyn/api/collections_api.rb', line 39

def collections_add_products_with_http_info(id, add_collection_products_dto, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CollectionsApi.collections_add_products ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling CollectionsApi.collections_add_products"
  end
  # verify the required parameter 'add_collection_products_dto' is set
  if @api_client.config.client_side_validation && add_collection_products_dto.nil?
    fail ArgumentError, "Missing the required parameter 'add_collection_products_dto' when calling CollectionsApi.collections_add_products"
  end
  # resource path
  local_var_path = '/v1/collections/{id}/products'.sub('{' + 'id' + '}', CGI.escape(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']) unless header_params['Accept']
  # 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(add_collection_products_dto)

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

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

  new_options = opts.merge(
    :operation => :"CollectionsApi.collections_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: CollectionsApi#collections_add_products\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#collections_archive(id, opts = {}) ⇒ CollectionArchivedResponseDto

Archive Collection Deactivate and move a collection to archives.

Parameters:

  • id (String)

    Collection ID

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

    the optional parameters

Returns:



101
102
103
104
# File 'lib/solifyn/api/collections_api.rb', line 101

def collections_archive(id, opts = {})
  data, _status_code, _headers = collections_archive_with_http_info(id, opts)
  data
end

#collections_archive_with_http_info(id, opts = {}) ⇒ Array<(CollectionArchivedResponseDto, Integer, Hash)>

Archive Collection Deactivate and move a collection to archives.

Parameters:

  • id (String)

    Collection ID

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

    the optional parameters

Returns:



111
112
113
114
115
116
117
118
119
120
121
122
123
124
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
# File 'lib/solifyn/api/collections_api.rb', line 111

def collections_archive_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CollectionsApi.collections_archive ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling CollectionsApi.collections_archive"
  end
  # resource path
  local_var_path = '/v1/collections/{id}'.sub('{' + 'id' + '}', CGI.escape(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']) unless header_params['Accept']

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

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

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

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

  new_options = opts.merge(
    :operation => :"CollectionsApi.collections_archive",
    :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: CollectionsApi#collections_archive\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#collections_create(create_collection_dto, opts = {}) ⇒ CollectionResponseDto

Create Collection Generate a new product collection for checkout packaging.

Parameters:

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

    the optional parameters

Returns:



164
165
166
167
# File 'lib/solifyn/api/collections_api.rb', line 164

def collections_create(create_collection_dto, opts = {})
  data, _status_code, _headers = collections_create_with_http_info(create_collection_dto, opts)
  data
end

#collections_create_with_http_info(create_collection_dto, opts = {}) ⇒ Array<(CollectionResponseDto, Integer, Hash)>

Create Collection Generate a new product collection for checkout packaging.

Parameters:

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

    the optional parameters

Returns:

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

    CollectionResponseDto data, response status code and response headers



174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
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
# File 'lib/solifyn/api/collections_api.rb', line 174

def collections_create_with_http_info(create_collection_dto, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CollectionsApi.collections_create ...'
  end
  # verify the required parameter 'create_collection_dto' is set
  if @api_client.config.client_side_validation && create_collection_dto.nil?
    fail ArgumentError, "Missing the required parameter 'create_collection_dto' when calling CollectionsApi.collections_create"
  end
  # resource path
  local_var_path = '/v1/collections'

  # 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']) unless header_params['Accept']
  # 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(create_collection_dto)

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

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

  new_options = opts.merge(
    :operation => :"CollectionsApi.collections_create",
    :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: CollectionsApi#collections_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#collections_delete_product(id, product_id, opts = {}) ⇒ CollectionProductDeletedResponseDto

Remove Product from Collection Remove a product from a collection.

Parameters:

  • id (String)

    Collection ID

  • product_id (String)

    Product ID

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

    the optional parameters

Returns:



233
234
235
236
# File 'lib/solifyn/api/collections_api.rb', line 233

def collections_delete_product(id, product_id, opts = {})
  data, _status_code, _headers = collections_delete_product_with_http_info(id, product_id, opts)
  data
end

#collections_delete_product_with_http_info(id, product_id, opts = {}) ⇒ Array<(CollectionProductDeletedResponseDto, Integer, Hash)>

Remove Product from Collection Remove a product from a collection.

Parameters:

  • id (String)

    Collection ID

  • product_id (String)

    Product ID

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

    the optional parameters

Returns:



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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/solifyn/api/collections_api.rb', line 244

def collections_delete_product_with_http_info(id, product_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CollectionsApi.collections_delete_product ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling CollectionsApi.collections_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 CollectionsApi.collections_delete_product"
  end
  # resource path
  local_var_path = '/v1/collections/{id}/products/{productId}'.sub('{' + 'id' + '}', CGI.escape(id.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']) unless header_params['Accept']

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

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

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

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

  new_options = opts.merge(
    :operation => :"CollectionsApi.collections_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: CollectionsApi#collections_delete_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#collections_get(id, opts = {}) ⇒ CollectionDetailResponseDto

Retrieve Collection Get properties of a product collection by ID.

Parameters:

  • id (String)

    Collection ID

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

    the optional parameters

Returns:



301
302
303
304
# File 'lib/solifyn/api/collections_api.rb', line 301

def collections_get(id, opts = {})
  data, _status_code, _headers = collections_get_with_http_info(id, opts)
  data
end

#collections_get_with_http_info(id, opts = {}) ⇒ Array<(CollectionDetailResponseDto, Integer, Hash)>

Retrieve Collection Get properties of a product collection by ID.

Parameters:

  • id (String)

    Collection ID

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

    the optional parameters

Returns:

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

    CollectionDetailResponseDto data, response status code and response headers



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
347
348
349
350
351
352
353
354
355
356
357
# File 'lib/solifyn/api/collections_api.rb', line 311

def collections_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CollectionsApi.collections_get ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling CollectionsApi.collections_get"
  end
  # resource path
  local_var_path = '/v1/collections/{id}'.sub('{' + 'id' + '}', CGI.escape(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']) unless header_params['Accept']

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

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

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

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

  new_options = opts.merge(
    :operation => :"CollectionsApi.collections_get",
    :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: CollectionsApi#collections_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#collections_list(opts = {}) ⇒ Array<CollectionResponseDto>

List Collections Get all active product collections linked to the current active business.

Parameters:

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

    the optional parameters

Returns:



363
364
365
366
# File 'lib/solifyn/api/collections_api.rb', line 363

def collections_list(opts = {})
  data, _status_code, _headers = collections_list_with_http_info(opts)
  data
end

#collections_list_archived(opts = {}) ⇒ Array<CollectionResponseDto>

List Archived Collections Get all archived/deactivated product collections.

Parameters:

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

    the optional parameters

Returns:



420
421
422
423
# File 'lib/solifyn/api/collections_api.rb', line 420

def collections_list_archived(opts = {})
  data, _status_code, _headers = collections_list_archived_with_http_info(opts)
  data
end

#collections_list_archived_with_http_info(opts = {}) ⇒ Array<(Array<CollectionResponseDto>, Integer, Hash)>

List Archived Collections Get all archived/deactivated product collections.

Parameters:

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

    the optional parameters

Returns:

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

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



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
471
# File 'lib/solifyn/api/collections_api.rb', line 429

def collections_list_archived_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CollectionsApi.collections_list_archived ...'
  end
  # resource path
  local_var_path = '/v1/collections/archived'

  # 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']) unless header_params['Accept']

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

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

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

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

  new_options = opts.merge(
    :operation => :"CollectionsApi.collections_list_archived",
    :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: CollectionsApi#collections_list_archived\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#collections_list_with_http_info(opts = {}) ⇒ Array<(Array<CollectionResponseDto>, Integer, Hash)>

List Collections Get all active product collections linked to the current active business.

Parameters:

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

    the optional parameters

Returns:

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

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



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
405
406
407
408
409
410
411
412
413
414
# File 'lib/solifyn/api/collections_api.rb', line 372

def collections_list_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CollectionsApi.collections_list ...'
  end
  # resource path
  local_var_path = '/v1/collections'

  # 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']) unless header_params['Accept']

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

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

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

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

  new_options = opts.merge(
    :operation => :"CollectionsApi.collections_list",
    :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: CollectionsApi#collections_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#collections_unarchive(id, opts = {}) ⇒ CollectionUnarchivedResponseDto

Unarchive Collection Restore an archived collection back to active status.

Parameters:

  • id (String)

    Collection ID

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

    the optional parameters

Returns:



478
479
480
481
# File 'lib/solifyn/api/collections_api.rb', line 478

def collections_unarchive(id, opts = {})
  data, _status_code, _headers = collections_unarchive_with_http_info(id, opts)
  data
end

#collections_unarchive_with_http_info(id, opts = {}) ⇒ Array<(CollectionUnarchivedResponseDto, Integer, Hash)>

Unarchive Collection Restore an archived collection back to active status.

Parameters:

  • id (String)

    Collection ID

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

    the optional parameters

Returns:



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
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
# File 'lib/solifyn/api/collections_api.rb', line 488

def collections_unarchive_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CollectionsApi.collections_unarchive ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling CollectionsApi.collections_unarchive"
  end
  # resource path
  local_var_path = '/v1/collections/{id}/unarchive'.sub('{' + 'id' + '}', CGI.escape(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']) unless header_params['Accept']

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

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

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

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

  new_options = opts.merge(
    :operation => :"CollectionsApi.collections_unarchive",
    :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: CollectionsApi#collections_unarchive\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#collections_update(id, update_collection_dto, opts = {}) ⇒ CollectionUpdatedResponseDto

Update Collection Update products, friendly name, status, or description of a collection.

Parameters:

  • id (String)

    Collection ID

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

    the optional parameters

Returns:



542
543
544
545
# File 'lib/solifyn/api/collections_api.rb', line 542

def collections_update(id, update_collection_dto, opts = {})
  data, _status_code, _headers = collections_update_with_http_info(id, update_collection_dto, opts)
  data
end

#collections_update_product(id, product_id, update_collection_product_dto, opts = {}) ⇒ CollectionProductUpdatedResponseDto

Update Collection Product Update quantity of a specific product inside a collection.

Parameters:

  • id (String)

    Collection ID

  • product_id (String)

    Product ID

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

    the optional parameters

Returns:



617
618
619
620
# File 'lib/solifyn/api/collections_api.rb', line 617

def collections_update_product(id, product_id, update_collection_product_dto, opts = {})
  data, _status_code, _headers = collections_update_product_with_http_info(id, product_id, update_collection_product_dto, opts)
  data
end

#collections_update_product_with_http_info(id, product_id, update_collection_product_dto, opts = {}) ⇒ Array<(CollectionProductUpdatedResponseDto, Integer, Hash)>

Update Collection Product Update quantity of a specific product inside a collection.

Parameters:

  • id (String)

    Collection ID

  • product_id (String)

    Product ID

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

    the optional parameters

Returns:



629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
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
# File 'lib/solifyn/api/collections_api.rb', line 629

def collections_update_product_with_http_info(id, product_id, update_collection_product_dto, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CollectionsApi.collections_update_product ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling CollectionsApi.collections_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 CollectionsApi.collections_update_product"
  end
  # verify the required parameter 'update_collection_product_dto' is set
  if @api_client.config.client_side_validation && update_collection_product_dto.nil?
    fail ArgumentError, "Missing the required parameter 'update_collection_product_dto' when calling CollectionsApi.collections_update_product"
  end
  # resource path
  local_var_path = '/v1/collections/{id}/products/{productId}'.sub('{' + 'id' + '}', CGI.escape(id.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']) unless header_params['Accept']
  # 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(update_collection_product_dto)

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

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

  new_options = opts.merge(
    :operation => :"CollectionsApi.collections_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: CollectionsApi#collections_update_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#collections_update_with_http_info(id, update_collection_dto, opts = {}) ⇒ Array<(CollectionUpdatedResponseDto, Integer, Hash)>

Update Collection Update products, friendly name, status, or description of a collection.

Parameters:

  • id (String)

    Collection ID

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

    the optional parameters

Returns:



553
554
555
556
557
558
559
560
561
562
563
564
565
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
603
604
605
606
607
608
# File 'lib/solifyn/api/collections_api.rb', line 553

def collections_update_with_http_info(id, update_collection_dto, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CollectionsApi.collections_update ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling CollectionsApi.collections_update"
  end
  # verify the required parameter 'update_collection_dto' is set
  if @api_client.config.client_side_validation && update_collection_dto.nil?
    fail ArgumentError, "Missing the required parameter 'update_collection_dto' when calling CollectionsApi.collections_update"
  end
  # resource path
  local_var_path = '/v1/collections/{id}'.sub('{' + 'id' + '}', CGI.escape(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']) unless header_params['Accept']
  # 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(update_collection_dto)

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

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

  new_options = opts.merge(
    :operation => :"CollectionsApi.collections_update",
    :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: CollectionsApi#collections_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end