class Bfwd::ProductsApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/bf_ruby2/api/products_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

create_product(product, opts = {}) click to toggle source

Create a product. {"nickname":"Create a new product","request":"createProductRequest.html","response":"createProductResponse.html"} @param product The product object to be updated. @param [Hash] opts the optional parameters @return [ProductPagedMetadata]

# File lib/bf_ruby2/api/products_api.rb, line 28
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 = {}) click to toggle source

Create a product. {&quot;nickname&quot;:&quot;Create a new product&quot;,&quot;request&quot;:&quot;createProductRequest.html&quot;,&quot;response&quot;:&quot;createProductResponse.html&quot;} @param product The product object to be updated. @param [Hash] opts the optional parameters @return [Array<(ProductPagedMetadata, Fixnum, Hash)>] ProductPagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/products_api.rb, line 38
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
  if @api_client.config.client_side_validation && product.nil?
    fail ArgumentError, "Missing the required parameter 'product' when calling ProductsApi.create_product"
  end
  # resource path
  local_var_path = "/products"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/xml', 'application/xml', 'application/json; charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=utf-8'])

  # 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 = {}) click to toggle source

Remove any associated metadata. {"nickname":"Clear metadata from product","request" :"deleteProductMetadataRequest.html","response":"deleteProductMetadataResponse.html"} @param product_id @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [DynamicMetadata]

# File lib/bf_ruby2/api/products_api.rb, line 84
def delete_metadata_for_product(product_id, opts = {})
  data, _status_code, _headers = delete_metadata_for_product_with_http_info(product_id, opts)
  return data
end
delete_metadata_for_product_with_http_info(product_id, opts = {}) click to toggle source

Remove any associated metadata. {&quot;nickname&quot;:&quot;Clear metadata from product&quot;,&quot;request&quot; :&quot;deleteProductMetadataRequest.html&quot;,&quot;response&quot;:&quot;deleteProductMetadataResponse.html&quot;} @param product_id @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [Array<(DynamicMetadata, Fixnum, Hash)>] DynamicMetadata data, response status code and response headers

# File lib/bf_ruby2/api/products_api.rb, line 95
def delete_metadata_for_product_with_http_info(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
  if @api_client.config.client_side_validation && product_id.nil?
    fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.delete_metadata_for_product"
  end
  # resource path
  local_var_path = "/products/{product-ID}/metadata".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)
  header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['text/plain', 'application/json; charset=utf-8'])

  # 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 = {}) click to toggle source

Returns a collection of products. By default 10 values are returned. Records are returned in natural order. {"nickname":"Get all products","response":"getProductAll.html"} @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @option opts [Integer] :offset The offset from the first product to return. (default to 0) @option opts [Integer] :records The maximum number of products to return. (default to 10) @option opts [String] :order_by Specify a field used to order the result set. (default to created) @option opts [String] :order Ihe direction of any ordering, either ASC or DESC. (default to DESC) @option opts [BOOLEAN] :include_retired Whether retired products should be returned. (default to true) @option opts [String] :metadata @return [ProductPagedMetadata]

# File lib/bf_ruby2/api/products_api.rb, line 147
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 = {}) click to toggle source

Returns a collection of products. By default 10 values are returned. Records are returned in natural order. {&quot;nickname&quot;:&quot;Get all products&quot;,&quot;response&quot;:&quot;getProductAll.html&quot;} @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @option opts [Integer] :offset The offset from the first product to return. @option opts [Integer] :records The maximum number of products to return. @option opts [String] :order_by Specify a field used to order the result set. @option opts [String] :order Ihe direction of any ordering, either ASC or DESC. @option opts [BOOLEAN] :include_retired Whether retired products should be returned. @option opts [String] :metadata @return [Array<(ProductPagedMetadata, Fixnum, Hash)>] ProductPagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/products_api.rb, line 163
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 @api_client.config.client_side_validation && 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"

  # 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)
  header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8', 'text/plain'])

  # 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 = {}) click to toggle source

