lib/ibm_watson/visual_recognition_v3.rb
def update_classifier(classifier_id:, positive_examples: nil, negative_examples: nil, negative_examples_filename: nil)
      raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?

      raise ArgumentError.new("positive_examples must be a hash") unless positive_examples.nil? || positive_examples.is_a?(Hash)

      headers = {
      }
      sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V3", "update_classifier")
      headers.merge!(sdk_headers)

      params = {
        "version" => @version
      }

      form_data = {}

      positive_examples&.each do |key, value|
        part_name = "%s_positive_examples" % key.to_s
        unless value.instance_of?(StringIO) || value.instance_of?(File)
          value = value.respond_to?(:to_json) ? StringIO.new(value.to_json) : StringIO.new(value)
        end
        filename = value.path if value.respond_to?(:path)
        form_data[part_name.to_sym] = HTTP::FormData::File.new(value, content_type: "application/octet-stream", filename: filename)
      end

      unless negative_examples.nil?
        unless negative_examples.instance_of?(StringIO) || negative_examples.instance_of?(File)
          negative_examples = negative_examples.respond_to?(:to_json) ? StringIO.new(negative_examples.to_json) : StringIO.new(negative_examples)
        end
        negative_examples_filename = negative_examples.path if negative_examples_filename.nil? && negative_examples.respond_to?(:path)
        form_data[:negative_examples] = HTTP::FormData::File.new(negative_examples, content_type: "application/octet-stream", filename: negative_examples_filename)
      end

      method_url = "/v3/classifiers/%s" % [ERB::Util.url_encode(classifier_id)]

      response = request(
        method: "POST",
        url: method_url,
        headers: headers,
        params: params,
        form: form_data,
        accept_json: true
      )
      response
    end
def update_classifier(classifier_id:, positive_examples: nil, negative_examples: nil, negative_examples_filename: nil)
      raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?

      raise ArgumentError.new("positive_examples must be a hash") unless positive_examples.nil? || positive_examples.is_a?(Hash)

      headers = {
      }
      sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V3", "update_classifier")
      headers.merge!(sdk_headers)

      params = {
        "version" => @version
      }

      form_data = {}

      positive_examples&.each do |key, value|
        part_name = "%s_positive_examples" % key.to_s
        unless value.instance_of?(StringIO) || value.instance_of?(File)
          value = value.respond_to?(:to_json) ? StringIO.new(value.to_json) : StringIO.new(value)
        end
        filename = value.path if value.respond_to?(:path)
        form_data[part_name.to_sym] = HTTP::FormData::File.new(value, content_type: "application/octet-stream", filename: filename)
      end

      unless negative_examples.nil?
        unless negative_examples.instance_of?(StringIO) || negative_examples.instance_of?(File)
          negative_examples = negative_examples.respond_to?(:to_json) ? StringIO.new(negative_examples.to_json) : StringIO.new(negative_examples)
        end
        negative_examples_filename = negative_examples.path if negative_examples_filename.nil? && negative_examples.respond_to?(:path)
        form_data[:negative_examples] = HTTP::FormData::File.new(negative_examples, content_type: "application/octet-stream", filename: negative_examples_filename)
      end

      method_url = "/v3/classifiers/%s" % [ERB::Util.url_encode(classifier_id)]

      response = request(
        method: "POST",
        url: method_url,
        headers: headers,
        params: params,
        form: form_data,
        accept_json: true
      )
      response
    end
@!method update_classifier(classifier_id:, positive_examples: nil, negative_examples: nil, negative_examples_filename: nil)
 Update a classifier.
 Update a custom classifier by adding new positive or negative classes or by adding
   new images to existing classes. You must supply at least one set of positive or
   negative examples. For details, see [Updating custom
   classifiers](https://cloud.ibm.com/docs/services/visual-recognition/customizing.html#updating-custom-classifiers).

   Encode all names in UTF-8 if they contain non-ASCII characters (.zip and image
   file names, and classifier and class names). The service assumes UTF-8 encoding if
   it encounters non-ASCII characters.

   **Tip:** Don't make retraining calls on a classifier until the status is ready.
   When you submit retraining requests in parallel, the last request overwrites the
   previous requests. The retrained property shows the last time the classifier
   retraining finished.
 @param classifier_id [String] The ID of the classifier.
 @param positive_examples [File] A .zip file of images that depict the visual subject of a class in the classifier.
   The positive examples create or update classes in the classifier. You can include
   more than one positive example file in a call.

   Specify the parameter name by appending `_positive_examples` to the class name.
   For example, `goldenretriever_positive_examples` creates the class
   `goldenretriever`.

   Include at least 10 images in .jpg or .png format. The minimum recommended image
   resolution is 32X32 pixels. The maximum number of images is 10,000 images or 100
   MB per .zip file.

   Encode special characters in the file name in UTF-8.
 @param negative_examples [File] A .zip file of images that do not depict the visual subject of any of the classes
   of the new classifier. Must contain a minimum of 10 images.

   Encode special characters in the file name in UTF-8.
 @param negative_examples_filename [String] The filename for negative_examples.
 @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.