Class: BillForward::ProductsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/bf_ruby2/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.



30
31
32
# File 'lib/bf_ruby2/api/products_api.rb', line 30

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



28
29
30
# File 'lib/bf_ruby2/api/products_api.rb', line 28

def api_client
  @api_client
end

Instance Method Details

#create_product(product, opts = {}) ⇒ ProductPagedMetadata

Create a product. a new product","request":"createProductRequest.html","response":"createProductResponse.html"

Parameters:

  • product

    The product object to be updated.

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

    the optional parameters

Returns:



39
40
41
42
# File 'lib/bf_ruby2/api/products_api.rb', line 39

def create_product(product, opts = {})
  data, _status_code, _headers = create_product_with_http_info(product, opts)
  return data
end

#create_product_with_http_info(product, opts = {}) ⇒ Array<(ProductPagedMetadata, Fixnum, Hash)>

Create a product. a new product&quot;,&quot;request&quot;:&quot;createProductRequest.html&quot;,&quot;response&quot;:&quot;createProductResponse.html&quot;

Parameters:

  • product

    The product object to be updated.

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

    the optional parameters

Returns:

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

    ProductPagedMetadata data, response status code and response headers



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
# File 'lib/bf_ruby2/api/products_api.rb', line 49

def create_product_with_http_info(product, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ProductsApi.create_product ..."
  end
  # verify the required parameter 'product' is set
  fail ArgumentError, "Missing the required parameter 'product' when calling ProductsApi.create_product" if product.nil?
  # resource path
  local_var_path = "/products".sub('{format}','json')

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['text/xml', 'application/xml', 'application/json; charset=utf-8']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json; charset=utf-8']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(product)
  auth_names = []
  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 => 'ProductPagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#create_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_metadata_for_product(product_id, opts = {}) ⇒ DynamicMetadata

Remove any associated metadata. metadata from product","request" :"deleteProductMetadataRequest.html","response":"deleteProductMetadataResponse.html"

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :organizations (Array<String>)

    A list of organization-IDs used to restrict the scope of API calls.

Returns:



97
98
99
100
# File 'lib/bf_ruby2/api/products_api.rb', line 97

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

#delete_metadata_for_product_with_http_info(product_id, opts = {}) ⇒ Array<(DynamicMetadata, Fixnum, Hash)>

Remove any associated metadata. metadata from product&quot;,&quot;request&quot; :&quot;deleteProductMetadataRequest.html&quot;,&quot;response&quot;:&quot;deleteProductMetadataResponse.html&quot;

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :organizations (Array<String>)

    A list of organization-IDs used to restrict the scope of API calls.

Returns:

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

    DynamicMetadata data, response status code and response headers



108
109
110
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
# File 'lib/bf_ruby2/api/products_api.rb', line 108

def (product_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ProductsApi.delete_metadata_for_product ..."
  end
  # verify the required parameter 'product_id' is set
  fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.delete_metadata_for_product" if product_id.nil?
  # resource path
  local_var_path = "/products/{product-ID}/metadata".sub('{format}','json').sub('{' + 'product-ID' + '}', product_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil?

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json; charset=utf-8']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['text/plain', 'application/json; charset=utf-8']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  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 => 'DynamicMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#delete_metadata_for_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_all_products(opts = {}) ⇒ ProductPagedMetadata

Returns a collection of products. By default 10 values are returned. Records are returned in natural order. all products","response":"getProductAll.html"

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :organizations (Array<String>)

    A list of organization-IDs used to restrict the scope of API calls.

  • :offset (Integer)

    The offset from the first product to return. (default to 0)

  • :records (Integer)

    The maximum number of products to return. (default to 10)

  • :order_by (String)

    Specify a field used to order the result set. (default to created)

  • :order (String)

    Ihe direction of any ordering, either ASC or DESC. (default to DESC)

  • :include_retired (BOOLEAN)

    Whether retired products should be returned. (default to true)

  • :metadata (String)

Returns:



162
163
164
165
# File 'lib/bf_ruby2/api/products_api.rb', line 162

def get_all_products(opts = {})
  data, _status_code, _headers = get_all_products_with_http_info(opts)
  return data
end

#get_all_products_with_http_info(opts = {}) ⇒ Array<(ProductPagedMetadata, Fixnum, Hash)>

Returns a collection of products. By default 10 values are returned. Records are returned in natural order. all products&quot;,&quot;response&quot;:&quot;getProductAll.html&quot;

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :organizations (Array<String>)

    A list of organization-IDs used to restrict the scope of API calls.

  • :offset (Integer)

    The offset from the first product to return.

  • :records (Integer)

    The maximum number of products to return.

  • :order_by (String)

    Specify a field used to order the result set.

  • :order (String)

    Ihe direction of any ordering, either ASC or DESC.

  • :include_retired (BOOLEAN)

    Whether retired products should be returned.

  • :metadata (String)

Returns:

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

    ProductPagedMetadata data, response status code and response headers



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
226
# File 'lib/bf_ruby2/api/products_api.rb', line 178

def get_all_products_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ProductsApi.get_all_products ..."
  end
  if opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order'])
    fail ArgumentError, 'invalid value for "order", must be one of ASC, DESC'
  end
  # resource path
  local_var_path = "/products".sub('{format}','json')

  # query parameters
  query_params = {}
  query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'records'] = opts[:'records'] if !opts[:'records'].nil?
  query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
  query_params[:'include_retired'] = opts[:'include_retired'] if !opts[:'include_retired'].nil?
  query_params[:'metadata'] = opts[:'metadata'] if !opts[:'metadata'].nil?

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json; charset=utf-8', 'text/plain']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = []
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  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 => 'ProductPagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#get_all_products\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_metadata_for_product(product_id, opts = {}) ⇒ DynamicMetadata

Retrieve any associated metadata. metadata on product","request":"getProductMetadataRequest.html","response":"getProductMetadataResponse.html"

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :organizations (Array<String>)

    A list of organization-IDs used to restrict the scope of API calls.

Returns:



234
235
236
237
# File 'lib/bf_ruby2/api/products_api.rb', line 234

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

#get_metadata_for_product_with_http_info(product_id, opts = {}) ⇒ Array<(DynamicMetadata, Fixnum, Hash)>

Retrieve any associated metadata. metadata on product&quot;,&quot;request&quot;:&quot;getProductMetadataRequest.html&quot;,&quot;response&quot;:&quot;getProductMetadataResponse.html&quot;

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :organizations (Array<String>)

    A list of organization-IDs used to restrict the scope of API calls.

Returns:

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

    DynamicMetadata data, response status code and response headers



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
# File 'lib/bf_ruby2/api/products_api.rb', line 245

def (product_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ProductsApi.get_metadata_for_product ..."
  end
  # verify the required parameter 'product_id' is set
  fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.get_metadata_for_product" if product_id.nil?
  # resource path
  local_var_path = "/products/{product-ID}/metadata".sub('{format}','json').sub('{' + 'product-ID' + '}', product_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil?

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json; charset=utf-8']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json; charset=utf-8', 'text/plain']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  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 => 'DynamicMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#get_metadata_for_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_product_by_id(product_id, opts = {}) ⇒ ProductPagedMetadata

Returns a single product, specified by the product-ID parameter. an existing product","response":"getProductByID.html"

Parameters:

  • product_id

    ID or name of the product.

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

    the optional parameters

Options Hash (opts):

  • :organizations (Array<String>)

    A list of organization-IDs used to restrict the scope of API calls.

  • :offset (Integer)

    The offset from the first product-rate-plan to return. (default to 0)

  • :records (Integer)

    The maximum number of product-rate-plans to return. (default to 10)

  • :order_by (String)

    Specify a field used to order the result set. (default to created)

  • :order (String)

    Ihe direction of any ordering, either ASC or DESC. (default to DESC)

  • :include_retired (BOOLEAN)

    Whether retired products should be returned. (default to true)

Returns:



299
300
301
302
# File 'lib/bf_ruby2/api/products_api.rb', line 299

def get_product_by_id(product_id, opts = {})
  data, _status_code, _headers = get_product_by_id_with_http_info(product_id, opts)
  return data
end

#get_product_by_id_with_http_info(product_id, opts = {}) ⇒ Array<(ProductPagedMetadata, Fixnum, Hash)>

Returns a single product, specified by the product-ID parameter. an existing product&quot;,&quot;response&quot;:&quot;getProductByID.html&quot;

Parameters:

  • product_id

    ID or name of the product.

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

    the optional parameters

Options Hash (opts):

  • :organizations (Array<String>)

    A list of organization-IDs used to restrict the scope of API calls.

  • :offset (Integer)

    The offset from the first product-rate-plan to return.

  • :records (Integer)

    The maximum number of product-rate-plans to return.

  • :order_by (String)

    Specify a field used to order the result set.

  • :order (String)

    Ihe direction of any ordering, either ASC or DESC.

  • :include_retired (BOOLEAN)

    Whether retired products should be returned.

Returns:

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

    ProductPagedMetadata data, response status code and response headers



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
358
359
360
361
362
363
364
# File 'lib/bf_ruby2/api/products_api.rb', line 315

def get_product_by_id_with_http_info(product_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ProductsApi.get_product_by_id ..."
  end
  # verify the required parameter 'product_id' is set
  fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.get_product_by_id" if product_id.nil?
  if opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order'])
    fail ArgumentError, 'invalid value for "order", must be one of ASC, DESC'
  end
  # resource path
  local_var_path = "/products/{product-ID}".sub('{format}','json').sub('{' + 'product-ID' + '}', product_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'records'] = opts[:'records'] if !opts[:'records'].nil?
  query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
  query_params[:'include_retired'] = opts[:'include_retired'] if !opts[:'include_retired'].nil?

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json; charset=utf-8']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['text/plain', 'application/json; charset=utf-8']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  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 => 'ProductPagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#get_product_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#retire_product(product_id, opts = {}) ⇒ ProductPagedMetadata

Deletes the product specified by the product-ID parameter. Any existing subscriptions will continue; it is a soft delete. a product","response":"deleteProduct.html"

Parameters:

  • product_id

    ID of the Product.

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

    the optional parameters

Options Hash (opts):

  • :organizations (Array<String>)

    A list of organization-IDs used to restrict the scope of API calls.

Returns:



372
373
374
375
# File 'lib/bf_ruby2/api/products_api.rb', line 372

def retire_product(product_id, opts = {})
  data, _status_code, _headers = retire_product_with_http_info(product_id, opts)
  return data
end

#retire_product_with_http_info(product_id, opts = {}) ⇒ Array<(ProductPagedMetadata, Fixnum, Hash)>

Deletes the product specified by the product-ID parameter. Any existing subscriptions will continue; it is a soft delete. a product&quot;,&quot;response&quot;:&quot;deleteProduct.html&quot;

Parameters:

  • product_id

    ID of the Product.

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

    the optional parameters

Options Hash (opts):

  • :organizations (Array<String>)

    A list of organization-IDs used to restrict the scope of API calls.

Returns:

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

    ProductPagedMetadata data, response status code and response headers



383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
# File 'lib/bf_ruby2/api/products_api.rb', line 383

def retire_product_with_http_info(product_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ProductsApi.retire_product ..."
  end
  # verify the required parameter 'product_id' is set
  fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.retire_product" if product_id.nil?
  # resource path
  local_var_path = "/products/{product-ID}".sub('{format}','json').sub('{' + 'product-ID' + '}', product_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil?

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json; charset=utf-8']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['text/plain', 'application/json; charset=utf-8']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = []
  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 => 'ProductPagedMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#retire_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#set_metadata_for_product(metadata, product_id, opts = {}) ⇒ DynamicMetadata

Remove any existing metadata keys and create the provided data. metadata on product","request":"setProductMetadataRequest.html","response":"setProductMetadataResponse.html"

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :organizations (Array<String>)

    A list of organization-IDs used to restrict the scope of API calls.

Returns:



433
434
435
436
# File 'lib/bf_ruby2/api/products_api.rb', line 433

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

#set_metadata_for_product_with_http_info(metadata, product_id, opts = {}) ⇒ Array<(DynamicMetadata, Fixnum, Hash)>

Remove any existing metadata keys and create the provided data. metadata on product&quot;,&quot;request&quot;:&quot;setProductMetadataRequest.html&quot;,&quot;response&quot;:&quot;setProductMetadataResponse.html&quot;

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :organizations (Array<String>)

    A list of organization-IDs used to restrict the scope of API calls.

Returns:

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

    DynamicMetadata data, response status code and response headers



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
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
# File 'lib/bf_ruby2/api/products_api.rb', line 445

def (, product_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ProductsApi.set_metadata_for_product ..."
  end
  # verify the required parameter 'metadata' is set
  fail ArgumentError, "Missing the required parameter 'metadata' when calling ProductsApi.set_metadata_for_product" if .nil?
  # verify the required parameter 'product_id' is set
  fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.set_metadata_for_product" if product_id.nil?
  # resource path
  local_var_path = "/products/{product-ID}/metadata".sub('{format}','json').sub('{' + 'product-ID' + '}', product_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil?

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json; charset=utf-8']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json; charset=utf-8']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body()
  auth_names = []
  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 => 'DynamicMetadata')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProductsApi#set_metadata_for_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_product(product, opts = {}) ⇒ ProductPagedMetadata

Update a product. a product","request":"updateProductRequest.html","response":"updateProductResponse.html"

Parameters:

  • product

    The product object to be updated.

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

    the optional parameters

Returns:



495
496
497
498
# File 'lib/bf_ruby2/api/products_api.rb', line 495

def update_product(product, opts = {})
  data, _status_code, _headers = update_product_with_http_info(product, opts)
  return data
end

#update_product_with_http_info(product, opts = {}) ⇒ Array<(ProductPagedMetadata, Fixnum, Hash)>

Update a product. a product&quot;,&quot;request&quot;:&quot;updateProductRequest.html&quot;,&quot;response&quot;:&quot;updateProductResponse.html&quot;

Parameters:

  • product

    The product object to be updated.

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

    the optional parameters

Returns:

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

    ProductPagedMetadata data, response status code and response headers



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
535
536
537
538
539
540
541
542
543
544
545
# File 'lib/bf_ruby2/api/products_api.rb', line 505

def update_product_with_http_info(product, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ProductsApi.update_product ..."
  end
  # verify the required parameter 'product' is set
  fail ArgumentError, "Missing the required parameter 'product' when calling ProductsApi.update_product" if product.nil?
  # resource path
  local_var_path = "/products".sub('{format}','json')

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['text/xml', 'application/xml', 'application/json; charset=utf-8']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json; charset=utf-8']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(product)
  auth_names = []
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ProductPagedMetadata')
  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

#upsert_metadata_for_product(metadata, product_id, opts = {}) ⇒ DynamicMetadata

Update any existing metadata key-values and insert any new key-values, no keys will be removed. metadata on product","request":"upsertProductMetadataRequest.html","response":"upsertProductMetadataResponse.html"

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :organizations (Array<String>)

    A list of organization-IDs used to restrict the scope of API calls.

Returns:



554
555
556
557
# File 'lib/bf_ruby2/api/products_api.rb', line 554

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

#upsert_metadata_for_product_with_http_info(metadata, product_id, opts = {}) ⇒ Array<(DynamicMetadata, Fixnum, Hash)>

Update any existing metadata key-values and insert any new key-values, no keys will be removed. metadata on product&quot;,&quot;request&quot;:&quot;upsertProductMetadataRequest.html&quot;,&quot;response&quot;:&quot;upsertProductMetadataResponse.html&quot;

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :organizations (Array<String>)

    A list of organization-IDs used to restrict the scope of API calls.

Returns:

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

    DynamicMetadata data, response status code and response headers



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
609
# File 'lib/bf_ruby2/api/products_api.rb', line 566

def (, product_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ProductsApi.upsert_metadata_for_product ..."
  end
  # verify the required parameter 'metadata' is set
  fail ArgumentError, "Missing the required parameter 'metadata' when calling ProductsApi.upsert_metadata_for_product" if .nil?
  # verify the required parameter 'product_id' is set
  fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.upsert_metadata_for_product" if product_id.nil?
  # resource path
  local_var_path = "/products/{product-ID}/metadata".sub('{format}','json').sub('{' + 'product-ID' + '}', product_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'organizations'] = @api_client.build_collection_param(opts[:'organizations'], :multi) if !opts[:'organizations'].nil?

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  local_header_accept = ['application/json; charset=utf-8']
  local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result

  # HTTP header 'Content-Type'
  local_header_content_type = ['application/json; charset=utf-8']
  header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)

  # form parameters
  form_params = {}

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