Retrieve any associated metadata. {"nickname":"Retrieve metadata on product","request":"getProductMetadataRequest.html","response":"getProductMetadataResponse.html"} @param product_id @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [DynamicMetadata]

# File lib/bf_ruby2/api/products_api.rb, line 213
def get_metadata_for_product(product_id, opts = {})
  data, _status_code, _headers = get_metadata_for_product_with_http_info(product_id, opts)
  return data
end
get_metadata_for_product_with_http_info(product_id, opts = {}) click to toggle source

Retrieve any associated metadata. {&quot;nickname&quot;:&quot;Retrieve metadata on product&quot;,&quot;request&quot;:&quot;getProductMetadataRequest.html&quot;,&quot;response&quot;:&quot;getProductMetadataResponse.html&quot;} @param product_id @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [Array<(DynamicMetadata, Fixnum, Hash)>] DynamicMetadata data, response status code and response headers

# File lib/bf_ruby2/api/products_api.rb, line 224
def get_metadata_for_product_with_http_info(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
  if @api_client.config.client_side_validation && product_id.nil?
    fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.get_metadata_for_product"
  end
  # resource path
  local_var_path = "/products/{product-ID}/metadata".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)
  header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=utf-8', 'text/plain'])

  # 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 = {}) click to toggle source

Returns a single product, specified by the product-ID parameter. {"nickname":"Retrieve an existing product","response":"getProductByID.html"} @param product_id ID or name of the product. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @option opts [Integer] :offset The offset from the first product-rate-plan to return. (default to 0) @option opts [Integer] :records The maximum number of product-rate-plans to return. (default to 10) @option opts [String] :order_by Specify a field used to order the result set. (default to created) @option opts [String] :order Ihe direction of any ordering, either ASC or DESC. (default to DESC) @option opts [BOOLEAN] :include_retired Whether retired products should be returned. (default to true) @return [ProductPagedMetadata]

# File lib/bf_ruby2/api/products_api.rb, line 276
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 = {}) click to toggle source

Returns a single product, specified by the product-ID parameter. {&quot;nickname&quot;:&quot;Retrieve an existing product&quot;,&quot;response&quot;:&quot;getProductByID.html&quot;} @param product_id ID or name of the product. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @option opts [Integer] :offset The offset from the first product-rate-plan to return. @option opts [Integer] :records The maximum number of product-rate-plans to return. @option opts [String] :order_by Specify a field used to order the result set. @option opts [String] :order Ihe direction of any ordering, either ASC or DESC. @option opts [BOOLEAN] :include_retired Whether retired products should be returned. @return [Array<(ProductPagedMetadata, Fixnum, Hash)>] ProductPagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/products_api.rb, line 292
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
  if @api_client.config.client_side_validation && product_id.nil?
    fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.get_product_by_id"
  end
  if @api_client.config.client_side_validation && 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('{' + '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)
  header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['text/plain', 'application/json; charset=utf-8'])

  # 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 = {}) click to toggle source

Deletes the product specified by the product-ID parameter. Any existing subscriptions will continue; it is a soft delete. {"nickname":"Delete a product","response":"deleteProduct.html"} @param product_id ID of the Product. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [ProductPagedMetadata]

# File lib/bf_ruby2/api/products_api.rb, line 347
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 = {}) click to toggle source

Deletes the product specified by the product-ID parameter. Any existing subscriptions will continue; it is a soft delete. {&quot;nickname&quot;:&quot;Delete a product&quot;,&quot;response&quot;:&quot;deleteProduct.html&quot;} @param product_id ID of the Product. @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [Array<(ProductPagedMetadata, Fixnum, Hash)>] ProductPagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/products_api.rb, line 358
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
  if @api_client.config.client_side_validation && product_id.nil?
    fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductsApi.retire_product"
  end
  # resource path
  local_var_path = "/products/{product-ID}".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)
  header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['text/plain', 'application/json; charset=utf-8'])

  # 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 = {}) click to toggle source

