lib/ibm_watson/visual_recognition_v3.rb
def classify(images_file: nil, images_filename: nil, images_file_content_type: nil, url: nil, threshold: nil, owners: nil, classifier_ids: nil, accept_language: nil)
      headers = {
        "Accept-Language" => accept_language
      }
      sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V3", "classify")
      headers.merge!(sdk_headers)

      params = {
        "version" => @version
      }

      form_data = {}

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

      classifier_ids *= "," unless classifier_ids.nil?
      owners *= "," unless owners.nil?

      form_data[:url] = HTTP::FormData::Part.new(url.to_s, content_type: "text/plain") unless url.nil?

      form_data[:threshold] = HTTP::FormData::Part.new(threshold.to_s, content_type: "application/json") unless threshold.nil?

      form_data[:owners] = HTTP::FormData::Part.new(owners, content_type: "application/json") unless owners.nil?

      form_data[:classifier_ids] = HTTP::FormData::Part.new(classifier_ids, content_type: "application/json") unless classifier_ids.nil?

      method_url = "/v3/classify"

      response = request(
        method: "POST",
        url: method_url,
        headers: headers,
        params: params,
        form: form_data,
        accept_json: true
      )
      response
    end
def classify(images_file: nil, images_filename: nil, images_file_content_type: nil, url: nil, threshold: nil, owners: nil, classifier_ids: nil, accept_language: nil)
      headers = {
        "Accept-Language" => accept_language
      }
      sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V3", "classify")
      headers.merge!(sdk_headers)

      params = {
        "version" => @version
      }

      form_data = {}

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

      classifier_ids *= "," unless classifier_ids.nil?
      owners *= "," unless owners.nil?

      form_data[:url] = HTTP::FormData::Part.new(url.to_s, content_type: "text/plain") unless url.nil?

      form_data[:threshold] = HTTP::FormData::Part.new(threshold.to_s, content_type: "application/json") unless threshold.nil?

      form_data[:owners] = HTTP::FormData::Part.new(owners, content_type: "application/json") unless owners.nil?

      form_data[:classifier_ids] = HTTP::FormData::Part.new(classifier_ids, content_type: "application/json") unless classifier_ids.nil?

      method_url = "/v3/classify"

      response = request(
        method: "POST",
        url: method_url,
        headers: headers,
        params: params,
        form: form_data,
        accept_json: true
      )
      response
    end
@!method initialize(args)
 Construct a new client for the Visual Recognition service.

 @param args [Hash] The args to initialize with
 @option args version [String] The API version date to use with the service, in
   "YYYY-MM-DD" format. Whenever the API is changed in a backwards
   incompatible way, a new minor version of the API is released.
   The service uses the API version for the date you specify, or
   the most recent version before that date. Note that you should
   not programmatically specify the current date at runtime, in
   case the API has been updated since your application's release.
   Instead, specify a version date that is compatible with your
   application, and don't change it until your application is
   ready for a later version.
 @option args url [String] The base url to use when contacting the service (e.g.
   "https://gateway.watsonplatform.net/visual-recognition/api").
   The base url may differ between Bluemix regions.
 @option args iam_apikey [String] An API key that can be used to request IAM tokens. If
   this API key is provided, the SDK will manage the token and handle the
   refreshing.
 @option args iam_access_token [String] An IAM access token is fully managed by the application.
   Responsibility falls on the application to refresh the token, either before
   it expires or reactively upon receiving a 401 from the service as any requests
   made with an expired token will fail.
 @option args iam_url [String] An optional URL for the IAM service API. Defaults to
   'https://iam.ng.bluemix.net/identity/token'.

 General


 @!method classify(images_file: nil, images_filename: nil, images_file_content_type: nil, url: nil, threshold: nil, owners: nil, classifier_ids: nil, accept_language: nil)
 Classify images.
 Classify images with built-in or custom classifiers.
 @param images_file [File] An image file (.gif, .jpg, .png, .tif) or .zip file with images. Maximum image
   size is 10 MB. Include no more than 20 images and limit the .zip file to 100 MB.
   Encode the image and .zip file names in UTF-8 if they contain non-ASCII
   characters. The service assumes UTF-8 encoding if it encounters non-ASCII
   characters.

   You can also include an image with the **url** parameter.
 @param images_filename [String] The filename for images_file.
 @param images_file_content_type [String] The content type of images_file.
 @param url [String] The URL of an image (.gif, .jpg, .png, .tif) to analyze. The minimum recommended
   pixel density is 32X32 pixels, but the service tends to perform better with images
   that are at least 224 x 224 pixels. The maximum image size is 10 MB.

   You can also include images with the **images_file** parameter.
 @param threshold [Float] The minimum score a class must have to be displayed in the response. Set the
   threshold to `0.0` to return all identified classes.
 @param owners [Array[String]] The categories of classifiers to apply. The **classifier_ids** parameter overrides
   **owners**, so make sure that **classifier_ids** is empty.
   - Use `IBM` to classify against the `default` general classifier. You get the same
   result if both **classifier_ids** and **owners** parameters are empty.
   - Use `me` to classify against all your custom classifiers. However, for better
   performance use **classifier_ids** to specify the specific custom classifiers to
   apply.
   - Use both `IBM` and `me` to analyze the image against both classifier categories.
 @param classifier_ids [Array[String]] Which classifiers to apply. Overrides the **owners** parameter. You can specify
   both custom and built-in classifier IDs. The built-in `default` classifier is used
   if both **classifier_ids** and **owners** parameters are empty.

   The following built-in classifier IDs require no training:
   - `default`: Returns classes from thousands of general tags.
   - `food`: Enhances specificity and accuracy for images of food items.
   - `explicit`: Evaluates whether the image might be pornographic.
 @param accept_language [String] The desired language of parts of the response. See the response for details.
 @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.