Remove any existing metadata keys and create the provided data. {"nickname":"Set metadata on product","request":"setProductMetadataRequest.html","response":"setProductMetadataResponse.html"} @param metadata @param product_id @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [DynamicMetadata]

# File lib/bf_ruby2/api/products_api.rb, line 406
def set_metadata_for_product(metadata, product_id, opts = {})
  data, _status_code, _headers = set_metadata_for_product_with_http_info(metadata, product_id, opts)
  return data
end
set_metadata_for_product_with_http_info(metadata, product_id, opts = {}) click to toggle source

Remove any existing metadata keys and create the provided data. {&quot;nickname&quot;:&quot;Set metadata on product&quot;,&quot;request&quot;:&quot;setProductMetadataRequest.html&quot;,&quot;response&quot;:&quot;setProductMetadataResponse.html&quot;} @param metadata @param product_id @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [Array<(DynamicMetadata, Fixnum, Hash)>] DynamicMetadata data, response status code and response headers

# File lib/bf_ruby2/api/products_api.rb, line 418
def set_metadata_for_product_with_http_info(metadata, 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
  if @api_client.config.client_side_validation && metadata.nil?
    fail ArgumentError, "Missing the required parameter 'metadata' when calling ProductsApi.set_metadata_for_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.set_metadata_for_product"
  end
  # resource path
  local_var_path = "/products/{product-ID}/metadata".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)
  header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=utf-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(metadata)
  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 = {}) click to toggle source

Update a product. {"nickname":"Update a product","request":"updateProductRequest.html","response":"updateProductResponse.html"} @param product The product object to be updated. @param [Hash] opts the optional parameters @return [ProductPagedMetadata]

# File lib/bf_ruby2/api/products_api.rb, line 468
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 = {}) click to toggle source

Update a product. {&quot;nickname&quot;:&quot;Update a product&quot;,&quot;request&quot;:&quot;updateProductRequest.html&quot;,&quot;response&quot;:&quot;updateProductResponse.html&quot;} @param product The product object to be updated. @param [Hash] opts the optional parameters @return [Array<(ProductPagedMetadata, Fixnum, Hash)>] ProductPagedMetadata data, response status code and response headers

# File lib/bf_ruby2/api/products_api.rb, line 478
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
  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 = "/products"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['text/xml', 'application/xml', 'application/json; charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=utf-8'])

  # 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 = {}) click to toggle source

Update any existing metadata key-values and insert any new key-values, no keys will be removed. {"nickname":"Upsert metadata on product","request":"upsertProductMetadataRequest.html","response":"upsertProductMetadataResponse.html"} @param metadata @param product_id @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [DynamicMetadata]

# File lib/bf_ruby2/api/products_api.rb, line 525
def upsert_metadata_for_product(metadata, product_id, opts = {})
  data, _status_code, _headers = upsert_metadata_for_product_with_http_info(metadata, product_id, opts)
  return data
end
upsert_metadata_for_product_with_http_info(metadata, product_id, opts = {}) click to toggle source

Update any existing metadata key-values and insert any new key-values, no keys will be removed. {&quot;nickname&quot;:&quot;Upsert metadata on product&quot;,&quot;request&quot;:&quot;upsertProductMetadataRequest.html&quot;,&quot;response&quot;:&quot;upsertProductMetadataResponse.html&quot;} @param metadata @param product_id @param [Hash] opts the optional parameters @option opts [Array<String>] :organizations A list of organization-IDs used to restrict the scope of API calls. @return [Array<(DynamicMetadata, Fixnum, Hash)>] DynamicMetadata data, response status code and response headers

# File lib/bf_ruby2/api/products_api.rb, line 537
def upsert_metadata_for_product_with_http_info(metadata, 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
  if @api_client.config.client_side_validation && metadata.nil?
    fail ArgumentError, "Missing the required parameter 'metadata' when calling ProductsApi.upsert_metadata_for_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.upsert_metadata_for_product"
  end
  # resource path
  local_var_path = "/products/{product-ID}/metadata".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)
  header_params['Accept'] = @api_client.select_header_accept(['application/json; charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=utf-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(metadata)
  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