diff --git a/.github/workflows/_test-code-samples.yml b/.github/workflows/_test-code-samples.yml index bbd5e8ce5..ca03e5b8a 100644 --- a/.github/workflows/_test-code-samples.yml +++ b/.github/workflows/_test-code-samples.yml @@ -32,4 +32,4 @@ jobs: env: MINDEE_LOG_LEVEL: DEBUG run: | - ./spec/test_code_samples.sh ${{ secrets.MINDEE_ACCOUNT_SE_TESTS }} ${{ secrets.MINDEE_ENDPOINT_SE_TESTS }} ${{ secrets.MINDEE_API_KEY_SE_TESTS }} + ./spec/test_code_samples.sh ${{ secrets.MINDEE_ACCOUNT_SE_TESTS }} ${{ secrets.MINDEE_ENDPOINT_SE_TESTS }} ${{ secrets.MINDEE_API_KEY_SE_TESTS }} ${{ secrets.MINDEE_V2_SE_TESTS_API_KEY }} ${{ secrets.MINDEE_V2_SE_TESTS_FINDOC_MODEL_ID }} diff --git a/.github/workflows/_test-integrations.yml b/.github/workflows/_test-integrations.yml index f6df327c0..e046b7578 100644 --- a/.github/workflows/_test-integrations.yml +++ b/.github/workflows/_test-integrations.yml @@ -56,6 +56,9 @@ jobs: env: MINDEE_API_KEY: ${{ secrets.MINDEE_API_KEY_SE_TESTS }} WORKFLOW_ID: ${{ secrets.WORKFLOW_ID_SE_TESTS }} + MINDEE_V2_API_KEY: ${{ secrets.MINDEE_V2_SE_TESTS_API_KEY }} + MINDEE_V2_FINDOC_MODEL_ID: ${{ secrets.MINDEE_V2_SE_TESTS_FINDOC_MODEL_ID }} + MINDEE_V2_SE_TESTS_BLANK_PDF_URL: ${{ secrets.MINDEE_V2_SE_TESTS_BLANK_PDF_URL }} MINDEE_LOG_LEVEL: DEBUG run: | bundle exec rake integration diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 2690f22cd..6527968fb 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -3,18 +3,22 @@ name: Pull Request on: pull_request: +permissions: + contents: read + pull-requests: read + jobs: static_analysis: - uses: mindee/mindee-api-ruby/.github/workflows/_static-analysis.yml@main + uses: ./.github/workflows/_static-analysis.yml test_units: - uses: mindee/mindee-api-ruby/.github/workflows/_test-units.yml@main + uses: ./.github/workflows/_test-units.yml needs: static_analysis secrets: inherit test_integrations: - uses: mindee/mindee-api-ruby/.github/workflows/_test-integrations.yml@main + uses: ./.github/workflows/_test-integrations.yml needs: test_units secrets: inherit test_code_samples: - uses: mindee/mindee-api-ruby/.github/workflows/_test-code-samples.yml@main + uses: ./.github/workflows/_test-code-samples.yml needs: test_units secrets: inherit diff --git a/docs/code_samples/default_v2.txt b/docs/code_samples/default_v2.txt new file mode 100644 index 000000000..b5cd31515 --- /dev/null +++ b/docs/code_samples/default_v2.txt @@ -0,0 +1,28 @@ +require 'mindee' + +input_path = '/path/to/the/file.ext' +api_key = 'MY_API_KEY' +model_id = 'MY_MODEL_ID' + +# Init a new client +mindee_client = Mindee::ClientV2.new(api_key: api_key) + +# Set inference parameters +params = Mindee::Input::InferenceParameters.new( + # ID of the model, required. + model_id, + # If set to `True`, will enable Retrieval-Augmented Generation. + rag: false, +) + +# Load a file from disk +input_source = Mindee::Input::Source::PathInputSource.new(input_path) + +# Send for processing +response = mindee_client.enqueue_and_get_inference( + input_source, + params # Note: this parameter can also be provided as a Hash. +) + +# Print a brief summary of the parsed data +puts response.inference diff --git a/lib/mindee.rb b/lib/mindee.rb index 26f2be437..05378eb4e 100644 --- a/lib/mindee.rb +++ b/lib/mindee.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true require 'mindee/client' +require 'mindee/client_v2' +require 'mindee/page_options' require 'mindee/logging' module Mindee @@ -54,6 +56,10 @@ module Standard # Universal fields and functions. module Universal end + + # V2-specific module. + module V2 + end end # Document input-related internals. diff --git a/lib/mindee/client.rb b/lib/mindee/client.rb index 07f62a9e4..39ef0dec8 100644 --- a/lib/mindee/client.rb +++ b/lib/mindee/client.rb @@ -2,38 +2,17 @@ require_relative 'input' require_relative 'http' -require_relative 'product' +require_relative 'logging' +require_relative 'page_options' require_relative 'parsing/common/api_response' require_relative 'parsing/common/job' require_relative 'parsing/common/workflow_response' -require_relative 'logging' +require_relative 'product' # Default owner for products. OTS_OWNER = 'mindee' module Mindee - # Class for page options in parse calls. - # - # @!attribute page_indexes [Array[Integer]] Zero-based list of page indexes. - # @!attribute operation [:KEEP_ONLY, :REMOVE] Operation to apply on the document, given the specified page indexes: - # * `:KEEP_ONLY` - keep only the specified pages, and remove all others. - # * `:REMOVE` - remove the specified pages, and keep all others. - # @!attribute on_min_pages [Integer, nil] Apply the operation only if the document has at least this many pages. - class PageOptions - attr_accessor :page_indexes, :operation, :on_min_pages - - def initialize(params: {}) - params ||= {} - params = params.transform_keys(&:to_sym) - @page_indexes = params.fetch( - :page_indexes, - [] # : Array[Integer] - ) - @operation = params.fetch(:operation, :KEEP_ONLY) - @on_min_pages = params.fetch(:on_min_pages, nil) - end - end - # Class for configuration options in parse calls. # # @!attribute all_words [bool] Whether to include the full text for each page. @@ -89,8 +68,9 @@ def initialize(params: {}) # * `:KEEP_ONLY` - keep only the specified pages, and remove all others. # * `:REMOVE` - remove the specified pages, and keep all others. # * `:on_min_pages` Apply the operation only if the document has at least this many pages. + # @!attribute close_file [bool, nil] Whether to close the file after sending it. Defaults to true. class WorkflowOptions - attr_accessor :document_alias, :priority, :full_text, :public_url, :page_options, :rag + attr_accessor :document_alias, :priority, :full_text, :public_url, :page_options, :rag, :close_file def initialize(params: {}) params = params.transform_keys(&:to_sym) @@ -102,6 +82,7 @@ def initialize(params: {}) raw_page_options = params.fetch(:page_options, nil) raw_page_options = PageOptions.new(params: raw_page_options) unless raw_page_options.is_a?(PageOptions) @page_options = raw_page_options + @close_file = params.fetch(:close_file, true) end end @@ -326,7 +307,7 @@ def execute_workflow(input_source, workflow_id, options: {}) process_pdf_if_required(input_source, opts) end - workflow_endpoint = Mindee::HTTP::WorkflowEndpoint.new(workflow_id, api_key: @api_key) + workflow_endpoint = Mindee::HTTP::WorkflowEndpoint.new(workflow_id, api_key: @api_key.to_s) logger.debug("Sending document to workflow '#{workflow_id}'") prediction, raw_http = workflow_endpoint.execute_workflow( @@ -455,11 +436,11 @@ def initialize_endpoint(product_class, endpoint_name: '', account_name: '', vers account_name = fix_account_name(account_name) version = fix_version(product_class, version) - HTTP::Endpoint.new(account_name, endpoint_name, version, api_key: @api_key) + HTTP::Endpoint.new(account_name, endpoint_name, version, api_key: @api_key.to_s) end def fix_endpoint_name(product_class, endpoint_name) - endpoint_name.nil? || endpoint_name.empty? ? product_class.endpoint_name : endpoint_name + endpoint_name.nil? || endpoint_name.empty? ? product_class.endpoint_name.to_s : endpoint_name.to_s end def fix_account_name(account_name) @@ -474,11 +455,11 @@ def fix_account_name(account_name) def fix_version(product_class, version) return version unless version.nil? || version.empty? - if product_class.endpoint_version.nil? || product_class.endpoint_version.empty? + if product_class.endpoint_version.nil? || product_class.endpoint_version.to_s.empty? logger.debug('No version provided for a custom build, will attempt to poll version 1 by default.') return '1' end - product_class.endpoint_version + product_class.endpoint_version || '' end # If needed, converts the parsing options provided as a hash into a proper ParseOptions object. diff --git a/lib/mindee/client_v2.rb b/lib/mindee/client_v2.rb new file mode 100644 index 000000000..f70be6a40 --- /dev/null +++ b/lib/mindee/client_v2.rb @@ -0,0 +1,109 @@ +# frozen_string_literal: true + +require_relative 'input' +require_relative 'http' +require_relative 'product' +require_relative 'parsing/common/api_response' +require_relative 'parsing/common/job' +require_relative 'parsing/common/workflow_response' +require_relative 'logging' + +module Mindee + # Mindee V2 API Client. + class ClientV2 + # @return [HTTP::MindeeApiV2] + private attr_reader :mindee_api + + # @param api_key [String] + def initialize(api_key: '') + @mindee_api = Mindee::HTTP::MindeeApiV2.new(api_key: api_key) + end + + # Retrieves an inference. + # @param inference_id [String] + # @return [Mindee::Parsing::V2::InferenceResponse] + def get_inference(inference_id) + @mindee_api.req_get_inference(inference_id) + end + + # Retrieves an inference. + # @param job_id [String] + # @return [Mindee::Parsing::V2::JobResponse] + def get_job(job_id) + @mindee_api.req_get_job(job_id) + end + + # Enqueue a document for async parsing. + # @param input_source [Mindee::Input::Source::LocalInputSource, Mindee::Input::Source::URLInputSource] + # The source of the input document (local file or URL). + # @param params [Hash, InferenceParameters] + # @return [Mindee::Parsing::V2::JobResponse] + def enqueue_inference(input_source, params) + normalized_params = normalize_inference_parameters(params) + logger.debug("Enqueueing document to model '#{normalized_params.model_id}'.") + + @mindee_api.req_post_inference_enqueue(input_source, normalized_params) + end + + # Enqueue a document for async parsing and automatically try to retrieve it. + # @param input_source [Mindee::Input::Source::LocalInputSource, Mindee::Input::Source::URLInputSource] + # The source of the input document (local file or URL). + # @param params [Hash, InferenceParameters] Parameters for the inference. + # @return [Mindee::Parsing::V2::InferenceResponse] + def enqueue_and_get_inference(input_source, params) + normalized_params = normalize_inference_parameters(params) + normalized_params.validate_async_params + enqueue_response = enqueue_inference(input_source, normalized_params) + + if enqueue_response.job.id.nil? || enqueue_response.job.id.empty? + logger.error("Failed enqueueing:\n#{enqueue_response.raw_http}") + raise Mindee::Errors::MindeeError, 'Enqueueing of the document failed.' + end + + job_id = enqueue_response.job.id + logger.debug("Successfully enqueued document with job id: #{job_id}.") + + sleep(normalized_params.polling_options.initial_delay_sec) + retry_counter = 1 + poll_results = get_job(job_id) + + while retry_counter < normalized_params.polling_options.max_retries + if poll_results.job.status == 'Failed' + break + elsif poll_results.job.status == 'Processed' + return get_inference(poll_results.job.id) + end + + logger.debug( + "Successfully enqueued inference with job id: #{job_id}.\n" \ + "Attempt n°#{retry_counter}/#{normalized_params.polling_options.max_retries}.\n" \ + "Job status: #{poll_results.job.status}." + ) + + sleep(normalized_params.polling_options.delay_sec) + poll_results = get_job(job_id) + retry_counter += 1 + end + + error = poll_results.job.error + unless error.nil? + err_to_raise = Mindee::Errors::MindeeHTTPErrorV2.new(error) + # NOTE: purposefully decoupled from the line above, otherwise rubocop thinks `error` is a `message` param. + raise err_to_raise + end + + sec_count = normalized_params.polling_options.delay_sec * retry_counter + raise Mindee::Errors::MindeeError, + "Asynchronous parsing request timed out after #{sec_count} seconds" + end + + # If needed, converts the parsing options provided as a hash into a proper InferenceParameters object. + # @param params [Hash, InferenceParameters] Params. + # @return [InferenceParameters] + def normalize_inference_parameters(params) + return params if params.is_a?(Input::InferenceParameters) + + Input::InferenceParameters.from_hash(params: params) + end + end +end diff --git a/lib/mindee/errors.rb b/lib/mindee/errors.rb index 59117d6c5..3c403704f 100644 --- a/lib/mindee/errors.rb +++ b/lib/mindee/errors.rb @@ -2,4 +2,5 @@ require_relative 'errors/mindee_error' require_relative 'errors/mindee_http_error' +require_relative 'errors/mindee_http_error_v2' require_relative 'errors/mindee_input_error' diff --git a/lib/mindee/errors/mindee_http_error_v2.rb b/lib/mindee/errors/mindee_http_error_v2.rb new file mode 100644 index 000000000..7daaa8eed --- /dev/null +++ b/lib/mindee/errors/mindee_http_error_v2.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require_relative 'mindee_error' + +module Mindee + module Errors + # API V2 HttpError + class MindeeHTTPErrorV2 < MindeeError + # @return [Integer] + attr_reader :status + # @return [String] + attr_reader :detail + + # @param http_error [Hash, Parsing::V2::ErrorResponse] + def initialize(http_error) + if http_error.is_a?(Parsing::V2::ErrorResponse) + http_error = { 'detail' => http_error.detail, + 'status' => http_error.status } + end + @status = http_error['status'] + @detail = http_error['detail'] + super("HTTP error: #{@status} - #{@detail}") + end + end + end +end diff --git a/lib/mindee/geometry/point.rb b/lib/mindee/geometry/point.rb index 6058f81bb..18ff21354 100644 --- a/lib/mindee/geometry/point.rb +++ b/lib/mindee/geometry/point.rb @@ -6,9 +6,9 @@ module Geometry # A relative set of coordinates (X, Y) on the document. class Point # @return [Float] - attr_accessor :x + attr_reader :x # @return [Float] - attr_accessor :y + attr_reader :y # rubocop:disable Naming/MethodParameterName diff --git a/lib/mindee/geometry/quadrilateral.rb b/lib/mindee/geometry/quadrilateral.rb index 0f0e9689a..d3b008973 100644 --- a/lib/mindee/geometry/quadrilateral.rb +++ b/lib/mindee/geometry/quadrilateral.rb @@ -6,13 +6,13 @@ module Geometry # Contains exactly 4 relative vertices coordinates (Points). class Quadrilateral # @return [Mindee::Geometry::Point] - attr_accessor :top_left + attr_reader :top_left # @return [Mindee::Geometry::Point] - attr_accessor :top_right + attr_reader :top_right # @return [Mindee::Geometry::Point] - attr_accessor :bottom_right + attr_reader :bottom_right # @return [Mindee::Geometry::Point] - attr_accessor :bottom_left + attr_reader :bottom_left # @param top_left [Mindee::Geometry::Point] # @param top_right [Mindee::Geometry::Point] diff --git a/lib/mindee/geometry/utils.rb b/lib/mindee/geometry/utils.rb index 64bfce196..b5612ca73 100644 --- a/lib/mindee/geometry/utils.rb +++ b/lib/mindee/geometry/utils.rb @@ -83,6 +83,7 @@ def self.get_min_max_x(points) # @param anchor [Array 299 && response.code.to_i < 400 req = Net::HTTP::Get.new(response['location'], headers) Net::HTTP.start(uri.hostname, uri.port, use_ssl: true, read_timeout: @request_timeout) do |http| diff --git a/lib/mindee/http/http_error_handler.rb b/lib/mindee/http/http_error_handler.rb index b4ade5ace..8785aabef 100644 --- a/lib/mindee/http/http_error_handler.rb +++ b/lib/mindee/http/http_error_handler.rb @@ -65,7 +65,7 @@ def create_error_obj(response) end end - error_obj.nil? ? {} : error_obj + error_obj end # Creates an appropriate HTTP error exception, based on retrieved http error code @@ -81,11 +81,24 @@ def handle_error(url, response) error_obj = create_error_obj(parsed_hash) case code when 400..499 - Errors::MindeeHTTPClientError.new(error_obj, url, code) + Errors::MindeeHTTPClientError.new(error_obj || {}, url, code) when 500..599 - Errors::MindeeHTTPServerError.new(error_obj, url, code) + Errors::MindeeHTTPServerError.new(error_obj || {}, url, code) else - Errors::MindeeHTTPError.new(error_obj, url, code) + Errors::MindeeHTTPError.new(error_obj || {}, url, code) + end + end + + # Creates an appropriate HTTP error exception for a V2 API response, based on retrieved http error code. + # @param hashed_response [Hash] dictionary response retrieved by the server + def generate_v2_error(hashed_response) + code = hashed_response[:code].to_i + if hashed_response.key?(:status) + Errors::MindeeHTTPErrorV2.new(hashed_response.transform_keys(&:to_s)) + elsif code < 200 || code > 399 + Errors::MindeeHTTPErrorV2.new({ 'status' => code, 'detail' => 'No details available.' }) + else + Errors::MindeeHTTPErrorV2.new({ 'status' => -1, 'detail' => 'Unknown Error.' }) end end end diff --git a/lib/mindee/http/mindee_api_v2.rb b/lib/mindee/http/mindee_api_v2.rb new file mode 100644 index 000000000..07af28478 --- /dev/null +++ b/lib/mindee/http/mindee_api_v2.rb @@ -0,0 +1,148 @@ +# frozen_string_literal: true + +require_relative 'api_settings_v2' +require_relative '../input' +require_relative '../errors' +require_relative '../parsing/v2' + +module Mindee + module HTTP + # API client for version 2. + class MindeeApiV2 + # @return [ApiSettingsV2] + attr_reader :settings + + # @param api_key [String, nil] + def initialize(api_key: nil) + @settings = ApiSettingsV2.new(api_key: api_key) + end + + # Sends a file to the inference queue. + # + # @param input_source [Input::Source::LocalInputSource, Input::Source::URLInputSource] + # @param params [Input::InferenceParameters] + # @return [Mindee::Parsing::V2::JobResponse] + # @raise [Mindee::Errors::MindeeHttpErrorV2] + def req_post_inference_enqueue(input_source, params) + @settings.check_api_key + response = enqueue( + input_source, + params + ) + Parsing::V2::JobResponse.new(process_response(response)) + end + + # Retrieves a queued inference. + # + # @param inference_id [String] + # @return [Mindee::Parsing::V2::InferenceResponse] + def req_get_inference(inference_id) + @settings.check_api_key + response = inference_result_req_get( + inference_id + ) + Parsing::V2::InferenceResponse.new(process_response(response)) + end + + # Retrieves a queued job. + # + # @param job_id [String] + # @return [Mindee::Parsing::V2::JobResponse] + def req_get_job(job_id) + @settings.check_api_key + response = inference_job_req_get( + job_id + ) + Parsing::V2::JobResponse.new(process_response(response)) + end + + private + + # Converts an HTTP response to a parsed response object. + # + # @param response [Net::HTTPResponse, nil] + # @return [Hash] + # @raise Throws if the server returned an error. + def process_response(response) + if !response.nil? && response.respond_to?(:body) && ResponseValidation.valid_v2_response?(response) + return JSON.parse(response.body, object_class: Hash) + end + + response_body = if response.nil? || !response.respond_to?(:body) + '{ "status": -1, + "detail": "Empty server response." }' + else + response.body + end + raise ErrorHandler.generate_v2_error(JSON.parse(response_body).transform_keys(&:to_sym)) + end + + # Polls a queue for either a result or a job. + # @param url [String] URL, passed as a string. + # @return [Net::HTTPResponse] + def poll(url) + uri = URI(url) + headers = { + 'Authorization' => @settings.api_key, + 'User-Agent' => @settings.user_agent, + } + req = Net::HTTP::Get.new(uri, headers) + req['Transfer-Encoding'] = 'chunked' + + Net::HTTP.start(uri.hostname, uri.port, use_ssl: true, read_timeout: @settings.request_timeout) do |http| + return http.request(req) + end + raise Mindee::Errors::MindeeError, 'Could not resolve server response.' + end + + # Polls the API for the status of a job. + # + # @param job_id [String] ID of the job. + # @return [Net::HTTPResponse] + def inference_job_req_get(job_id) + poll("#{@settings.base_url}/jobs/#{job_id}") + end + + # Polls the API for the result of an inference. + # + # @param queue_id [String] ID of the queue. + # @return [Net::HTTPResponse] + def inference_result_req_get(queue_id) + poll("#{@settings.base_url}/inferences/#{queue_id}") + end + + # @param input_source [Mindee::Input::Source::LocalInputSource, Mindee::Input::Source::URLInputSource] + # @param params [Input::InferenceParameters] Parse options. + # @return [Net::HTTPResponse, nil] + def enqueue(input_source, params) + uri = URI("#{@settings.base_url}/inferences/enqueue") + + form_data = if input_source.is_a?(Mindee::Input::Source::URLInputSource) + [['url', input_source.url]] # : Array[untyped] + else + file_data, file_metadata = input_source.read_contents(close: params.close_file) + [['file', file_data, file_metadata]] # : Array[untyped] + end + form_data.push ['model_id', params.model_id] + form_data.push ['rag', 'true'] if params.rag + form_data.push ['file_alias', params.file_alias] if params.file_alias + unless params.webhook_ids.nil? || params.webhook_ids.empty? + form_data.push ['webhook_ids', params.webhook_ids.join(',')] + end + headers = { + 'Authorization' => @settings.api_key, + 'User-Agent' => @settings.user_agent, + } + req = Net::HTTP::Post.new(uri, headers) + + req.set_form(form_data, 'multipart/form-data') + req['Transfer-Encoding'] = 'chunked' + + Net::HTTP.start(uri.hostname, uri.port, use_ssl: true, read_timeout: @settings.request_timeout) do |http| + return http.request(req) + end + raise Mindee::Errors::MindeeError, 'Could not resolve server response.' + end + end + end +end diff --git a/lib/mindee/http/response_validation.rb b/lib/mindee/http/response_validation.rb index 1601e2b5d..05d883208 100644 --- a/lib/mindee/http/response_validation.rb +++ b/lib/mindee/http/response_validation.rb @@ -21,6 +21,25 @@ def self.valid_sync_response?(response) true end + # Checks if a V2 response is valid. + # @param [Net::HTTPResponse] response + # @return [bool] + def self.valid_v2_response?(response) + return false unless valid_sync_response?(response) + + hashed_response = JSON.parse(response.body, object_class: Hash) + + return false if hashed_response.dig('job', 'status').to_s == 'Failed' + + return false if hashed_response.dig('job', + 'error') && !(hashed_response.dig('job', + 'error').empty? || hashed_response.dig( + 'job', 'error' + ).nil?) + + true + end + # Checks if the asynchronous response is valid. Also checks if it is a valid synchronous response. # Returns true if the response is valid. # @param [Net::HTTPResponse] response @@ -52,7 +71,7 @@ def self.clean_request!(response) end return if !hashed_response.dig('job', 'error').empty? && - (hashed_response.dig('job', 'status') != Mindee::Parsing::Common::JobStatus::FAILURE.to_s) + (hashed_response.dig('job', 'status').downcase != Mindee::Parsing::Common::JobStatus::FAILURE.to_s) response.instance_variable_set(:@code, '500') end diff --git a/lib/mindee/http/workflow_endpoint.rb b/lib/mindee/http/workflow_endpoint.rb index 1c239ce20..2175793e6 100644 --- a/lib/mindee/http/workflow_endpoint.rb +++ b/lib/mindee/http/workflow_endpoint.rb @@ -48,7 +48,7 @@ def execute_workflow(input_source, opts) # @return [Net::HTTPResponse, nil] def workflow_execution_req_post(input_source, opts) uri = URI(@url) - params = {} # : Hash[Symbol | String, untyped] + params = {} # : Hash[String | Symbol, untyped] params[:full_text_ocr] = 'true' if opts.full_text params[:rag] = 'true' if opts.rag uri.query = URI.encode_www_form(params) if params.any? @@ -62,7 +62,7 @@ def workflow_execution_req_post(input_source, opts) if input_source.is_a?(Mindee::Input::Source::URLInputSource) form_data.push ['document', input_source.url] else - form_data.push input_source.read_contents + form_data.push ['document', *input_source.read_contents(close: opts.close_file)] end form_data.push ['alias', opts.document_alias] if opts.document_alias form_data.push ['public_url', opts.public_url] if opts.public_url diff --git a/lib/mindee/image/extracted_image.rb b/lib/mindee/image/extracted_image.rb index ff764de62..71d525455 100644 --- a/lib/mindee/image/extracted_image.rb +++ b/lib/mindee/image/extracted_image.rb @@ -69,7 +69,7 @@ def write_to_file(output_path, file_format = nil) # @return [FileInputSource] A BufferInput source. def as_source @buffer.rewind - Mindee::Input::Source::BytesInputSource.new(@buffer.read, @internal_file_name) + Mindee::Input::Source::BytesInputSource.new(@buffer.read || '', @internal_file_name) end end end diff --git a/lib/mindee/image/image_extractor.rb b/lib/mindee/image/image_extractor.rb index 6f0f11733..bb0599800 100644 --- a/lib/mindee/image/image_extractor.rb +++ b/lib/mindee/image/image_extractor.rb @@ -30,11 +30,11 @@ def self.attach_image_as_new_file(input_buffer, format: 'jpg') # Extracts multiple images from a given local input source. # - # @param [Mindee::Input::Source::LocalInputSource] input_source + # @param [Input::Source::LocalInputSource] input_source # @param [Integer] page_id ID of the Page to extract from. - # @param [Array>, Array] polygons List of coordinates + # @param [Array>, Array] polygons List of coordinates. # to extract. - # @return [Array] Extracted Images. + # @return [Array] Extracted Images. def self.extract_multiple_images_from_source(input_source, page_id, polygons) new_stream = load_input_source_pdf_page_as_stringio(input_source, page_id) new_stream.seek(0) @@ -44,11 +44,11 @@ def self.extract_multiple_images_from_source(input_source, page_id, polygons) # Extracts images from their positions on a file (as polygons). # - # @param [Mindee::Input::Source::LocalInputSource] input_source Local input source. + # @param [Input::Source::LocalInputSource] input_source Local input source. # @param [StringIO] pdf_stream Buffer of the PDF. # @param [Integer] page_id Page ID. - # @param [Array] polygons - # @return [Array] Extracted Images. + # @param [Array] polygons + # @return [Array] Extracted Images. def self.extract_images_from_polygons(input_source, pdf_stream, page_id, polygons) extracted_elements = [] @@ -90,12 +90,12 @@ def self.extract_images_from_polygons(input_source, pdf_stream, page_id, polygon # # @param [StringIO] buffer Buffer containing the image. # @param [String] file_name Name for the file. - # @param [Object] page_id ID of the page the file was universal from. - # @param [Object] element_id ID of the element of a given page. + # @param [Integer] page_id ID of the page the file was universal from. + # @param [Integer] element_id ID of the element of a given page. def self.create_extracted_image(buffer, file_name, page_id, element_id) buffer.rewind ExtractedImage.new( - Mindee::Input::Source::BytesInputSource.new(buffer.read.to_s, file_name), + Input::Source::BytesInputSource.new(buffer.read.to_s, file_name), page_id, element_id ) @@ -109,7 +109,7 @@ def self.create_extracted_image(buffer, file_name, page_id, element_id) def self.load_input_source_pdf_page_as_stringio(input_file, page_id) input_file.io_stream.rewind if input_file.pdf? - Mindee::PDF::PDFProcessor.get_page(Origami::PDF.read(input_file.io_stream), page_id) + PDF::PDFProcessor.get_page(Origami::PDF.read(input_file.io_stream), page_id) else input_file.io_stream end diff --git a/lib/mindee/input.rb b/lib/mindee/input.rb index e83d1dcfe..8afb9bfac 100644 --- a/lib/mindee/input.rb +++ b/lib/mindee/input.rb @@ -1,3 +1,5 @@ # frozen_string_literal: true +require_relative 'input/inference_parameters' +require_relative 'input/polling_options' require_relative 'input/sources' diff --git a/lib/mindee/input/inference_parameters.rb b/lib/mindee/input/inference_parameters.rb new file mode 100644 index 000000000..011838856 --- /dev/null +++ b/lib/mindee/input/inference_parameters.rb @@ -0,0 +1,116 @@ +# frozen_string_literal: true + +module Mindee + module Input + # Parameters to set when sending a file for inference. + class InferenceParameters + # @return [String] ID of the model (required). + attr_reader :model_id + + # @return [Boolean, nil] Enable Retrieval-Augmented Generation. + attr_reader :rag + + # @return [String, nil] Optional alias for the file. + attr_reader :file_alias + + # @return [Array, nil] Optional list of Webhooks IDs to propagate the API response to. + attr_reader :webhook_ids + + # @return [PollingOptions] Options for polling. Set only if having timeout issues. + attr_reader :polling_options + + # @return [Boolean, nil] Whether to close the file after parsing. + attr_reader :close_file + + # @param [String] model_id ID of the model + # @param [FalseClass] rag Whether to enable rag. + # @param [nil] file_alias File alias, if applicable. + # @param [nil] webhook_ids + # @param [nil] polling_options + # @param [TrueClass] close_file + def initialize(model_id, rag: false, file_alias: nil, webhook_ids: nil, polling_options: nil, close_file: true) + raise Errors::MindeeInputError, 'Model ID is required.' if model_id.empty? || model_id.nil? + + @model_id = model_id + @rag = rag || false + @file_alias = file_alias + @webhook_ids = webhook_ids || [] + @polling_options = get_clean_polling_options(polling_options) + @close_file = close_file.nil? || close_file + end + + # Validates the parameters for async auto-polling + def validate_async_params + min_delay_sec = 1 + min_initial_delay_sec = 1 + min_retries = 2 + + if @polling_options.delay_sec < min_delay_sec + raise ArgumentError, + "Cannot set auto-poll delay to less than #{min_delay_sec} second(s)" + end + if @polling_options.initial_delay_sec < min_initial_delay_sec + raise ArgumentError, + "Cannot set initial parsing delay to less than #{min_initial_delay_sec} second(s)" + end + return unless @polling_options.max_retries < min_retries + + raise ArgumentError, + "Cannot set auto-poll retries to less than #{min_retries}" + end + + # Loads a prediction from a Hash. + # @param [Hash] params Parameters to provide as a hash. + # @return [InferenceParameters] + def self.from_hash(params: {}) + params.transform_keys!(&:to_sym) + + if params.empty? || params[:model_id].nil? || params[:model_id].empty? + raise Errors::MindeeInputError, 'Model ID is required.' + end + + model_id = params.fetch(:model_id) + rag = params.fetch(:rag, false) + file_alias = params.fetch(:file_alias, nil) + webhook_ids = params.fetch(:webhook_ids, []) + polling_options_input = params.fetch(:page_options, PollingOptions.new) + if polling_options_input.is_a?(Hash) + polling_options_input = polling_options_input.transform_keys(&:to_sym) + PollingOptions.new( + initial_delay_sec: polling_options_input.fetch(:initial_delay_sec, 2.0), + delay_sec: polling_options_input.fetch(:delay_sec, 1.5), + max_retries: polling_options_input.fetch(:max_retries, 80) + ) + end + close_file = params.fetch(:close_file, true) + InferenceParameters.new(model_id, rag: rag, file_alias: file_alias, webhook_ids: webhook_ids, + close_file: close_file) + end + + private + + # Cleans a proper polling options object potentially from a hash. + # @param [Hash, PollingOptions, nil] polling_options Polling options. + # @return [PollingOptions] Valid polling options object. + def get_clean_polling_options(polling_options) + return PollingOptions.new if polling_options.is_a?(PollingOptions) + + if polling_options.is_a?(Hash) + polling_options = polling_options.transform_keys(&:to_sym) + output_polling_options = PollingOptions.new( + initial_delay_sec: polling_options.fetch(:initial_delay_sec, 2.0), + delay_sec: polling_options.fetch(:delay_sec, 1.5), + max_retries: polling_options.fetch(:max_retries, 80) + ) + else + output_polling_options = if polling_options.is_a?(PollingOptions) + polling_options || PollingOptions.new + else + PollingOptions.new + end + end + output_polling_options + end + end + end +end diff --git a/lib/mindee/input/local_response.rb b/lib/mindee/input/local_response.rb index e4b4df299..e1cc2306e 100644 --- a/lib/mindee/input/local_response.rb +++ b/lib/mindee/input/local_response.rb @@ -62,11 +62,20 @@ def get_hmac_signature(secret_key) end # @param secret_key [String] Secret key, either a string or a byte/byte array. - # @param signature [String] + # @param signature [String] Signature to match # @return [bool] def valid_hmac_signature?(secret_key, signature) signature == get_hmac_signature(secret_key) end + + # Deserializes a loaded response + # @param response_class [Parsing::V2::JobResponse, Parsing::V2::InferenceResponse] class to return. + # @return [Parsing::V2::JobResponse, Parsing::V2::InferenceResponse] + def deserialize_response(response_class) + response_class.new(as_hash) + rescue StandardError + raise Errors::MindeeInputError, 'Invalid response provided.' + end end end end diff --git a/lib/mindee/input/polling_options.rb b/lib/mindee/input/polling_options.rb new file mode 100644 index 000000000..8cba695b3 --- /dev/null +++ b/lib/mindee/input/polling_options.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module Mindee + module Input + # Options for asynchronous polling. + class PollingOptions + # @return [Integer, Float] Initial delay before the first polling attempt (in seconds). + attr_reader :initial_delay_sec + + # @return [Integer, Float] Delay between each polling attempt (in seconds). + attr_reader :delay_sec + + # @return [Integer] Total number of polling attempts. + attr_reader :max_retries + + # @param initial_delay_sec [Float] Initial delay before the first attempt (default:2.0). + # @param delay_sec [Float] Delay between attempts (default: 1.5). + # @param max_retries [Integer] Maximum number of retries (default:80). + def initialize(initial_delay_sec: 2.0, delay_sec: 1.5, max_retries: 80) + @initial_delay_sec = initial_delay_sec + @delay_sec = delay_sec + @max_retries = max_retries + end + end + end +end diff --git a/lib/mindee/input/sources/base64_input_source.rb b/lib/mindee/input/sources/base64_input_source.rb index f3cd2a821..af2972d94 100644 --- a/lib/mindee/input/sources/base64_input_source.rb +++ b/lib/mindee/input/sources/base64_input_source.rb @@ -18,12 +18,12 @@ def initialize(base64_string, filename, repair_pdf: false) # Overload of the same function to prevent a base64 from being re-encoded. # @param close [bool] - # @return [Array] + # @return [Array<[String, aBinaryString ], [Hash, nil] >] def read_contents(close: true) @io_stream.seek(0) data = @io_stream.read @io_stream.close if close - ['document', [data].pack('m'), { filename: Source.convert_to_unicode_escape(@filename) }] + [[data].pack('m'), { filename: Source.convert_to_unicode_escape(@filename) }] end end end diff --git a/lib/mindee/input/sources/local_input_source.rb b/lib/mindee/input/sources/local_input_source.rb index 7cef27c90..8e85b0cd4 100644 --- a/lib/mindee/input/sources/local_input_source.rb +++ b/lib/mindee/input/sources/local_input_source.rb @@ -27,7 +27,7 @@ class LocalInputSource attr_reader :filename # @return [String] attr_reader :file_mimetype - # @return [StringIO] + # @return [StringIO | File] attr_reader :io_stream # @param io_stream [StringIO, File] @@ -60,7 +60,7 @@ def initialize(io_stream, filename, repair_pdf: false) # Attempts to fix pdf files if mimetype is rejected. # "Broken PDFs" are often a result of third-party injecting invalid headers. # This attempts to remove them and send the file - # @param stream [StringIO] + # @param stream [StringIO, File] def rescue_broken_pdf(stream) stream.gets('%PDF-') raise Errors::MindeePDFError if stream.eof? || stream.pos > 500 @@ -78,7 +78,7 @@ def pdf? @file_mimetype.to_s == 'application/pdf' end - # Parses a PDF file according to provided options. + # Cuts a PDF file according to provided options. # @param options [PageOptions, nil] Page cutting/merge options: # # * `:page_indexes` Zero-based list of page indexes. @@ -86,14 +86,20 @@ def pdf? # * `:KEEP_ONLY` - keep only the specified pages, and remove all others. # * `:REMOVE` - remove the specified pages, and keep all others. # * `:on_min_pages` Apply the operation only if document has at least this many pages. - def process_pdf(options) + def apply_page_options(options) @io_stream.seek(0) @io_stream = PDF::PDFProcessor.parse(@io_stream, options) end + # @deprecated Use {#apply_page_options} instead. + # @see #apply_page_options + def process_pdf(options) + apply_page_options(options) + end + # Reads a document. # @param close [bool] - # @return [Array] + # @return [Array<>] def read_contents(close: true) logger.debug("Reading data from: #{@filename}") @io_stream.seek(0) @@ -101,20 +107,21 @@ def read_contents(close: true) data = @io_stream.read @io_stream.rewind @io_stream.close if close - ['document', data, { filename: Mindee::Input::Source.convert_to_unicode_escape(@filename) }] + [data, { filename: Mindee::Input::Source.convert_to_unicode_escape(@filename) }] end # Write the file to a given path. Uses the initial file name by default. # @param path [String] Path to write the file to. def write_to_file(path) - full_path = if File.directory?(path) || path.end_with?('/') - File.join(path, @filename) - else - path - end + t_path = if File.directory?(path || '') || path.to_s.end_with?('/') + File.join(path || '', @filename) + else + path + end + full_path = File.expand_path(t_path || '') FileUtils.mkdir_p(File.dirname(full_path)) @io_stream.rewind - File.binwrite(full_path, @io_stream.read) + File.binwrite(full_path, @io_stream.read || '') logger.debug("Wrote file successfully to #{full_path}") @io_stream.rewind end diff --git a/lib/mindee/page_options.rb b/lib/mindee/page_options.rb new file mode 100644 index 000000000..ad8f93aec --- /dev/null +++ b/lib/mindee/page_options.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Mindee + # Class for page options in parse calls. + # @!attribute page_indexes [Array[Integer]] Zero-based list of page indexes. + # @!attribute operation [:KEEP_ONLY, :REMOVE] Operation to apply on the document, given the specified page indexes: + # * `:KEEP_ONLY` - keep only the specified pages, and remove all others. + # * `:REMOVE` - remove the specified pages, and keep all others. + # @!attribute on_min_pages [Integer, nil] Apply the operation only if the document has at least this many pages. + class PageOptions + attr_accessor :page_indexes, :operation, :on_min_pages + + def initialize(params: {}) + params ||= {} + params = params.transform_keys(&:to_sym) + @page_indexes = params.fetch( + :page_indexes, + [] # : Array[Integer] + ) + @operation = params.fetch(:operation, :KEEP_ONLY) + @on_min_pages = params.fetch(:on_min_pages, nil) + end + end +end diff --git a/lib/mindee/parsing/common/api_request.rb b/lib/mindee/parsing/common/api_request.rb index c9e8876e3..131d8cf4e 100644 --- a/lib/mindee/parsing/common/api_request.rb +++ b/lib/mindee/parsing/common/api_request.rb @@ -8,7 +8,7 @@ class ApiRequest # @return [Hash] attr_reader :error # @return [Array] - attr_reader :ressources + attr_reader :resources # @return [RequestStatus, Symbol] attr_reader :status # @return [Integer] @@ -18,7 +18,7 @@ class ApiRequest def initialize(server_response) @error = server_response['error'] - @ressources = server_response['ressources'] + @resources = server_response['resources'] @status = if server_response['status'] == 'failure' RequestStatus::FAILURE diff --git a/lib/mindee/parsing/common/api_response.rb b/lib/mindee/parsing/common/api_response.rb index 056d391b3..7e9f47349 100644 --- a/lib/mindee/parsing/common/api_response.rb +++ b/lib/mindee/parsing/common/api_response.rb @@ -8,9 +8,13 @@ module Parsing module Common # Potential values for queue in asynchronous calls. module JobStatus + # Job is waiting. WAITING = :waiting + # Job is processing. PROCESSING = :processing + # Job is done. COMPLETED = :completed + # Job failed. FAILURE = :failed end diff --git a/lib/mindee/parsing/common/execution.rb b/lib/mindee/parsing/common/execution.rb index 906505bf6..f2175d4c8 100644 --- a/lib/mindee/parsing/common/execution.rb +++ b/lib/mindee/parsing/common/execution.rb @@ -21,7 +21,7 @@ class Execution # @return [Mindee::Inference] attr_reader :inference # Priority of the execution. - # @return [ExecutionPriority] + # @return [ExecutionPriority, Symbol, nil] attr_reader :priority # The time at which the file was tagged as reviewed. # @return [Time, nil] diff --git a/lib/mindee/parsing/common/extras/extras.rb b/lib/mindee/parsing/common/extras/extras.rb index b45a48550..d593b9821 100644 --- a/lib/mindee/parsing/common/extras/extras.rb +++ b/lib/mindee/parsing/common/extras/extras.rb @@ -11,7 +11,7 @@ module Extras class Extras # @return [CropperExtra, nil] attr_reader :cropper - # @return [Mindee::Parsing::Common::Extras::FullTextOCRExtra, nil] + # @return [Mindee::Parsing::Common::Extras::FullTextOCRExtra] attr_reader :full_text_ocr # @return [RAGExtra, nil] attr_reader :rag @@ -26,7 +26,7 @@ def initialize(raw_prediction) @rag = Mindee::Parsing::Common::Extras::RAGExtra.new(raw_prediction['rag']) if raw_prediction['rag'] raw_prediction.each do |key, value| - instance_variable_set("@#{key}", value) unless ['cropper', 'full_text_ocr', 'rag'].include?(key) + instance_variable_set("@#{key}", value) unless ['cropper', 'full_text_ocr', 'rag'].include?(key.to_s) end end diff --git a/lib/mindee/parsing/common/extras/rag_extra.rb b/lib/mindee/parsing/common/extras/rag_extra.rb index 08717cb30..55c016b36 100644 --- a/lib/mindee/parsing/common/extras/rag_extra.rb +++ b/lib/mindee/parsing/common/extras/rag_extra.rb @@ -14,6 +14,8 @@ def initialize(raw_prediction) @matching_document_id = raw_prediction['matching_document_id'] if raw_prediction['matching_document_id'] end + # String representation. + # @return [String] def to_s @matching_document_id || '' end diff --git a/lib/mindee/parsing/common/ocr/ocr.rb b/lib/mindee/parsing/common/ocr/ocr.rb index 8eb9c149c..95c3cfb96 100644 --- a/lib/mindee/parsing/common/ocr/ocr.rb +++ b/lib/mindee/parsing/common/ocr/ocr.rb @@ -11,7 +11,7 @@ module OCR class OCRWord # The confidence score, value will be between 0.0 and 1.0 # @return [Float] - attr_accessor :confidence + attr_reader :confidence # @return [String] attr_reader :text # @return [Mindee::Geometry::Quadrilateral] @@ -36,7 +36,7 @@ def to_s # A list of words which are on the same line. class OCRLine < Array # @param prediction [Hash, nil] - # @param from_array [Array, nil] + # @param from_array [Array, nil] def initialize(prediction = nil, from_array = nil) if !prediction.nil? super(prediction.map { |word_prediction| OCRWord.new(word_prediction) }) @@ -48,9 +48,7 @@ def initialize(prediction = nil, from_array = nil) # Sort the words on the line from left to right. # @return [OCRLine] def sort_on_x - from_array = sort do |word1, word2| - Geometry.get_min_max_x(word1.polygon).min <=> Geometry.get_min_max_x(word2.polygon).min - end + from_array = sort_by { |word| Geometry.get_min_max_x(word.polygon).min } OCRLine.new(nil, from_array) end @@ -104,7 +102,7 @@ def to_s # @param indexes [Array] # @param lines [Array] def parse_one(sorted_words, current, indexes, lines) - line = OCRLine.new([]) + line = OCRLine.new(nil, []) sorted_words.each_with_index do |word, idx| next if indexes.include?(idx) diff --git a/lib/mindee/parsing/common/orientation.rb b/lib/mindee/parsing/common/orientation.rb index e8e213fd7..9d4876a81 100644 --- a/lib/mindee/parsing/common/orientation.rb +++ b/lib/mindee/parsing/common/orientation.rb @@ -5,7 +5,7 @@ module Parsing module Common # Page orientation class Orientation - # @return [Integer] + # @return [Integer, nil] attr_reader :page_id # A prediction among these 3 possible outputs: # * 0 degrees: the page is already upright @@ -15,7 +15,7 @@ class Orientation attr_reader :value # @param prediction [Hash] - # @param page_id [Integer] + # @param page_id [Integer, nil] def initialize(prediction, page_id) @value = prediction['value'] @page_id = page_id diff --git a/lib/mindee/parsing/common/product.rb b/lib/mindee/parsing/common/product.rb index c1864f714..e3f4bcd4e 100644 --- a/lib/mindee/parsing/common/product.rb +++ b/lib/mindee/parsing/common/product.rb @@ -5,7 +5,12 @@ module Parsing module Common # Product information class Product - attr_reader :name, :type, :version + # @return [String] Name of the product. + attr_reader :name + # @return [String?] Type of product. + attr_reader :type + # @return [String] Product version. + attr_reader :version # @param prediction [Hash] def initialize(prediction) diff --git a/lib/mindee/parsing/standard/amount_field.rb b/lib/mindee/parsing/standard/amount_field.rb index 63074bbda..465a97d49 100644 --- a/lib/mindee/parsing/standard/amount_field.rb +++ b/lib/mindee/parsing/standard/amount_field.rb @@ -13,12 +13,12 @@ class AmountField < BaseField def initialize(prediction, page_id, reconstructed: false) super - @value = @value.round(3) unless @value.nil? + @value = @value.to_f.round(3).to_f unless @value.to_s.empty? end # @return [String] def to_s - BaseField.float_to_string(@value) + @value.nil? ? '' : BaseField.float_to_string(@value.to_f) end end end diff --git a/lib/mindee/parsing/standard/feature_field.rb b/lib/mindee/parsing/standard/feature_field.rb index 4280104ba..ecd658fcd 100644 --- a/lib/mindee/parsing/standard/feature_field.rb +++ b/lib/mindee/parsing/standard/feature_field.rb @@ -16,7 +16,7 @@ def format_for_display(in_str, max_col_size = nil) return in_str.to_s if max_col_size.nil? in_str = in_str.to_s.gsub(%r{[\n\r\t]}, "\n" => '\\n', "\r" => '\\r', "\t" => '\\t') - in_str.to_s.length <= max_col_size.to_i ? in_str.to_s : "#{in_str[0..max_col_size.to_i - 4]}..." + in_str.to_s.length <= max_col_size.to_i ? in_str.to_s : "#{in_str[0..(max_col_size.to_i - 4)]}..." end end end diff --git a/lib/mindee/parsing/standard/tax_field.rb b/lib/mindee/parsing/standard/tax_field.rb index a449f667f..045e180fb 100644 --- a/lib/mindee/parsing/standard/tax_field.rb +++ b/lib/mindee/parsing/standard/tax_field.rb @@ -52,7 +52,7 @@ def printable_values out_h[:code] = @code.nil? ? '' : @code out_h[:base] = @base.nil? ? '' : print_float(@base) out_h[:rate] = @rate.nil? ? '' : print_float(@rate).to_s - out_h[:value] = @value.nil? ? '' : print_float(@value).to_s + out_h[:value] = @value.to_s.empty? ? '' : print_float(@value.to_f).to_s out_h end diff --git a/lib/mindee/parsing/universal/universal_list_field.rb b/lib/mindee/parsing/universal/universal_list_field.rb index 54837d58e..2602ae357 100644 --- a/lib/mindee/parsing/universal/universal_list_field.rb +++ b/lib/mindee/parsing/universal/universal_list_field.rb @@ -12,11 +12,11 @@ class UniversalListField # ID of the page (as given by the API). # @return [Integer] - attr_accessor :page_id + attr_reader :page_id # List of word values # @return [Array] - attr_accessor :values + attr_reader :values # ID of the page the object was found on. # List of word values. diff --git a/lib/mindee/parsing/universal/universal_object_field.rb b/lib/mindee/parsing/universal/universal_object_field.rb index a45db73f1..4c1740e5c 100644 --- a/lib/mindee/parsing/universal/universal_object_field.rb +++ b/lib/mindee/parsing/universal/universal_object_field.rb @@ -15,15 +15,18 @@ class UniversalObjectField # @return [Float] attr_reader :confidence # Value as String - # @return [Hash, nil] - attr_accessor :raw_value + # @return [String] + attr_reader :raw_value + # All values + # @return [Hash] + attr_reader :all_values # ID of the page the object was found on. # Confidence with which the value was assessed. # Raw unprocessed value, as it was sent by the server. def initialize(raw_prediction, page_id = nil) - @all_values = {} # : Hash[Symbol | String, untyped] + @all_values = {} # : Hash[String | Symbol, untyped] item_page_id = nil raw_prediction.each do |name, value| case name diff --git a/lib/mindee/parsing/v2.rb b/lib/mindee/parsing/v2.rb new file mode 100644 index 000000000..746d0a4b2 --- /dev/null +++ b/lib/mindee/parsing/v2.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require_relative 'v2/common_response' +require_relative 'v2/error_response' +require_relative 'v2/field' +require_relative 'v2/inference' +require_relative 'v2/inference_file' +require_relative 'v2/inference_model' +require_relative 'v2/inference_response' +require_relative 'v2/inference_result' +require_relative 'v2/inference_result_options' +require_relative 'v2/job' +require_relative 'v2/job_response' +require_relative 'v2/job_webhook' +require_relative 'v2/raw_text' diff --git a/lib/mindee/parsing/v2/common_response.rb b/lib/mindee/parsing/v2/common_response.rb new file mode 100644 index 000000000..b28938042 --- /dev/null +++ b/lib/mindee/parsing/v2/common_response.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Mindee + module Parsing + module V2 + # Base class for inference and job responses on the V2 API. + class CommonResponse + # @return [Hash] + attr_reader :raw_http + + # @param http_response [Hash] + def initialize(http_response) + @raw_http = http_response + end + end + end + end +end diff --git a/lib/mindee/parsing/v2/error_response.rb b/lib/mindee/parsing/v2/error_response.rb new file mode 100644 index 000000000..91c7d8912 --- /dev/null +++ b/lib/mindee/parsing/v2/error_response.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +module Mindee + module Parsing + module V2 + # Encapsulates information returned by the API when an error occurs. + class ErrorResponse + # @return [Integer] HTTP status code. + attr_reader :status + # @return [String] Error detail. + attr_reader :detail + + # @param server_response [Hash] Raw JSON parsed into a Hash. + def initialize(server_response) + @status = server_response['status'] + @detail = server_response['detail'] + end + + # String representation. + # @return [String] + def to_s + "Error\n=====\n:Status: #{@status}\n:Detail: #{@detail}" + end + + # Hash representation + # @return [Hash] Hash representation of the object. + def as_hash + { + status: @status, + detail: @detail, + } + end + end + end + end +end diff --git a/lib/mindee/parsing/v2/field.rb b/lib/mindee/parsing/v2/field.rb new file mode 100644 index 000000000..b90f7fc7a --- /dev/null +++ b/lib/mindee/parsing/v2/field.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require_relative 'field/base_field' +require_relative 'field/field_confidence' +require_relative 'field/field_location' +require_relative 'field/inference_fields' +require_relative 'field/list_field' +require_relative 'field/object_field' +require_relative 'field/simple_field' diff --git a/lib/mindee/parsing/v2/field/base_field.rb b/lib/mindee/parsing/v2/field/base_field.rb new file mode 100644 index 000000000..6a5966a27 --- /dev/null +++ b/lib/mindee/parsing/v2/field/base_field.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +module Mindee + module Parsing + module V2 + # Field submodule for V2. + module Field + # Base class for V2 fields. + class BaseField + # @return [Integer] Level of indentation for rst display. + attr_reader :indent_level + + # @return [FieldConfidence, nil] Confidence score for the field. + attr_reader :confidence + + # @return [Array] List of locations the field was found at. + attr_reader :locations + + # @param raw_prediction [Hash] Raw prediction hash. + # @param indent_level [Integer] Level of indentation for rst display. + def initialize(raw_prediction, indent_level = 0) + @indent_level = indent_level + @confidence = raw_prediction.key?('confidence') ? raw_prediction['confidence'] : nil + @locations = if raw_prediction.key?('locations') + raw_prediction['locations'].map do |location| + FieldLocation.new(location) + end + else + [] + end + end + + # Factory method to create appropriate field types. + # @param raw_prediction [Hash] Raw prediction hash. + # @param indent_level [Integer] Level of indentation for rst display. + # @return [BaseField] Appropriate field instance. + # @raise [MindeeError] If the field type isn't recognized. + def self.create_field(raw_prediction, indent_level = 0) + if raw_prediction.key?('items') + require_relative 'list_field' + return ListField.new(raw_prediction, indent_level) + end + + if raw_prediction.key?('fields') + require_relative 'object_field' + return ObjectField.new(raw_prediction, indent_level) + end + + if raw_prediction.key?('value') + require_relative 'simple_field' + return SimpleField.new(raw_prediction, indent_level) + end + + raise Errors::MindeeError, "Unrecognized field format in #{raw_prediction.to_json}" + end + end + end + end + end +end diff --git a/lib/mindee/parsing/v2/field/field_confidence.rb b/lib/mindee/parsing/v2/field/field_confidence.rb new file mode 100644 index 000000000..d11fa2c28 --- /dev/null +++ b/lib/mindee/parsing/v2/field/field_confidence.rb @@ -0,0 +1,91 @@ +# frozen_string_literal: true + +module Mindee + module Parsing + module V2 + module Field + # Confidence level of a field as returned by the V2 API. + class FieldConfidence + # @return [String] The confidence level value. + attr_reader :value + + # Absolute certainty about the field's extraction. + CERTAIN = 'Certain' + # High certainty about the field's extraction. + HIGH = 'High' + # Medium certainty about the field's extraction. + MEDIUM = 'Medium' + # Low certainty about the field's extraction. + LOW = 'Low' + + # List of valid values, as frozen strings. + VALID_VALUES = [CERTAIN, HIGH, MEDIUM, LOW].freeze + + # @param value [String] The confidence level value. + # @raise [ArgumentError] If the value is not a valid confidence level. + def initialize(value) + unless VALID_VALUES.include?(value) + raise ArgumentError, + "Invalid confidence level: #{value}. Must be one of: #{VALID_VALUES.join(', ')}" + end + + @value = value + end + + # Create a FieldConfidence from a string value. + # @param value [String] The confidence level string. + # @return [FieldConfidence] The confidence instance. + def self.from_string(value) + new(value) + end + + # Check if this is a certain confidence level. + # @return [Boolean] True if confidence is certain. + def certain? + @value == CERTAIN + end + + # Check if this is a high confidence level. + # @return [Boolean] True if confidence is high. + def high? + @value == HIGH + end + + # Check if this is a medium confidence level. + # @return [Boolean] True if confidence is medium. + def medium? + @value == MEDIUM + end + + # Check if this is a low confidence level. + # @return [Boolean] True if confidence is low. + def low? + @value == LOW + end + + # String representation of the confidence level. + # @return [String] The confidence level value. + def to_s + @value + end + + # Compare two FieldConfidence instances. + # @param other [FieldConfidence] The other confidence to compare. + # @return [Boolean] True if they have the same value. + def ==(other) + other.is_a?(FieldConfidence) && @value == other.value + end + + # Make instances comparable and hashable + alias eql? == + + # Inspect method for debugging. + # @return [String] Debug representation. + def inspect + "#<#{self.class.name}:#{@value}>" + end + end + end + end + end +end diff --git a/lib/mindee/parsing/v2/field/field_location.rb b/lib/mindee/parsing/v2/field/field_location.rb new file mode 100644 index 000000000..424473c9c --- /dev/null +++ b/lib/mindee/parsing/v2/field/field_location.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +require_relative '../../../geometry/polygon' + +module Mindee + module Parsing + module V2 + module Field + # Location of a field. + class FieldLocation + # @return [Mindee::Geometry::Polygon, nil] Polygon corresponding to the field location. + attr_reader :polygon + + # @return [Integer, nil] Page on which the field is located. + attr_reader :page + + # @param server_response [Hash] Raw server response hash. + def initialize(server_response) + polygon_data = server_response['polygon'] || server_response[:polygon] + @polygon = polygon_data ? Mindee::Geometry::Polygon.new(polygon_data) : nil + + page_id = server_response['page'] || server_response[:page] + @page = page_id.is_a?(Float) || page_id.is_a?(Integer) ? page_id.to_i : nil + end + + # String representation of the polygon (empty string when none). + # + # @return [String] + def to_s + @polygon ? @polygon.to_s : '' + end + end + end + end + end +end diff --git a/lib/mindee/parsing/v2/field/inference_fields.rb b/lib/mindee/parsing/v2/field/inference_fields.rb new file mode 100644 index 000000000..19debf4de --- /dev/null +++ b/lib/mindee/parsing/v2/field/inference_fields.rb @@ -0,0 +1,96 @@ +# frozen_string_literal: true + +require_relative 'base_field' + +module Mindee + module Parsing + module V2 + module Field + # Collection of inference fields that extends Hash functionality. + class InferenceFields < Hash + # @return [Integer] Level of indentation for rst display. + attr_reader :indent_level + + # @param server_response [Hash] Raw server response hash. + # @param indent_level [Integer] Level of indentation for rst display. + def initialize(server_response, indent_level = 0) + super() + @indent_level = indent_level + + server_response.each do |key, value| + self[key.to_s] = BaseField.create_field(value, 1) + end + end + + # Get a field by key with nil fallback. + # @param key [String] Field key to retrieve. + # @return [BaseField, nil] The field or nil if not found. + def get(key) + self[key] + end + + # Allow dot notation access to fields. + # @param method_name [Symbol] The method name (field key). + # @return [BaseField, nil] The field or nil if not found. + def method_missing(method_name, *args, &block) + key = method_name.to_s + if key?(key) + self[key] + else + super + end + end + + # Check if method_missing should handle the method. + # @param method_name [Symbol] The method name. + # @return [Boolean] True if the method should be handled. + def respond_to_missing?(method_name, include_private = false) + key?(method_name.to_s) || super + end + + # rubocop:disable Metrics/CyclomaticComplexity + # rubocop:disable Metrics/PerceivedComplexity + # Convert the fields to a string representation. + # @param indent [Integer, nil] Optional indentation level. + # @return [String] String representation of all fields. + def to_s(indent = 0) + return '' if empty? + + indent ||= @indent_level + padding = ' ' * indent + lines = [] + + each do |field_key, field_value| + line = "#{padding}:#{field_key}:" + + case (field_value.class.name || '').split('::').last + when 'ListField' + # Check if ListField has items and they're not empty + list_f = field_value # @type var list_f: ListField + if defined?(list_f.items) && list_f.items && !list_f.items.empty? + line += list_f.to_s + end + when 'ObjectField' + line += field_value.to_s + when 'SimpleField' + # Check if SimpleField has a non-empty value + simple_f = field_value # @type var simple_f: SimpleField + if defined?(simple_f.value) && simple_f.value && !simple_f.value.to_s.empty? + line += " #{simple_f}" + end + else + logger.debug("Unknown value was passed to the field creator: #{field_key} : #{field_value}") + end + + lines << line + end + + lines.join("\n").rstrip + end + # rubocop:enable Metrics/CyclomaticComplexity + # rubocop:enable Metrics/PerceivedComplexity + end + end + end + end +end diff --git a/lib/mindee/parsing/v2/field/list_field.rb b/lib/mindee/parsing/v2/field/list_field.rb new file mode 100644 index 000000000..8e8dcb8b4 --- /dev/null +++ b/lib/mindee/parsing/v2/field/list_field.rb @@ -0,0 +1,88 @@ +# frozen_string_literal: true + +require_relative 'base_field' + +module Mindee + module Parsing + module V2 + module Field + # Represents a field that contains a list of items. + class ListField < BaseField + include Enumerable + # @return [Array] Items contained in the list. + attr_reader :items + + # @param server_response [Hash] Raw server response hash. + # @param indent_level [Integer] Level of indentation for rst display. + # @raise [MindeeError] If the 'items' key is missing or not an array. + def initialize(server_response, indent_level = 0) + super + + unless server_response.key?('items') && server_response['items'].is_a?(Array) + raise Errors::MindeeError, + "Expected \"items\" to be an array in #{server_response.to_json}." + end + + @items = [] + server_response['items'].each do |item| + @items << BaseField.create_field(item, indent_level + 1) + end + end + + # String representation of the list field. + # @return [String] Formatted string with bullet points for each item. + def to_s + return "\n" if @items.empty? + + parts = [''] + @items.each do |item| + next unless item + + parts << if item.is_a?(ObjectField) + item.to_s_from_list + else + item.to_s + end + end + + parts.join("\n * ") + end + + # Check if the list is empty. + # @return [Boolean] True if the list has no items. + def empty? + @items.empty? + end + + # Get the number of items in the list. + # @return [Integer] Number of items. + def size + @items.size + end + + # Get the number of items in the list (alias for size). + # @return [Integer] Number of items. + def length + @items.length + end + + # Get an item by index. + # @param index [Integer] The index of the item to retrieve. + # @return [BaseField, nil] The item at the given index. + def [](index) + @items[index] + end + + # Iterator for Enumerator inheritance. + # NOTE: Untyped due to incomplete support in steep. + def each(&block) + return to_enum(:each) unless block_given? + + @items.each(&block) + self + end + end + end + end + end +end diff --git a/lib/mindee/parsing/v2/field/object_field.rb b/lib/mindee/parsing/v2/field/object_field.rb new file mode 100644 index 000000000..a68aaf4f9 --- /dev/null +++ b/lib/mindee/parsing/v2/field/object_field.rb @@ -0,0 +1,102 @@ +# frozen_string_literal: true + +require_relative 'base_field' +require_relative 'inference_fields' + +module Mindee + module Parsing + module V2 + module Field + # A field containing a nested set of inference fields. + class ObjectField < BaseField + # @return [InferenceFields] Fields contained in the object. + attr_reader :fields + + # @param raw_prediction [Hash] Raw server response hash. + # @param indent_level [Integer] Level of indentation for rst display. + def initialize(raw_prediction, indent_level = 0) + super + + inner_fields = raw_prediction.fetch('fields', raw_prediction) + @fields = InferenceFields.new(inner_fields, @indent_level + 1) + end + + # String representation of the object field. + # @return [String] String representation with newline prefix. + def to_s + return "\n" unless @fields && !@fields.empty? + + "\n#{@fields.to_s(1)}" + end + + # String representation suitable for list display. + # @return [String] String representation without leading spaces. + def to_s_from_list + return '' if @fields.nil? + return '' unless @fields && !@fields.empty? + + field_str = @fields.to_s(2) + field_str.length > 4 ? (field_str[4..] || '') : '' + end + + # String representation of a single object field + # @return [String] Multi-line string with proper indentation. + def single_str + return '' unless @fields && !@fields.empty? + + out_str = '' + indent = ' ' * @indent_level + + @fields.each do |field_key, field_value| + value_str = field_value && !field_value.to_s.empty? ? field_value.to_s : '' + out_str += "\n#{indent} :#{field_key}: #{value_str}" + end + + out_str + end + + # String representation for multi-object display + # @return [String] Formatted string for list context. + def multi_str + return '' unless @fields && !@fields.empty? + + out_str = '' + indent = ' ' * @indent_level + first = true + + @fields.each do |field_key, field_value| + value_str = field_value ? field_value.to_s : '' + + if first + out_str += "#{indent}:#{field_key}: #{value_str}" + first = false + else + out_str += "\n#{indent} :#{field_key}: #{value_str}" + end + end + + out_str + end + + # Allow dot notation access to nested fields. + # @param method_name [Symbol] The method name (field key). + # @return [ObjectField, nil] The field or nil if not found. + def method_missing(method_name, ...) + if @fields.respond_to?(method_name) + @fields.send(method_name, ...) + else + super + end + end + + # Check if method_missing should handle the method. + # @param method_name [Symbol] The method name. + # @return [Boolean] True if the method should be handled. + def respond_to_missing?(method_name, include_private = false) + @fields.respond_to?(method_name) || super + end + end + end + end + end +end diff --git a/lib/mindee/parsing/v2/field/simple_field.rb b/lib/mindee/parsing/v2/field/simple_field.rb new file mode 100644 index 000000000..aee80f638 --- /dev/null +++ b/lib/mindee/parsing/v2/field/simple_field.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +require_relative 'base_field' + +module Mindee + module Parsing + module V2 + module Field + # A simple field with a scalar value. + class SimpleField < BaseField + # @return [String, Integer, Float, Boolean, nil] Value contained in the field. + attr_reader :value + + # @param server_response [Hash] Raw server response hash. + # @param indent_level [Integer] Level of indentation for rst display. + def initialize(server_response, indent_level = 0) + super + @value = server_response.key?('value') ? server_response['value'] : nil + end + + # String representation of the field value. + # @return [String] String representation of the value. + def to_s + return '' if @value.nil? + + if @value.is_a?(TrueClass) || @value.is_a?(FalseClass) + @value ? 'True' : 'False' + elsif @value.is_a?(Integer) || @value.is_a?(Float) + # NOTE: explicitly typing because steep is very, very dumb + num = @value # @type var num: Integer | Float + format_numeric_value(num) + else + @value.to_s + end + end + + private + + # Format numeric values to display '.0' in string reps. + # @param value [Numeric] The numeric value to format. + # @return [String] Formatted numeric string. + def format_numeric_value(value) + float_value = value.to_f + + if float_value == float_value.to_i + format('%.1f', float_value) + else + formatted = format('%.5f', float_value) + formatted.sub(%r{\.?0+$}, '') + end + end + end + end + end + end +end diff --git a/lib/mindee/parsing/v2/inference.rb b/lib/mindee/parsing/v2/inference.rb new file mode 100644 index 000000000..c843196c8 --- /dev/null +++ b/lib/mindee/parsing/v2/inference.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +require_relative 'inference_model' +require_relative 'inference_file' +require_relative 'inference_result' + +module Mindee + module Parsing + module V2 + # Complete data returned by an inference request. + class Inference + # @return [InferenceModel] Information about the model used. + attr_reader :model + # @return [InferenceFile] Information about the processed file. + attr_reader :file + # @return [InferenceResult] Result contents. + attr_reader :result + # @return [String] Identifier of the inference (when provided by API). + attr_reader :id + + # @param server_response [Hash] Hash representation of the JSON returned by the service. + def initialize(server_response) + raise ArgumentError, 'server_response must be a Hash' unless server_response.is_a?(Hash) + + @model = InferenceModel.new(server_response['model']) + @file = InferenceFile.new(server_response['file']) + @result = InferenceResult.new(server_response['result']) + + @id = server_response['id'] + end + + # String representation. + # @return [String] + def to_s + [ + 'Inference', + '#########', + 'Model', + '=====', + ":ID: #{@model.id}", + '', + @file.to_s, + @result.to_s, + '', + ].join("\n") + end + end + end + end +end diff --git a/lib/mindee/parsing/v2/inference_file.rb b/lib/mindee/parsing/v2/inference_file.rb new file mode 100644 index 000000000..78dda706b --- /dev/null +++ b/lib/mindee/parsing/v2/inference_file.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +module Mindee + module Parsing + module V2 + # Information about a file returned in an inference. + class InferenceFile + # @return [String] File name. + attr_reader :name + # @return [String, nil] Optional alias for the file. + attr_reader :file_alias + # @return [Integer] Page count. + attr_reader :page_count + # @return [String] MIME type. + attr_reader :mime_type + + # @param server_response [Hash] Raw JSON parsed into a Hash. + def initialize(server_response) + @name = server_response['name'] + @file_alias = server_response['alias'] + @page_count = server_response['page_count'] + @mime_type = server_response['mime_type'] + end + + # String representation. + # @return [String] + def to_s + "File\n" \ + "====\n" \ + ":Name: #{@name}\n" \ + ":Alias:#{" #{@file_alias}" if @file_alias}\n" \ + ":Page Count: #{@page_count}\n" \ + ":MIME Type: #{@mime_type}\n" + end + end + end + end +end diff --git a/lib/mindee/parsing/v2/inference_model.rb b/lib/mindee/parsing/v2/inference_model.rb new file mode 100644 index 000000000..1ee1af2be --- /dev/null +++ b/lib/mindee/parsing/v2/inference_model.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Mindee + module Parsing + module V2 + # ID of the model that produced the inference. + class InferenceModel + # @return [String] Identifier of the model. + attr_reader :id + + # @param server_response [Hash] Raw JSON parsed into a Hash. + def initialize(server_response) + @id = server_response['id'] + end + end + end + end +end diff --git a/lib/mindee/parsing/v2/inference_response.rb b/lib/mindee/parsing/v2/inference_response.rb new file mode 100644 index 000000000..1aac55a88 --- /dev/null +++ b/lib/mindee/parsing/v2/inference_response.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +require_relative 'common_response' +require_relative 'inference' + +module Mindee + module Parsing + module V2 + # HTTP response wrapper that embeds a V2 Inference. + class InferenceResponse < CommonResponse + # @return [Inference] Parsed inference payload. + attr_reader :inference + + # @param server_response [Hash] Hash parsed from the API JSON response. + def initialize(server_response) + # CommonResponse takes care of the generic metadata (status, etc.) + super + + @inference = Inference.new(server_response['inference']) + end + + # String representation. + # @return [String] + def to_s + @inference.to_s + end + end + end + end +end diff --git a/lib/mindee/parsing/v2/inference_result.rb b/lib/mindee/parsing/v2/inference_result.rb new file mode 100644 index 000000000..857dd1077 --- /dev/null +++ b/lib/mindee/parsing/v2/inference_result.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +require_relative 'field/inference_fields' +require_relative 'inference_result_options' + +module Mindee + module Parsing + module V2 + # Wrapper for the result of a V2 inference request. + class InferenceResult + # @return [Mindee::Parsing::V2::Field::InferenceFields] Fields produced by the model. + attr_reader :fields + # @return [Mindee::Parsing::V2::InferenceResultOptions, nil] Optional extra data. + attr_reader :options + + # @param server_response [Hash] Hash version of the JSON returned by the API. + def initialize(server_response) + raise ArgumentError, 'server_response must be a Hash' unless server_response.is_a?(Hash) + + @fields = Field::InferenceFields.new(server_response['fields']) + + return unless server_response.key?('options') && server_response['options'] + + @options = InferenceResultOptions.new(server_response['options']) + end + + # String representation. + # @return [String] + def to_s + parts = [ + 'Fields', + '======', + @fields.to_s, + ] + + if @options + parts += [ + 'Options', + '=======', + @options.to_s, + ] + end + + parts.join("\n") + end + end + end + end +end diff --git a/lib/mindee/parsing/v2/inference_result_options.rb b/lib/mindee/parsing/v2/inference_result_options.rb new file mode 100644 index 000000000..ba903e7c8 --- /dev/null +++ b/lib/mindee/parsing/v2/inference_result_options.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require_relative 'raw_text' + +module Mindee + module Parsing + module V2 + # Optional data returned alongside an inference. + class InferenceResultOptions + # @return [Array] Collection of raw texts per page. + attr_reader :raw_texts + + # @param server_response [Hash] Raw JSON parsed into a Hash. + def initialize(server_response) + raw = server_response['raw_texts'] + @raw_texts = raw.is_a?(Array) ? raw.map { |rt| RawText.new(rt) } : [] + end + end + end + end +end diff --git a/lib/mindee/parsing/v2/job.rb b/lib/mindee/parsing/v2/job.rb new file mode 100644 index 000000000..5e6d9aab6 --- /dev/null +++ b/lib/mindee/parsing/v2/job.rb @@ -0,0 +1,86 @@ +# frozen_string_literal: true + +require 'date' +require_relative 'error_response' +require_relative 'job_webhook' + +module Mindee + module Parsing + module V2 + # Metadata returned when polling a job (asynchronous request). + class Job + # @return [String] Unique job identifier. + attr_reader :id + # @return [DateTime, nil] Timestamp of creation. + attr_reader :created_at + # @return [String] Identifier of the model used. + attr_reader :model_id + # @return [String] Name of the processed file. + attr_reader :filename + # @return [String] Optional alias for the file. + attr_reader :alias + # @return [String, nil] Current status (submitted, processing, done, …). + attr_reader :status + # @return [String] URL to query for updated status. + attr_reader :polling_url + # @return [String, nil] URL that redirects to the final result once ready. + attr_reader :result_url + # @return [Array] Webhooks triggered by the job. + attr_reader :webhooks + # @return [ErrorResponse, nil] Error details when the job failed. + attr_reader :error + + # @param server_response [Hash] Parsed JSON payload from the API. + def initialize(server_response) + raise ArgumentError, 'server_response must be a Hash' unless server_response.is_a?(Hash) + + @id = server_response['id'] + @status = server_response['status'] if server_response.key?('status') + unless server_response['error'].nil? || server_response['error'].empty? + @error = ErrorResponse.new(server_response['error']) + end + @created_at = Time.iso8601(server_response['created_at']) + @model_id = server_response['model_id'] + @polling_url = server_response['polling_url'] + @filename = server_response['filename'] + @result_url = server_response['result_url'] + @alias = server_response['alias'] + @webhooks = [] + server_response['webhooks'].each do |webhook| + @webhooks.push JobWebhook.new(webhook) + end + end + + # String representation. + # @return [String] + def to_s + lines = [ + 'Job', + '###', + ":ID: #{@id}", + ":CreatedAt: #{@created_at}", + ":ModelID: #{@model_id}", + ":Filename: #{@filename}", + ":Alias: #{@alias}", + ":Status: #{@status}", + ":PollingURL: #{@polling_url}", + ":ResultURL: #{@result_url}", + ] + + lines << @error.to_s if @error + + unless @webhooks.empty? + lines += [ + '', + 'Webhooks', + '=========', + @webhooks.map(&:to_s).join("\n\n"), + ] + end + + lines.join("\n") + end + end + end + end +end diff --git a/lib/mindee/parsing/v2/job_response.rb b/lib/mindee/parsing/v2/job_response.rb new file mode 100644 index 000000000..70aab84ac --- /dev/null +++ b/lib/mindee/parsing/v2/job_response.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +require_relative 'common_response' +require_relative 'job' + +module Mindee + module Parsing + module V2 + # HTTP response wrapper that embeds a V2 job. + class JobResponse < CommonResponse + # @return [Job] Parsed job payload. + attr_reader :job + + # @param server_response [Hash] Hash parsed from the API JSON response. + def initialize(server_response) + # CommonResponse takes care of the generic metadata (status, etc.) + super + + @job = Job.new(server_response['job']) + end + + # String representation. + # @return [String] + def to_s + @job.to_s + end + end + end + end +end diff --git a/lib/mindee/parsing/v2/job_webhook.rb b/lib/mindee/parsing/v2/job_webhook.rb new file mode 100644 index 000000000..4dd831853 --- /dev/null +++ b/lib/mindee/parsing/v2/job_webhook.rb @@ -0,0 +1,60 @@ +# lib/mindee/parsing/v2/job_response_webhook.rb +# frozen_string_literal: true + +require 'date' +require_relative 'error_response' + +module Mindee + module Parsing + module V2 + # Information about a webhook created for a job response. + class JobWebhook + # @return [String] Identifier of the webhook. + attr_reader :id + # @return [DateTime, nil] Creation timestamp (or +nil+ when absent). + attr_reader :created_at + # @return [String] Webhook status. + attr_reader :status + # @return [ErrorResponse, nil] Error information when something failed. + attr_reader :error + + # @param server_response [Hash] Raw JSON parsed into a Hash. + def initialize(server_response) + @id = server_response['id'] + @created_at = parse_date(server_response['created_at']) + @status = server_response['status'] + @error = ErrorResponse.new(server_response['error']) if server_response.key?('error') + end + + # RST display. + # + # @return [String] + def to_s + parts = [ + 'JobResponseWebhook', + '##################', + ":ID: #{@id}", + ":CreatedAt: #{@created_at}", + ":Status: #{@status}", + ] + + parts << @error.to_s if @error + parts.join("\n") + end + + private + + # Safely parse an ISO-8601 date/time string to DateTime. + # @param str [String, nil] The date string. + # @return [DateTime, nil] + def parse_date(str) + return nil if str.to_s.empty? + + DateTime.iso8601(str || '') + rescue ArgumentError + nil + end + end + end + end +end diff --git a/lib/mindee/parsing/v2/raw_text.rb b/lib/mindee/parsing/v2/raw_text.rb new file mode 100644 index 000000000..0aac358f5 --- /dev/null +++ b/lib/mindee/parsing/v2/raw_text.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Mindee + module Parsing + module V2 + # Raw text extracted from a given page. + class RawText + # @return [Integer] Page number where the text was found. + attr_reader :page + # @return [String] Text content. + attr_reader :content + + # @param server_response [Hash] Raw JSON parsed into a Hash. + def initialize(server_response) + @page = server_response['page'] + @content = server_response['content'] + end + end + end + end +end diff --git a/lib/mindee/pdf/extracted_pdf.rb b/lib/mindee/pdf/extracted_pdf.rb index d70f9e559..5ac3f7671 100644 --- a/lib/mindee/pdf/extracted_pdf.rb +++ b/lib/mindee/pdf/extracted_pdf.rb @@ -7,14 +7,14 @@ module PDFExtractor # An extracted sub-Pdf. class ExtractedPDF # Byte contents of the pdf - # @return [StreamIO] + # @return [StringIO] attr_reader :pdf_bytes # Name of the file. # @return [String] attr_reader :filename - # @param pdf_bytes [StreamIO] + # @param pdf_bytes [StringIO] # @param filename [String] def initialize(pdf_bytes, filename) @pdf_bytes = pdf_bytes @@ -50,7 +50,9 @@ def write_to_file(output_path, override: false) # Returns the current PDF object as a usable BytesInputSource. # @return [Mindee::Input::Source::BytesInputSource] def as_input_source - Mindee::Input::Source::BytesInputSource.new(@pdf_bytes.read, @filename) + raise Errors::MindeePDFError, 'Bytes object is nil.' if @pdf_bytes.nil? + + Mindee::Input::Source::BytesInputSource.new(@pdf_bytes.read || '', @filename) end end end diff --git a/lib/mindee/pdf/pdf_extractor.rb b/lib/mindee/pdf/pdf_extractor.rb index 2b78ebf54..45be549d8 100644 --- a/lib/mindee/pdf/pdf_extractor.rb +++ b/lib/mindee/pdf/pdf_extractor.rb @@ -29,7 +29,7 @@ def page_count # Creates a new Pdf from pages and save it into a buffer. # @param page_indexes [Array] List of page number to use for merging in the original Pdf. - # @return [StreamIO] The buffer containing the new Pdf. + # @return [StringIO] The buffer containing the new Pdf. def cut_pages(page_indexes) options = PageOptions.new(params: { page_indexes: page_indexes, @@ -75,24 +75,28 @@ def extract_sub_documents(page_indexes) # @return [Array] def extract_invoices(page_indexes, strict: false) raise Errors::MindeePDFError, 'No indexes provided.' if page_indexes.empty? + if page_indexes[0].is_a?(Array) && page_indexes[0].all? { |i| i.is_a?(Integer) } - return extract_sub_documents(page_indexes) + page_indexes_as_array = page_indexes # @type var page_indexes : Array[Array[Integer]] + return extract_sub_documents(page_indexes_as_array) end - return extract_sub_documents(page_indexes.map(&:page_indexes)) unless strict + p_ids = page_indexes # @type var page_indexes: Product::InvoiceSplitter::InvoiceSplitterV1InvoicePageGroups + return extract_sub_documents(p_ids.map(&:page_indexes)) unless strict correct_page_indexes = [] current_list = [] previous_confidence = nil - page_indexes.each_with_index do |page_index, i| - confidence = page_index.confidence + p_ids.each_with_index do |p_i, i| + page_index = p_i # @type var page_index: Product::InvoiceSplitter::InvoiceSplitterV1InvoicePageGroup + confidence = page_index.confidence.to_f page_list = page_index.page_indexes if confidence >= 0.5 && previous_confidence.nil? current_list = page_list - elsif confidence >= 0.5 && i < page_indexes.length - 1 + elsif confidence >= 0.5 && i < p_ids.length - 1 correct_page_indexes << current_list current_list = page_list - elsif confidence < 0.5 && i == page_indexes.length - 1 + elsif confidence < 0.5 && i == p_ids.length - 1 current_list.concat page_list correct_page_indexes << current_list else diff --git a/lib/mindee/pdf/pdf_processor.rb b/lib/mindee/pdf/pdf_processor.rb index 1d7e38ebd..4f37116f4 100644 --- a/lib/mindee/pdf/pdf_processor.rb +++ b/lib/mindee/pdf/pdf_processor.rb @@ -17,7 +17,7 @@ def self.parse(io_stream, options) pages_count = current_pdf.pages.size return current_pdf.to_io_stream if options.on_min_pages.to_i > pages_count - all_pages = (0..pages_count - 1).to_a + all_pages = (0..(pages_count - 1)).to_a if options.operation == :KEEP_ONLY pages_to_remove = indexes_from_keep(options.page_indexes, all_pages) @@ -31,8 +31,8 @@ def self.parse(io_stream, options) current_pdf.to_io_stream end - # @param page_indexes [Array] - # @param all_pages [Array] + # @param page_indexes [Array] + # @param all_pages [Array] def self.indexes_from_keep(page_indexes, all_pages) pages_to_keep = Set.new page_indexes.each do |idx| @@ -42,11 +42,11 @@ def self.indexes_from_keep(page_indexes, all_pages) pages_to_keep << page end - all_pages.to_set - pages_to_keep + (all_pages.to_set - pages_to_keep).to_a end - # @param page_indexes [Array[Integer]] - # @param all_pages [Array] + # @param page_indexes [Array] + # @param all_pages [Array] def self.indexes_from_remove(page_indexes, all_pages) pages_to_remove = Set.new page_indexes.each do |idx| diff --git a/lib/mindee/pdf/pdf_tools.rb b/lib/mindee/pdf/pdf_tools.rb index d11f745b1..676862f5c 100644 --- a/lib/mindee/pdf/pdf_tools.rb +++ b/lib/mindee/pdf/pdf_tools.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'origami' + module Mindee module PDF # Collection of miscellaneous PDF operations,as well as some monkey-patching for Origami. @@ -84,7 +86,7 @@ def self.source_text?(pdf_data) # Converts the given image to a binary stream using Mindee's image utilities, then creates # an Origami::Graphics::ImageXObject with a JPEG filter. # - # @param [Minimagick::Image] image An image object with the necessary data and structure. + # @param [MiniMagick::Image] image An image object with the necessary data and structure. # @return [Origami::Graphics::ImageXObject] The created image XObject. def self.create_xobject(image) image_io = Mindee::Image::ImageUtils.image_to_stringio(image) @@ -153,7 +155,7 @@ def self.set_page_dimensions(page, width, height) # Processes an image into an image XObject for PDF embedding. # - # @param [Hash] image_data The raw image data. + # @param [MiniMagick::Image, StringIO] image_data The raw image data. # @param [Integer] image_quality The quality setting for image compression. # @param [Numeric] width The desired width of the output image. # @param [Numeric] height The desired height of the output image. diff --git a/lib/mindee/product/universal/universal_prediction.rb b/lib/mindee/product/universal/universal_prediction.rb index 144d0a588..b933984cd 100644 --- a/lib/mindee/product/universal/universal_prediction.rb +++ b/lib/mindee/product/universal/universal_prediction.rb @@ -16,7 +16,7 @@ class UniversalPrediction < Mindee::Parsing::Common::Prediction def initialize(_ = nil) super - @fields = {} # : Hash[Symbol | String, untyped] + @fields = {} # : Hash[String | Symbol, untyped] end # String representation. @@ -81,7 +81,7 @@ def generate_sub_value_string(field_name, sub_value, pattern) # Returns a hash of all fields that aren't a collection # @return [Hash] def single_fields - single_fields = {} # : Hash[Symbol | String, untyped] + single_fields = {} # : Hash[String | Symbol, untyped] @fields.each do |field_name, field_value| single_fields[field_name] = field_value if field_value.is_a?(Mindee::Parsing::Standard::StringField) end @@ -91,7 +91,7 @@ def single_fields # Returns a hash of all list-like fields # @return [Hash] def list_fields - list_fields = {} # : Hash[Symbol | String, Mindee::Parsing::Universal::UniversalListField] + list_fields = {} # : Hash[String | Symbol, Mindee::Parsing::Universal::UniversalListField] @fields.each do |field_name, field_value| list_fields[field_name] = field_value if field_value.is_a?(Mindee::Parsing::Universal::UniversalListField) end @@ -101,7 +101,7 @@ def list_fields # Returns a hash of all object-like fields # @return [Hash] def object_fields - object_fields = {} # : Hash[Symbol | String, untyped] + object_fields = {} # : Hash[String | Symbol, untyped] @fields.each do |field_name, field_value| if field_value.is_a?(Mindee::Parsing::Universal::UniversalObjectField) object_fields[field_name] = diff --git a/lib/mindee/version.rb b/lib/mindee/version.rb index 9a596b496..5ee24504b 100644 --- a/lib/mindee/version.rb +++ b/lib/mindee/version.rb @@ -6,7 +6,7 @@ module Mindee VERSION = '4.6.0' # Finds and return the current platform. - # @return [Symbol, Hash[Symbol | String, Regexp], Nil?] + # @return [Symbol, Hash[String | Symbol, Regexp], Nil?] def self.find_platform host = RbConfig::CONFIG['host_os'] platforms = { diff --git a/sig/custom/mini_magick.rbs b/sig/custom/mini_magick.rbs index d52fbfad1..78111ac23 100644 --- a/sig/custom/mini_magick.rbs +++ b/sig/custom/mini_magick.rbs @@ -1,24 +1,31 @@ # Stub for the mini_magick library. +# Note: though typing annotations for the MiniMagick library now exist, it seems that they aren't strict enough +# to match the rules we have on the repo, hence the existence of this file and the overrides present below. module MiniMagick class Image - def format: (String, ?Integer?, ?Hash[Symbol, untyped]?) -> Net::BufferedIO def self.format: (String, ?Integer?, ?Hash[Symbol, untyped]?) -> Net::BufferedIO + def format: (String, ?Integer?, ?Hash[Symbol, untyped]?) -> Net::BufferedIO def self.quality: (String) -> Net::BufferedIO def self.crop: (String) -> Net::BufferedIO + def crop: (String) -> Net::BufferedIO def self.height: () -> Integer - def height: () -> Integer def self.width: () -> Integer + def height: () -> Integer def width: () -> Integer - def self.read: (untyped) -> self + def self.data: (?untyped?, ?untyped?) -> untyped + def data: (?untyped?, ?untyped) -> instance + def self.read: (?untyped?, ?untyped?) -> Image + def read: (?untyped?, ?untyped) -> Image def self.resolution: () -> Array[Float | Integer] + def resolution: () -> Array[Float | Integer] def self.write: (StringIO | String) -> Net::BufferedIO def write: (StringIO | String) -> Net::BufferedIO - def quality: (Integer) -> void + def quality: (String) -> void def self.resize: (String) -> void def resize: (String) -> void def self.to_blob: () -> String def to_blob: () -> String - def self.[]: (?untyped) -> untyped - def []: (?untyped) -> untyped + def self.[]: (*untyped) -> untyped + def []: (*untyped) -> untyped end -end \ No newline at end of file +end diff --git a/sig/custom/net_http.rbs b/sig/custom/net_http.rbs index 5bfa33318..9d24bc515 100644 --- a/sig/custom/net_http.rbs +++ b/sig/custom/net_http.rbs @@ -12,7 +12,7 @@ module Net # Stub for the HTTP POST request class. class Post - def initialize: (untyped, Hash[String, String]?) -> void + def initialize: (untyped, Hash[String, String?]?) -> void def set_form: (untyped, String?) -> void def new: (untyped, untyped) -> void def []=: (?untyped, ?untyped) -> bool @@ -20,7 +20,7 @@ module Net # Stub for the HTTP GET request class. class Get - def initialize: (untyped, ?Hash[String, String]?) -> void + def initialize: (untyped, ?Hash[String, String?]?) -> void def new: (untyped, untyped) -> void def basic_auth: (untyped, untyped) -> void def []=: (?untyped, ?untyped) -> bool @@ -28,8 +28,8 @@ module Net end class HTTPResponse - def self.body: -> untyped - def body: -> untyped + def self.body: -> String + def body: -> String def []: (untyped) -> untyped def key?: (untyped) -> bool def code: -> String diff --git a/sig/custom/origami.rbs b/sig/custom/origami.rbs index 2f9b1e4e5..f203f39bb 100644 --- a/sig/custom/origami.rbs +++ b/sig/custom/origami.rbs @@ -1,21 +1,22 @@ # Stubs for the origami library. # This one _should_ exist, but it would take too long, so this is a stub. module Origami + def compile: (Hash[Symbol, untyped]) -> void class Array def each: { (untyped) -> untyped } -> untyped end class PDF - def self.read: (StringIO) -> untyped + def self.read: (StringIO | File) -> untyped def initialize: () -> void def append_page: (Page) -> void def delete_pages_at: (::Array[Integer]) -> void - def pages: () -> untyped - def save: (StringIO) -> void + def pages: () -> ::Array[Page] + def save: (StringIO | File) -> void def to_io_stream: -> StringIO class LinearParser def initialize: (Hash[Symbol, untyped]) -> void def new: (Hash[Symbol, untyped]) -> void - def parse: (StringIO?) -> PDF + def parse: (StringIO | File?) -> PDF end end @@ -23,6 +24,9 @@ module Origami def initialize: () -> void def add_xobject: (Graphics::ImageXObject, String) -> untyped def Contents: (?untyped?) -> untyped + def Contents=: (?untyped?, untyped?) -> untyped + def []: (untyped) -> untyped + def []=: (untyped, untyped) -> bool end module Graphics @@ -31,6 +35,7 @@ module Origami def BitsPerComponent=: (Integer) -> untyped def ColorSpace=: (Symbol) -> untyped + def dictionary: () -> Hash[Symbol, untyped] def data=: (StringIO) -> untyped def self.from_image_file: (StringIO, String) -> untyped def Height=: (Integer | Float) -> untyped diff --git a/sig/mindee/client.rbs b/sig/mindee/client.rbs index 4d5fb2711..f4311337b 100644 --- a/sig/mindee/client.rbs +++ b/sig/mindee/client.rbs @@ -1,16 +1,8 @@ -OTS_OWNER: String +# lib/mindee/client.rb module Mindee OTS_OWNER: String - class PageOptions - attr_accessor page_indexes: Array[Integer] - attr_accessor operation: :KEEP_ONLY | :REMOVE - attr_accessor on_min_pages: Integer? - - def initialize: (params: Hash[Symbol | String, untyped]) -> void - end - class ParseOptions attr_accessor all_words: bool attr_accessor full_text: bool @@ -18,12 +10,12 @@ module Mindee attr_accessor page_options: PageOptions attr_accessor cropper: bool attr_accessor rag: bool - attr_accessor workflow_id: String | nil + attr_accessor workflow_id: String? attr_accessor initial_delay_sec: Integer | Float attr_accessor delay_sec: Integer | Float attr_accessor max_retries: Integer - def initialize: (params: Hash[Symbol | String, untyped]) -> void + def initialize: (params: Hash[String | Symbol, untyped]) -> void end class WorkflowOptions @@ -33,19 +25,22 @@ module Mindee attr_accessor rag: bool? attr_accessor public_url: (String?) attr_accessor page_options: (PageOptions) + attr_accessor close_file: bool - def initialize: (params: Hash[Symbol | String, untyped]) -> void + def initialize: (params: Hash[String | Symbol, untyped]) -> void end class Client + @api_key: String? + def initialize: (?api_key: String) -> void - def logger: () -> untyped - def parse: (Input::Source::LocalInputSource | Input::Source::URLInputSource, untyped, ?endpoint: (HTTP::Endpoint?), options: ParseOptions | Hash[Symbol | String, untyped]) -> Parsing::Common::ApiResponse - def parse_sync: (Input::Source::LocalInputSource | Input::Source::URLInputSource, untyped, HTTP::Endpoint, ParseOptions) -> Parsing::Common::ApiResponse - def enqueue: (Input::Source::LocalInputSource | Input::Source::URLInputSource, untyped, ?endpoint: (HTTP::Endpoint?), options: ParseOptions|Hash[Symbol | String, untyped]) -> Parsing::Common::ApiResponse + def logger: () -> Logging + def parse: (Input::Source::LocalInputSource | Input::Source::URLInputSource, singleton(Parsing::Common::Inference), ?endpoint: (HTTP::Endpoint?), options: ParseOptions | Hash[String | Symbol, untyped]) -> Parsing::Common::ApiResponse + def parse_sync: (Input::Source::LocalInputSource | Input::Source::URLInputSource, singleton(Parsing::Common::Inference), HTTP::Endpoint, ParseOptions) -> Parsing::Common::ApiResponse + def enqueue: (Input::Source::LocalInputSource | Input::Source::URLInputSource, singleton(Parsing::Common::Inference), ?endpoint: (HTTP::Endpoint?), options: ParseOptions|Hash[String | Symbol, untyped]) -> Parsing::Common::ApiResponse def parse_queued: (String, singleton(Parsing::Common::Inference), ?endpoint: HTTP::Endpoint?) -> Parsing::Common::ApiResponse - def enqueue_and_parse: (Input::Source::URLInputSource|Input::Source::LocalInputSource, untyped, HTTP::Endpoint, ParseOptions) -> Parsing::Common::ApiResponse - def execute_workflow: (Input::Source::URLInputSource|Input::Source::LocalInputSource, String, options: (Hash[Symbol | String, untyped] | WorkflowOptions)) -> Parsing::Common::WorkflowResponse + def enqueue_and_parse: (Input::Source::URLInputSource|Input::Source::LocalInputSource, singleton(Parsing::Common::Inference), HTTP::Endpoint, ParseOptions) -> Parsing::Common::ApiResponse + def execute_workflow: (Input::Source::URLInputSource|Input::Source::LocalInputSource, String, options: (Hash[String | Symbol, untyped] | WorkflowOptions)) -> Parsing::Common::WorkflowResponse def load_prediction: (singleton(Parsing::Common::Inference), Input::LocalResponse) -> Parsing::Common::ApiResponse def source_from_path: (String, ?repair_pdf: bool) -> Input::Source::PathInputSource def source_from_bytes: (String, String, ?repair_pdf: bool) -> Input::Source::BytesInputSource @@ -55,7 +50,7 @@ module Mindee def create_endpoint: (endpoint_name: String, account_name: String, version: String) -> HTTP::Endpoint private - def normalize_parse_options: ((Hash[Symbol | String, untyped] | ParseOptions)) -> ParseOptions + def normalize_parse_options: ((Hash[String | Symbol, untyped] | ParseOptions)) -> ParseOptions def process_pdf_if_required: (Input::Source::LocalInputSource, ParseOptions | WorkflowOptions) -> void def initialize_endpoint: (singleton(Parsing::Common::Inference), ?endpoint_name: String, ?account_name: String, ?version: String) -> HTTP::Endpoint def validate_async_params: (Integer | Float, Integer | Float, Integer) -> void diff --git a/sig/mindee/client_v2.rbs b/sig/mindee/client_v2.rbs new file mode 100644 index 000000000..d33cdbb5a --- /dev/null +++ b/sig/mindee/client_v2.rbs @@ -0,0 +1,17 @@ +# lib/mindee/client_v2.rb + +OTS_OWNER: String +module Mindee + class ClientV2 + attr_reader mindee_api: HTTP::MindeeApiV2 + + def logger: () -> Logger + def initialize: (?api_key: String) -> void + def get_inference: (String) -> Parsing::V2::InferenceResponse + def get_job: (String) -> Parsing::V2::JobResponse + def enqueue_inference: (Input::Source::LocalInputSource | Input::Source::URLInputSource, Hash[String | Symbol, untyped] | Input::InferenceParameters) -> Parsing::V2::JobResponse + def enqueue_and_get_inference: (Input::Source::LocalInputSource | Input::Source::URLInputSource, Hash[String | Symbol, untyped] | Input::InferenceParameters) -> Parsing::V2::InferenceResponse + def validate_async_params: (Integer | Float, Integer | Float, Integer) -> void + def normalize_inference_parameters: (Hash[String | Symbol, untyped] | Input::InferenceParameters) -> Input::InferenceParameters + end +end diff --git a/sig/mindee/errors/mindee_http_error.rbs b/sig/mindee/errors/mindee_http_error.rbs index 29eaedc04..2811fa700 100644 --- a/sig/mindee/errors/mindee_http_error.rbs +++ b/sig/mindee/errors/mindee_http_error.rbs @@ -2,11 +2,12 @@ module Mindee module Errors class MindeeHTTPError < Errors::MindeeError - def status_code: -> untyped - def api_code: -> untyped - def api_details: -> untyped - def api_message: -> untyped - def initialize: (untyped, untyped, untyped) -> untyped + attr_reader api_code: Integer + attr_reader api_details: String + attr_reader api_message: String + attr_reader status_code: Integer + + def initialize: (Hash[String | Symbol, untyped], String, Integer) -> void end class MindeeHTTPClientError < MindeeHTTPError end diff --git a/sig/mindee/errors/mindee_http_error_v2.rbs b/sig/mindee/errors/mindee_http_error_v2.rbs new file mode 100644 index 000000000..b687f43cc --- /dev/null +++ b/sig/mindee/errors/mindee_http_error_v2.rbs @@ -0,0 +1,12 @@ +# lib/mindee/errors/mindee_http_error_v2.rb +module Mindee + module Errors + # API V2 HttpError + class MindeeHTTPErrorV2 < MindeeError + + attr_reader detail: String + attr_reader status: Integer + def initialize: (Hash[String, untyped] | Parsing::V2::ErrorResponse) -> void + end + end +end diff --git a/sig/mindee/errors/mindee_input_error.rbs b/sig/mindee/errors/mindee_input_error.rbs index 170440e06..94fd985f5 100644 --- a/sig/mindee/errors/mindee_input_error.rbs +++ b/sig/mindee/errors/mindee_input_error.rbs @@ -6,8 +6,9 @@ module Mindee class MindeeSourceError < MindeeInputError end class MindeeMimeTypeError < MindeeSourceError - def invalid_mimetype: -> untyped - def initialize: (untyped) -> untyped + attr_reader invalid_mimetype: String + + def initialize: (String) -> void end class MindeeImageError < MindeeInputError end diff --git a/sig/mindee/geometry/min_max.rbs b/sig/mindee/geometry/min_max.rbs index 9735cd3bd..27144eae8 100644 --- a/sig/mindee/geometry/min_max.rbs +++ b/sig/mindee/geometry/min_max.rbs @@ -2,9 +2,10 @@ module Mindee module Geometry class MinMax - def min: -> untyped - def max: -> untyped - def initialize: (untyped, untyped) -> untyped + attr_reader max: Float + attr_reader min: Float + + def initialize: (Float, Float) -> void end end end diff --git a/sig/mindee/geometry/point.rbs b/sig/mindee/geometry/point.rbs index edbb9f789..9bac0dcf2 100644 --- a/sig/mindee/geometry/point.rbs +++ b/sig/mindee/geometry/point.rbs @@ -2,12 +2,11 @@ module Mindee module Geometry class Point - def x: -> untyped - def x=: (untyped) -> untyped - def y: -> untyped - def y=: (untyped) -> untyped - def initialize: (untyped, untyped) -> untyped - def []: (untyped) -> bot + attr_accessor x: Float + attr_accessor y: Float + + def initialize: (Float, Float) -> void + def []: (Integer) -> Float end end end diff --git a/sig/mindee/geometry/polygon.rbs b/sig/mindee/geometry/polygon.rbs index 5100a56f0..559d912d6 100644 --- a/sig/mindee/geometry/polygon.rbs +++ b/sig/mindee/geometry/polygon.rbs @@ -1,9 +1,9 @@ # lib/mindee/geometry/polygon.rb module Mindee module Geometry - class Polygon < Array[untyped] - def centroid: -> untyped - def point_in_y?: (untyped) -> untyped + class Polygon < Array[Point] + def centroid: -> Point + def point_in_y?: (Point) -> bool end end end diff --git a/sig/mindee/geometry/quadrilateral.rbs b/sig/mindee/geometry/quadrilateral.rbs index 421ce9161..df65cae15 100644 --- a/sig/mindee/geometry/quadrilateral.rbs +++ b/sig/mindee/geometry/quadrilateral.rbs @@ -2,14 +2,11 @@ module Mindee module Geometry class Quadrilateral - def top_left: -> Point - def top_left=: (Point) -> bool - def top_right: -> Point - def top_right=: (Point) -> untyped - def bottom_right: -> Point - def bottom_right=: (Point) -> untyped - def bottom_left: -> Point - def bottom_left=: (Point) -> untyped + attr_accessor bottom_left: Point + attr_accessor bottom_right: Point + attr_accessor top_left: Point + attr_accessor top_right: Point + def initialize: (Point, Point, Point, Point) -> void def []: (Integer) -> Point def size: -> Integer diff --git a/sig/mindee/geometry/utils.rbs b/sig/mindee/geometry/utils.rbs index cfb2f36bb..3631722cb 100644 --- a/sig/mindee/geometry/utils.rbs +++ b/sig/mindee/geometry/utils.rbs @@ -1,13 +1,13 @@ # lib/mindee/geometry/utils.rb module Mindee module Geometry - def self.quadrilateral_from_prediction: (untyped) -> untyped - def self.polygon_from_prediction: (untyped) -> untyped - def self.get_bbox: (untyped) -> [untyped, untyped, untyped, untyped] - def self.get_bounding_box: (untyped) -> Quadrilateral - def self.get_centroid: (untyped) -> untyped - def self.get_min_max_y: (untyped) -> untyped - def self.get_min_max_x: (untyped) -> untyped - def self.below?: (untyped, untyped, untyped, untyped) -> bool + def self.quadrilateral_from_prediction: (Array[Array[Float]]) -> Quadrilateral + def self.polygon_from_prediction: (Array[Array[Float]]) -> Polygon + def self.get_bbox: (Array[Point]) -> [Float, Float, Float, Float] + def self.get_bounding_box: (Array[Point]) -> Quadrilateral + def self.get_centroid: (Array[Point]) -> Point + def self.get_min_max_y: (Array[Point]) -> MinMax + def self.get_min_max_x: (Array[Point]) -> MinMax + def self.below?: (Array[Point], Array[Point], Float, Float) -> bool end end diff --git a/sig/mindee/http/api_settings_v2.rbs b/sig/mindee/http/api_settings_v2.rbs new file mode 100644 index 000000000..594b926cd --- /dev/null +++ b/sig/mindee/http/api_settings_v2.rbs @@ -0,0 +1,23 @@ +# lib/mindee/http/api_settings_v2.rb +module Mindee + module HTTP + class ApiSettingsV2 + MINDEE_V2_API_KEY_ENV_NAME: String + MINDEE_V2_API_KEY_DEFAULT: String? + MINDEE_V2_BASE_URL_ENV_NAME: String + MINDEE_V2_BASE_URL_DEFAULT: String + MINDEE_V2_REQUEST_TIMEOUT_ENV_NAME: String + MINDEE_V2_TIMEOUT_DEFAULT: Integer + USER_AGENT: String + + def logger: () -> Logger + attr_reader api_key: String? + attr_reader base_url: String + attr_reader request_timeout: Integer + attr_reader user_agent: String + + def initialize: (?api_key: String?) -> void + def check_api_key: -> void + end + end +end diff --git a/sig/mindee/http/endpoint.rbs b/sig/mindee/http/endpoint.rbs index a6946d8ce..960b59cdf 100644 --- a/sig/mindee/http/endpoint.rbs +++ b/sig/mindee/http/endpoint.rbs @@ -2,25 +2,26 @@ module Mindee module HTTP API_KEY_ENV_NAME: String - API_KEY_DEFAULT: nil + API_KEY_DEFAULT: String? BASE_URL_ENV_NAME: String BASE_URL_DEFAULT: String REQUEST_TIMEOUT_ENV_NAME: String TIMEOUT_DEFAULT: Integer USER_AGENT: String class Endpoint - def logger: () -> untyped - def api_key: -> String? - def request_timeout: -> Integer - def url_root: -> String - def base_url: -> String - def initialize: (String, String, String | nil, ?api_key: String) -> String - def predict: (Input::Source::LocalInputSource | Input::Source::URLInputSource, ParseOptions) -> [Net::HTTPResponse, Hash[Symbol, untyped]] - def predict_async: (Input::Source::LocalInputSource | Input::Source::URLInputSource, ParseOptions) -> [Net::HTTPResponse, Hash[Symbol, untyped]] - def parse_async: (String) -> [Net::HTTPResponse, Hash[Symbol, untyped]] + attr_reader api_key: String + attr_reader base_url: String + attr_reader request_timeout: Integer + attr_reader url_root: String + + def logger: () -> Logger + def initialize: (String, String, String?, ?api_key: String) -> String + def predict: (Input::Source::LocalInputSource | Input::Source::URLInputSource, ParseOptions) -> [Hash[String | Symbol, untyped], String] + def predict_async: (Input::Source::LocalInputSource | Input::Source::URLInputSource, ParseOptions) -> [Hash[String | Symbol, untyped], String] + def parse_async: (String) -> [Hash[String | Symbol, untyped], String] def predict_req_post: (Input::Source::LocalInputSource | Input::Source::URLInputSource, ParseOptions) -> Net::HTTPResponse def document_queue_req_post: (Input::Source::LocalInputSource | Input::Source::URLInputSource, ParseOptions) -> Net::HTTPResponse - def document_queue_req_get: (untyped) -> Net::HTTPResponse + def document_queue_req_get: (String) -> Net::HTTPResponse def check_api_key: -> void end end diff --git a/sig/mindee/http/http_error_handler.rbs b/sig/mindee/http/http_error_handler.rbs index 3a1388305..1ab8b3697 100644 --- a/sig/mindee/http/http_error_handler.rbs +++ b/sig/mindee/http/http_error_handler.rbs @@ -2,9 +2,14 @@ module Mindee module HTTP module ErrorHandler - def extract_error: (untyped) -> nil - def create_error_obj: (untyped) -> (Hash[String, String] | Hash[untyped, untyped])? - def self.handle_error: (untyped, untyped) -> untyped + def extract_error: (Hash[String | Symbol, untyped]) -> Hash[String | Symbol, untyped]? + def create_error_obj: (Hash[String | Symbol, untyped]) -> Hash[String | Symbol, untyped] + def self.generate_v2_error: (Hash[String, Integer | String]) -> Errors::MindeeHTTPErrorV2 + def generate_v2_error: (Hash[Symbol, String | Integer]) -> Errors::MindeeHTTPErrorV2 + + def self.handle_error: (String, Net::HTTPResponse) -> Errors::MindeeHTTPError + def handle_error: (String, Net::HTTPResponse) -> Errors::MindeeHTTPError + def handle_v2_error: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/http/mindee_api_v2.rbs b/sig/mindee/http/mindee_api_v2.rbs new file mode 100644 index 000000000..8aa55f036 --- /dev/null +++ b/sig/mindee/http/mindee_api_v2.rbs @@ -0,0 +1,18 @@ +# lib/mindee/http/mindee_api_v2.rb +module Mindee + module HTTP + class MindeeApiV2 + attr_reader settings: ApiSettingsV2 + + def initialize: (?api_key: String?) -> void + def req_post_inference_enqueue: (Input::Source::LocalInputSource | Input::Source::URLInputSource, Input::InferenceParameters) -> Parsing::V2::JobResponse + def req_get_inference: (String) -> Parsing::V2::InferenceResponse + def req_get_job: (String) -> Parsing::V2::JobResponse + def process_response: (Net::HTTPResponse?) -> Hash[String | Symbol, untyped] + def poll: (String) -> Net::HTTPResponse + def inference_job_req_get: (String) -> Net::HTTPResponse + def inference_result_req_get: (String) -> Net::HTTPResponse + def enqueue: (Input::Source::LocalInputSource | Input::Source::URLInputSource, Input::InferenceParameters) -> Net::HTTPResponse? + end + end +end diff --git a/sig/mindee/http/response_validation.rbs b/sig/mindee/http/response_validation.rbs index 447a6aa91..142a7eb92 100644 --- a/sig/mindee/http/response_validation.rbs +++ b/sig/mindee/http/response_validation.rbs @@ -3,6 +3,7 @@ module Mindee module HTTP module ResponseValidation def self.valid_sync_response?: (Net::HTTPResponse) -> bool + def self.valid_v2_response?: (Net::HTTPResponse) -> bool def self.valid_async_response?: (Net::HTTPResponse) -> bool def self.clean_request!: (Net::HTTPResponse) -> void end diff --git a/sig/mindee/http/workflow_endpoint.rbs b/sig/mindee/http/workflow_endpoint.rbs index 89a609d89..6795f44f2 100644 --- a/sig/mindee/http/workflow_endpoint.rbs +++ b/sig/mindee/http/workflow_endpoint.rbs @@ -10,7 +10,7 @@ module Mindee def initialize: (untyped, ?api_key: String) -> String - def execute_workflow: (Input::Source::LocalInputSource | Input::Source::URLInputSource, WorkflowOptions) -> [untyped, untyped] + def execute_workflow: (Input::Source::LocalInputSource | Input::Source::URLInputSource, WorkflowOptions) -> [Hash[String, untyped], String] def workflow_execution_req_post: (Input::Source::LocalInputSource | Input::Source::URLInputSource, WorkflowOptions) -> Net::HTTPResponse? diff --git a/sig/mindee/image/extracted_image.rbs b/sig/mindee/image/extracted_image.rbs index 2ad71f567..8f7c3d872 100644 --- a/sig/mindee/image/extracted_image.rbs +++ b/sig/mindee/image/extracted_image.rbs @@ -2,13 +2,13 @@ module Mindee module Image class ExtractedImage - def logger: () -> untyped + def logger: () -> Logger def page_id: -> Integer def element_id: -> Integer def buffer: -> StringIO def internal_file_name: -> String def initialize: (Input::Source::LocalInputSource, Integer, Integer) -> Integer - def write_to_file: (String, ?String?) -> nil + def write_to_file: (String, ?String?) -> void def as_source: -> Input::Source::BytesInputSource end end diff --git a/sig/mindee/image/image_compressor.rbs b/sig/mindee/image/image_compressor.rbs index dd4eda57b..d40e4078e 100644 --- a/sig/mindee/image/image_compressor.rbs +++ b/sig/mindee/image/image_compressor.rbs @@ -2,7 +2,7 @@ module Mindee module Image module ImageCompressor - def self.compress_image: (singleton(MiniMagick::Image) | MiniMagick::Image | StringIO, ?quality: Integer, ?max_width: Integer?, ?max_height: Integer?) -> StringIO + def self.compress_image: (MiniMagick::Image | StringIO | File, ?quality: Integer | Float?, ?max_width: Integer | Float?, ?max_height: Integer | Float?) -> StringIO end end end diff --git a/sig/mindee/image/image_extractor.rbs b/sig/mindee/image/image_extractor.rbs index a8fcb8150..a92fe154c 100644 --- a/sig/mindee/image/image_extractor.rbs +++ b/sig/mindee/image/image_extractor.rbs @@ -2,12 +2,12 @@ module Mindee module Image module ImageExtractor - def self.attach_image_as_new_file: (untyped, ?format: String) -> untyped + def self.attach_image_as_new_file: (StringIO | File, ?format: String) -> Origami::PDF def self.to_blob: () -> String - def self.extract_multiple_images_from_source: (untyped, untyped, untyped) -> Array[untyped] - def self.extract_images_from_polygons: (untyped, untyped, untyped, untyped) -> Array[untyped] - def self.create_extracted_image: (StringIO, String, untyped, untyped) -> untyped - def self.load_input_source_pdf_page_as_stringio: (untyped, untyped) -> untyped + def self.extract_multiple_images_from_source: (Input::Source::LocalInputSource, Integer, Array[Array[Geometry::Point] |Geometry::Polygon | Geometry::Quadrilateral]) -> Array[ExtractedImage] + def self.extract_images_from_polygons: (Input::Source::LocalInputSource, StringIO | File, Integer, Array[Array[Geometry::Point] | Geometry::Polygon | Geometry::Quadrilateral]) -> Array[ExtractedImage] + def self.create_extracted_image: (StringIO | File, String, Integer, Integer) -> void + def self.load_input_source_pdf_page_as_stringio: (Input::Source::LocalInputSource, Integer) -> (StringIO | File) end end end diff --git a/sig/mindee/image/image_utils.rbs b/sig/mindee/image/image_utils.rbs index 24bdaa885..d4d853d5c 100644 --- a/sig/mindee/image/image_utils.rbs +++ b/sig/mindee/image/image_utils.rbs @@ -2,17 +2,17 @@ module Mindee module Image module ImageUtils - def self.resize_image: (singleton(MiniMagick::Image) | MiniMagick::Image, Integer, Integer) -> void - def self.compress_image_quality: (singleton(MiniMagick::Image) | MiniMagick::Image, untyped) -> untyped - def self.to_image: (singleton(MiniMagick::Image) | MiniMagick::Image | StringIO | IO | File | Tempfile?) -> (singleton(MiniMagick::Image) | MiniMagick::Image) - def self.image_to_stringio: (singleton(MiniMagick::Image) | MiniMagick::Image, ?String) -> StringIO - def self.calculate_new_dimensions: (singleton(MiniMagick::Image) | MiniMagick::Image, ?max_width: Integer | Float?, ?max_height: Integer | Float?) -> [Integer, Integer] - def self.calculate_dimensions_from_media_box: (singleton(MiniMagick::Image) | MiniMagick::Image, Array[Integer]?) -> [Integer, Integer] - def self.pdf_to_magick_image: (StringIO, Integer) -> singleton(MiniMagick::Image) + def self.resize_image: (MiniMagick::Image, Integer, Integer) -> void + def self.compress_image_quality: (MiniMagick::Image, untyped) -> void + def self.to_image: (MiniMagick::Image | StringIO | IO | File | Tempfile?) -> (MiniMagick::Image) + def self.image_to_stringio: (MiniMagick::Image, ?String) -> StringIO + def self.calculate_new_dimensions: (MiniMagick::Image, ?max_width: Integer | Float?, ?max_height: Integer | Float?) -> [Integer, Integer] + def self.calculate_dimensions_from_media_box: (MiniMagick::Image, Array[Integer]?) -> [Integer, Integer] + def self.pdf_to_magick_image: (StringIO | File, Integer) -> MiniMagick::Image def self.normalize_polygon: (Geometry::Quadrilateral | Geometry::Polygon | Array[Geometry::Point]) -> Geometry::Quadrilateral - def self.read_page_content: (StringIO) -> singleton(MiniMagick::Image) - def self.crop_image: (singleton(MiniMagick::Image), Geometry::MinMax, Geometry::MinMax) -> singleton(MiniMagick::Image) - def self.write_image_to_buffer: (singleton(MiniMagick::Image) | MiniMagick::Image, StringIO) -> Net::BufferedIO + def self.read_page_content: (StringIO | File) -> (MiniMagick::Image) + def self.crop_image: (MiniMagick::Image, Geometry::MinMax, Geometry::MinMax) -> (MiniMagick::Image) + def self.write_image_to_buffer: (MiniMagick::Image, StringIO) -> void def self.determine_file_extension: (Input::Source::LocalInputSource) -> String? end end diff --git a/sig/mindee/input/inference_parameters.rbs b/sig/mindee/input/inference_parameters.rbs new file mode 100644 index 000000000..84ae52012 --- /dev/null +++ b/sig/mindee/input/inference_parameters.rbs @@ -0,0 +1,30 @@ +# lib/mindee/input/inference_parameters.rb +module Mindee + module Input + class InferenceParameters + attr_reader close_file: bool + attr_reader file_alias: String? + attr_reader model_id: String + attr_reader polling_options: PollingOptions + attr_reader rag: bool? + attr_reader webhook_ids: Array[String]? + + def initialize: ( + String, + ?rag: bool?, + ?file_alias: String?, + ?webhook_ids: Array[String]?, + ?polling_options: Hash[Symbol | String, untyped] | PollingOptions?, + ?close_file: bool? + ) -> void + + def self.from_hash: (params: Hash[String | Symbol, untyped]) -> InferenceParameters + + def validate_async_params: -> void + + private + + def get_clean_polling_options: (Hash[String | Symbol, untyped] | PollingOptions?) -> PollingOptions + end + end +end diff --git a/sig/mindee/input/local_response.rbs b/sig/mindee/input/local_response.rbs index 40306b8f0..622c229dd 100644 --- a/sig/mindee/input/local_response.rbs +++ b/sig/mindee/input/local_response.rbs @@ -3,11 +3,12 @@ module Mindee module Input class LocalResponse def file: -> StringIO - def initialize: (untyped) -> Integer - def as_hash: -> nil - def self.process_secret_key: (untyped) -> untyped - def get_hmac_signature: (untyped) -> untyped - def valid_hmac_signature?: (untyped, untyped) -> untyped + def initialize: (File | IO | StringIO | String | Pathname) -> void + def as_hash: -> Hash[String | Symbol, untyped] + def self.process_secret_key: (String) -> String + def get_hmac_signature: (String) -> String + def valid_hmac_signature?: (String, String) -> bool + def deserialize_response: (singleton(Parsing::V2::JobResponse) | singleton(Parsing::V2::InferenceResponse))-> (Parsing::V2::JobResponse | Parsing::V2::InferenceResponse) end end end diff --git a/sig/mindee/input/polling_options.rbs b/sig/mindee/input/polling_options.rbs new file mode 100644 index 000000000..6a550c688 --- /dev/null +++ b/sig/mindee/input/polling_options.rbs @@ -0,0 +1,12 @@ +# lib/mindee/input/polling_options.rb +module Mindee + module Input + class PollingOptions + attr_reader delay_sec: Integer | Float + attr_reader initial_delay_sec: Integer | Float + attr_reader max_retries: Integer + + def initialize: (?initial_delay_sec: Float, ?delay_sec: Float, ?max_retries: Integer) -> Integer + end + end +end diff --git a/sig/mindee/input/sources/base64_input_source.rbs b/sig/mindee/input/sources/base64_input_source.rbs index 0ddae5872..6216e3049 100644 --- a/sig/mindee/input/sources/base64_input_source.rbs +++ b/sig/mindee/input/sources/base64_input_source.rbs @@ -4,7 +4,7 @@ module Mindee module Source class Base64InputSource < LocalInputSource def initialize: (String, String, ?repair_pdf: bool) -> void - def read_contents: (?close: bool) -> [String, String, Hash[Symbol, untyped]] + def read_contents: (?close: bool) -> [String?, Hash[:filename, String]] end end end diff --git a/sig/mindee/input/sources/local_input_source.rbs b/sig/mindee/input/sources/local_input_source.rbs index 985fa7807..c51e9553b 100644 --- a/sig/mindee/input/sources/local_input_source.rbs +++ b/sig/mindee/input/sources/local_input_source.rbs @@ -4,17 +4,20 @@ module Mindee module Source ALLOWED_MIME_TYPES: Array[String] class LocalInputSource - def filename: -> String - def file_mimetype: -> String - def io_stream: -> StringIO + attr_reader file_mimetype: String + attr_reader filename: String + attr_reader io_stream: StringIO | File def initialize: (StringIO | File, String, ?repair_pdf: bool) -> void - def logger: () -> untyped - def rescue_broken_pdf: (StringIO) -> StringIO + def logger: () -> Logger + + + def rescue_broken_pdf: (StringIO | File) -> (StringIO | File) def pdf?: -> bool + def apply_page_options: (PageOptions) -> StringIO? def process_pdf: (PageOptions) -> StringIO? - def read_contents: (?close: bool) -> [String, String?, Hash[:filename, String]] + def read_contents: (?close: bool) -> [String?, Hash[:filename, String]] def count_pages: -> Integer - def write_to_file: (String) -> void + def write_to_file: (String?) -> void def compress!: (?quality: Integer, ?max_width: Integer?, ?max_height: Integer?, ?force_source_text: bool, ?disable_source_text: bool) -> Integer def source_text?: -> bool? end diff --git a/sig/mindee/input/sources/url_input_source.rbs b/sig/mindee/input/sources/url_input_source.rbs index 93d08b5f6..77d2e0361 100644 --- a/sig/mindee/input/sources/url_input_source.rbs +++ b/sig/mindee/input/sources/url_input_source.rbs @@ -4,7 +4,7 @@ module Mindee module Source class URLInputSource def url: -> String - def logger: () -> untyped + def logger: () -> Logger def initialize: (String) -> void def write_to_file: (String, ?filename: String?, ?username: String?, ?password: String?, ?token: String?, ?max_redirects: Integer) -> String def as_local_input_source: (?filename: String?, ?username: String?, ?password: String?, ?token: String?, ?max_redirects: Integer) -> BytesInputSource? diff --git a/sig/mindee/logging/logger.rbs b/sig/mindee/logging/logger.rbs index 7ef7e1129..0eaf4aaa4 100644 --- a/sig/mindee/logging/logger.rbs +++ b/sig/mindee/logging/logger.rbs @@ -3,6 +3,8 @@ module Mindee @logger: Logger def self.logger: -> Logger + def debug: (?untyped?) -> void + def info: (?untyped?) -> void def self.logger=: (Logger) -> Logger end diff --git a/sig/mindee/page_options.rbs b/sig/mindee/page_options.rbs new file mode 100644 index 000000000..b4b58d151 --- /dev/null +++ b/sig/mindee/page_options.rbs @@ -0,0 +1,11 @@ +# lib/mindee/page_options.rb + +module Mindee + class PageOptions + attr_accessor page_indexes: Array[Integer] + attr_accessor operation: :KEEP_ONLY | :REMOVE + attr_accessor on_min_pages: Integer? + + def initialize: (params: Hash[String | Symbol, untyped]) -> void + end +end diff --git a/sig/mindee/parsing/common/api_request.rbs b/sig/mindee/parsing/common/api_request.rbs index 94bfebd0b..4f5e652be 100644 --- a/sig/mindee/parsing/common/api_request.rbs +++ b/sig/mindee/parsing/common/api_request.rbs @@ -3,12 +3,12 @@ module Mindee module Parsing module Common class ApiRequest - def error: -> untyped - def ressources: -> untyped - def status: -> untyped - def status_code: -> untyped - def url: -> untyped - def initialize: (untyped) -> untyped + def error: -> Hash[String, untyped] + def ressources: -> Array[String] + def status: -> [RequestStatus, Symbol] + def status_code: -> Integer + def url: -> String + def initialize: (Hash[String, untyped]) -> void end end end diff --git a/sig/mindee/parsing/common/api_response.rbs b/sig/mindee/parsing/common/api_response.rbs index 8cd595fbf..126363bd0 100644 --- a/sig/mindee/parsing/common/api_response.rbs +++ b/sig/mindee/parsing/common/api_response.rbs @@ -15,12 +15,12 @@ module Mindee class ApiResponse - def logger: () -> untyped + def logger: () -> Logger def document: -> Parsing::Common::Document? def job: -> Parsing::Common::Job? def api_request: -> Parsing::Common::ApiRequest? def raw_http: -> String - def initialize: (singleton(Parsing::Common::Inference), Hash[Symbol | String, untyped] | Net::HTTPResponse, String) -> void + def initialize: (singleton(Parsing::Common::Inference), Hash[String | Symbol, untyped] | Net::HTTPResponse, String) -> void end end end diff --git a/sig/mindee/parsing/common/document.rbs b/sig/mindee/parsing/common/document.rbs index f7a0cb654..d3d63803d 100644 --- a/sig/mindee/parsing/common/document.rbs +++ b/sig/mindee/parsing/common/document.rbs @@ -3,17 +3,17 @@ module Mindee module Parsing module Common class Document - def inference: -> untyped - def name: -> untyped - def id: -> untyped - def extras: -> nil - def ocr: -> nil - def n_pages: -> untyped - def self.load_ocr: (untyped) -> Parsing::Common::OCR::OCR? - def self.extract_extras: (untyped) -> Parsing::Common::Extras::Extras? - def initialize: (untyped, untyped) -> untyped + def inference: -> Inference + def name: -> String + def id: -> String + def extras: -> Extras::Extras? + def ocr: -> OCR::OCR? + def n_pages: -> Integer + def self.load_ocr: (Hash[String | Symbol, untyped]) -> Parsing::Common::OCR::OCR? + def self.extract_extras: (Hash[String | Symbol, untyped]) -> Parsing::Common::Extras::Extras? + def initialize: (singleton(Parsing::Common::Inference), Hash[String | Symbol, untyped]) -> void def to_s: -> String - def inject_full_text_ocr: (untyped) -> untyped + def inject_full_text_ocr: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/parsing/common/execution.rbs b/sig/mindee/parsing/common/execution.rbs index 18fc0a22b..3ba71c11c 100644 --- a/sig/mindee/parsing/common/execution.rbs +++ b/sig/mindee/parsing/common/execution.rbs @@ -3,20 +3,21 @@ module Mindee module Parsing module Common class Execution - def batch_name: -> untyped - def created_at: -> untyped - def file: -> untyped - def id: -> untyped - def inference: -> untyped - def priority: -> untyped - def reviewed_at: -> untyped - def available_at: -> untyped - def reviewed_prediction: -> untyped - def status: -> untyped - def type: -> untyped - def uploaded_at: -> untyped - def workflow_id: -> untyped - def initialize: (untyped, untyped) -> untyped + attr_reader available_at: Time? + attr_reader batch_name: String + attr_reader created_at: Time + attr_reader file: ExecutionFile + attr_reader id: String + attr_reader inference: Inference + attr_reader priority: Symbol? + attr_reader reviewed_at: Time? + attr_reader reviewed_prediction: Prediction? + attr_reader status: Symbol + attr_reader type: String? + attr_reader uploaded_at: Time? + attr_reader workflow_id: String + + def initialize: (singleton(Parsing::Common::Inference), Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/parsing/common/execution_file.rbs b/sig/mindee/parsing/common/execution_file.rbs index 9dd72a561..4d8d16f00 100644 --- a/sig/mindee/parsing/common/execution_file.rbs +++ b/sig/mindee/parsing/common/execution_file.rbs @@ -3,9 +3,9 @@ module Mindee module Parsing module Common class ExecutionFile - def name: -> untyped - def alias: -> untyped - def initialize: (untyped) -> untyped + def name: -> String + def alias: -> String? + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/parsing/common/extras/cropper_extra.rbs b/sig/mindee/parsing/common/extras/cropper_extra.rbs index b2c9c16c7..958c5201d 100644 --- a/sig/mindee/parsing/common/extras/cropper_extra.rbs +++ b/sig/mindee/parsing/common/extras/cropper_extra.rbs @@ -4,8 +4,9 @@ module Mindee module Common module Extras class CropperExtra - def croppings: -> Array[Standard::PositionField] - def initialize: (untyped, ?nil) -> untyped + attr_reader croppings: Array[Standard::PositionField] + + def initialize: (Hash[String | Symbol, untyped], ?Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/parsing/common/extras/extras.rbs b/sig/mindee/parsing/common/extras/extras.rbs index 99303fe4c..9c549a234 100644 --- a/sig/mindee/parsing/common/extras/extras.rbs +++ b/sig/mindee/parsing/common/extras/extras.rbs @@ -4,12 +4,13 @@ module Mindee module Common module Extras class Extras - def cropper: -> untyped - def full_text_ocr: -> untyped - def initialize: (untyped) -> void - def new: (untyped) -> void + attr_reader cropper: CropperExtra? + attr_reader full_text_ocr: FullTextOCRExtra + attr_reader rag: RAGExtra? + + def initialize: (Hash[String | Symbol, untyped]) -> void def to_s: -> String - def add_artificial_extra: (untyped) -> nil + def add_artificial_extra: (Hash[String | Symbol, untyped]) -> void end def empty?: -> bool end diff --git a/sig/mindee/parsing/common/extras/full_text_ocr_extra.rbs b/sig/mindee/parsing/common/extras/full_text_ocr_extra.rbs index 72f7f4936..a7eb65dff 100644 --- a/sig/mindee/parsing/common/extras/full_text_ocr_extra.rbs +++ b/sig/mindee/parsing/common/extras/full_text_ocr_extra.rbs @@ -6,8 +6,9 @@ module Mindee class FullTextOCRExtra def contents: -> String? def language: -> String? - def initialize: (untyped) -> nil + def initialize: (Hash[String | Symbol, untyped]) -> nil def to_s: -> String + def <<: (?untyped?) -> untyped end end end diff --git a/sig/mindee/parsing/common/inference.rbs b/sig/mindee/parsing/common/inference.rbs index 6b75aa717..a1a02e0cc 100644 --- a/sig/mindee/parsing/common/inference.rbs +++ b/sig/mindee/parsing/common/inference.rbs @@ -3,16 +3,23 @@ module Mindee module Parsing module Common class Inference - def is_rotation_applied: -> untyped - def pages: -> Array[Page] - def prediction: -> untyped - def product: -> untyped - def initialize: (untyped) -> void + def self.endpoint_name: () -> String? + def self.endpoint_version: () -> String? + def self.has_async: () -> bool + def self.has_sync: () -> bool + + attr_reader endpoint_name: String + attr_reader endpoint_version: String + attr_reader extras: Extras::Extras + attr_reader has_async: bool + attr_reader has_sync: bool + attr_reader is_rotation_applied: bool + attr_reader pages: Array[Page] + attr_reader prediction: Prediction + attr_reader product: Product + + def initialize: (Hash[String | Symbol, untyped]) -> void def to_s: -> String - def self.endpoint_name: -> String - def self.endpoint_version: -> String - def self.has_async: -> bool - def self.has_sync: -> bool end end end diff --git a/sig/mindee/parsing/common/job.rbs b/sig/mindee/parsing/common/job.rbs index 2b7645191..2e89dc643 100644 --- a/sig/mindee/parsing/common/job.rbs +++ b/sig/mindee/parsing/common/job.rbs @@ -8,8 +8,8 @@ module Mindee def available_at: -> Time def status: () -> (:waiting | :processing | :completed | :failed) def millisecs_taken: -> Integer - def error: -> Hash[Symbol | String, untyped] - def initialize: (Hash[Symbol | String, untyped]) -> void + def error: -> Hash[String | Symbol, untyped] + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/parsing/common/ocr/mvision_v1.rbs b/sig/mindee/parsing/common/ocr/mvision_v1.rbs index e178c3e05..aeaf6b25f 100644 --- a/sig/mindee/parsing/common/ocr/mvision_v1.rbs +++ b/sig/mindee/parsing/common/ocr/mvision_v1.rbs @@ -5,9 +5,9 @@ module Mindee module OCR class MVisionV1 def pages: -> [] - def initialize: (untyped) -> untyped + def initialize: (Hash[String | Symbol, untyped]) -> void def to_s: -> String - def reconstruct_vertically: (untyped, untyped, untyped) -> untyped + def reconstruct_vertically: (Array[Geometry::Point], Integer, Float) -> OCRLine end end end diff --git a/sig/mindee/parsing/common/ocr/ocr.rbs b/sig/mindee/parsing/common/ocr/ocr.rbs index dbf97e19e..e902ab574 100644 --- a/sig/mindee/parsing/common/ocr/ocr.rbs +++ b/sig/mindee/parsing/common/ocr/ocr.rbs @@ -4,34 +4,36 @@ module Mindee module Common module OCR class OCRWord - def confidence: -> untyped - def confidence=: (untyped) -> untyped - def text: -> untyped - def bounding_box: -> untyped - def polygon: -> untyped - def initialize: (untyped) -> void - def to_s: -> untyped + attr_reader bounding_box: Geometry::Quadrilateral + attr_accessor confidence: Float + attr_reader polygon: Geometry::Polygon + attr_reader text: String + + def initialize: (Hash[String | Symbol, untyped]) -> void + def to_s: -> String end - class OCRLine < Array[untyped] - def initialize: (?Array[untyped]?, ?Array[untyped]?) -> void + class OCRLine < Array[OCRWord] + def initialize: (?Array[untyped]?, ?Array[OCRWord]?) -> void def sort_on_x: -> OCRLine def to_s: -> String end class OCRPage - def all_words: -> Array[untyped] - def lines: -> Array[untyped] - def initialize: (untyped) -> untyped - def all_lines: -> Array[untyped] + attr_reader all_words: Array[OCRWord] + attr_reader lines: Array[OCRLine] + + def initialize: (Hash[String | Symbol, untyped]) -> void + def all_lines: -> Array[OCRLine] def to_s: -> String - def parse_one: (Array[OCRWord], untyped, Array[untyped], Array[untyped]) -> Array[OCRLine]? - def to_lines: -> Array[untyped] - def words_on_same_line?: (OCRWord, OCRWord) -> untyped + def parse_one: (Array[OCRWord], OCRWord?, Array[Integer], Array[OCRLine]) -> Array[OCRLine]? + def to_lines: -> Array[OCRLine] + def words_on_same_line?: (OCRWord, OCRWord) -> bool end class OCR - def mvision_v1: -> untyped - def initialize: (untyped) -> untyped - def to_s: -> untyped - def reconstruct_vertically: (untyped, untyped, ?Float) -> untyped + attr_reader mvision_v1: MVisionV1 + + def initialize: (Hash[String | Symbol, untyped]) -> void + def to_s: -> String + def reconstruct_vertically: (Array[Geometry::Point], Integer, ?Float) -> OCRLine end end end diff --git a/sig/mindee/parsing/common/orientation.rbs b/sig/mindee/parsing/common/orientation.rbs index 1c7891442..3e0438978 100644 --- a/sig/mindee/parsing/common/orientation.rbs +++ b/sig/mindee/parsing/common/orientation.rbs @@ -3,9 +3,10 @@ module Mindee module Parsing module Common class Orientation - def page_id: -> untyped - def value: -> untyped - def initialize: (untyped, untyped) -> untyped + attr_reader page_id: Integer? + attr_reader value: Integer? + + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void end end end diff --git a/sig/mindee/parsing/common/page.rbs b/sig/mindee/parsing/common/page.rbs index b01496322..e86768565 100644 --- a/sig/mindee/parsing/common/page.rbs +++ b/sig/mindee/parsing/common/page.rbs @@ -3,11 +3,12 @@ module Mindee module Parsing module Common class Page - def page_id: -> untyped - def orientation: -> untyped - def prediction: -> untyped - def extras: -> untyped - def initialize: (untyped) -> void + attr_reader extras: Extras::Extras + attr_reader orientation: Common::Orientation + attr_reader page_id: Integer + attr_reader prediction: Common::Prediction + + def initialize: (Hash[String | Symbol, untyped]) -> void def to_s: -> String end end diff --git a/sig/mindee/parsing/common/product.rbs b/sig/mindee/parsing/common/product.rbs index 066b25774..e9b1c873e 100644 --- a/sig/mindee/parsing/common/product.rbs +++ b/sig/mindee/parsing/common/product.rbs @@ -3,10 +3,10 @@ module Mindee module Parsing module Common class Product - def name: -> untyped - def type: -> untyped - def version: -> untyped - def initialize: (Hash[String, untyped]) -> untyped + attr_reader name: String + attr_reader type: String? + attr_reader version: String + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/parsing/common/workflow_response.rbs b/sig/mindee/parsing/common/workflow_response.rbs index de4fd8175..40fa84a42 100644 --- a/sig/mindee/parsing/common/workflow_response.rbs +++ b/sig/mindee/parsing/common/workflow_response.rbs @@ -3,10 +3,14 @@ module Mindee module Parsing module Common class WorkflowResponse - def execution: -> untyped - def api_request: -> untyped - def raw_http: -> untyped - def initialize: (untyped, untyped, untyped) -> untyped + @api_request: ApiRequest + @execution: Execution + @raw_http: String + + def execution: -> Execution + def api_request: -> ApiRequest + def raw_http: -> String + def initialize: (singleton(Parsing::Common::Inference), Hash[String | Symbol, untyped] | Net::HTTPResponse, String) -> void end end end diff --git a/sig/mindee/parsing/standard/abstract_field.rbs b/sig/mindee/parsing/standard/abstract_field.rbs index 0374fa1e7..a870301b4 100644 --- a/sig/mindee/parsing/standard/abstract_field.rbs +++ b/sig/mindee/parsing/standard/abstract_field.rbs @@ -8,7 +8,7 @@ module Mindee def page_id: -> Integer? def confidence: -> Float? def confidence=: (Float?) -> Float? - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String def self.array_confidence: (Array[untyped]) -> Float def self.array_sum: (Array[untyped]) -> Float diff --git a/sig/mindee/parsing/standard/address_field.rbs b/sig/mindee/parsing/standard/address_field.rbs index e1d9e493e..aff39e679 100644 --- a/sig/mindee/parsing/standard/address_field.rbs +++ b/sig/mindee/parsing/standard/address_field.rbs @@ -11,7 +11,7 @@ module Mindee def postal_code: -> String def state: -> String def country: -> String - def initialize: (Hash[Symbol | String, untyped], ?Integer?, ?reconstructed: bool) -> void + def initialize: (Hash[String | Symbol, untyped], ?Integer?, ?reconstructed: bool) -> void end end end diff --git a/sig/mindee/parsing/standard/amount_field.rbs b/sig/mindee/parsing/standard/amount_field.rbs index 8d7ba0018..e3ceaff5e 100644 --- a/sig/mindee/parsing/standard/amount_field.rbs +++ b/sig/mindee/parsing/standard/amount_field.rbs @@ -2,10 +2,12 @@ module Mindee module Parsing module Standard - class AmountField # failed to identify its superclass - def value: -> untyped - def initialize: (untyped, untyped, ?reconstructed: false) -> nil - def to_s: -> untyped + class AmountField < BaseField + attr_reader value: Float? + + + def initialize: (Hash[String | Symbol, untyped], Integer?, ?reconstructed: bool) -> void + def to_s: -> String end end end diff --git a/sig/mindee/parsing/standard/base_field.rbs b/sig/mindee/parsing/standard/base_field.rbs index a92fb08f6..3db3db896 100644 --- a/sig/mindee/parsing/standard/base_field.rbs +++ b/sig/mindee/parsing/standard/base_field.rbs @@ -3,7 +3,7 @@ module Mindee module Parsing module Standard class BaseField < Parsing::Standard::AbstractField - def initialize: (Hash[Symbol | String, untyped], Integer?, ?reconstructed: bool) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?, ?reconstructed: bool) -> void def value: -> (String | Float | Integer | bool) def reconstructed: -> bool end diff --git a/sig/mindee/parsing/standard/boolean_field.rbs b/sig/mindee/parsing/standard/boolean_field.rbs index 77fdeca61..05f165438 100644 --- a/sig/mindee/parsing/standard/boolean_field.rbs +++ b/sig/mindee/parsing/standard/boolean_field.rbs @@ -4,7 +4,7 @@ module Mindee module Standard class BooleanField < BaseField def value: -> bool? - def initialize: (Hash[Symbol | String, untyped], ?Integer?, ?reconstructed: false) -> void + def initialize: (Hash[String | Symbol, untyped], ?Integer?, ?reconstructed: false) -> void def to_s: -> String end end diff --git a/sig/mindee/parsing/standard/company_registration_field.rbs b/sig/mindee/parsing/standard/company_registration_field.rbs index 4e18c623f..58b38d9cf 100644 --- a/sig/mindee/parsing/standard/company_registration_field.rbs +++ b/sig/mindee/parsing/standard/company_registration_field.rbs @@ -3,8 +3,9 @@ module Mindee module Parsing module Standard class CompanyRegistrationField < BaseField - def type: -> untyped - def initialize: (untyped, untyped, ?reconstructed: false) -> untyped + attr_reader type: String + + def initialize: (Hash[String | Symbol, untyped], Integer?, ?reconstructed: false) -> void def to_table_line: -> String def to_s: -> String def printable_values: -> Hash[String, untyped] diff --git a/sig/mindee/parsing/standard/date_field.rbs b/sig/mindee/parsing/standard/date_field.rbs index e3b276800..a10222acd 100644 --- a/sig/mindee/parsing/standard/date_field.rbs +++ b/sig/mindee/parsing/standard/date_field.rbs @@ -2,12 +2,12 @@ module Mindee module Parsing module Standard - class DateField # failed to identify its superclass - def date_object: -> untyped - def value: -> untyped - def raw: -> untyped - def is_computed: -> untyped - def initialize: (untyped, untyped) -> nil + class DateField < BaseField + def date_object: -> DateTime + def value: -> String? + def raw: -> String? + def is_computed: -> bool + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void end end end diff --git a/sig/mindee/parsing/standard/locale_field.rbs b/sig/mindee/parsing/standard/locale_field.rbs index d806cd77b..12d07782d 100644 --- a/sig/mindee/parsing/standard/locale_field.rbs +++ b/sig/mindee/parsing/standard/locale_field.rbs @@ -8,7 +8,7 @@ module Mindee def country: -> String? def currency: -> String? def value: -> String? - def initialize: (Hash[Symbol | String, untyped], ?Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], ?Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/parsing/standard/payment_details_field.rbs b/sig/mindee/parsing/standard/payment_details_field.rbs index f2de2ee4b..5ef7739aa 100644 --- a/sig/mindee/parsing/standard/payment_details_field.rbs +++ b/sig/mindee/parsing/standard/payment_details_field.rbs @@ -2,12 +2,13 @@ module Mindee module Parsing module Standard - class PaymentDetailsField # failed to identify its superclass - def account_number: -> untyped - def iban: -> untyped - def routing_number: -> untyped - def swift: -> untyped - def initialize: (untyped, untyped, ?reconstructed: false) -> untyped + class PaymentDetailsField < BaseField + attr_reader account_number: String ? + attr_reader iban: String? + attr_reader routing_number: String? + attr_reader swift: String? + + def initialize: (Hash[String | Symbol, untyped], Integer?, ?reconstructed: bool) -> void def to_s: -> String end end diff --git a/sig/mindee/parsing/standard/position_field.rbs b/sig/mindee/parsing/standard/position_field.rbs index 090df5c9f..a2976c538 100644 --- a/sig/mindee/parsing/standard/position_field.rbs +++ b/sig/mindee/parsing/standard/position_field.rbs @@ -8,9 +8,9 @@ module Mindee def quadrangle: -> Geometry::Quadrilateral def rectangle: -> Geometry::Quadrilateral def bounding_box: -> Geometry::Quadrilateral - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String - def to_quadrilateral: (Hash[Symbol | String, Array[untyped]], String) -> Geometry::Quadrilateral? + def to_quadrilateral: (Hash[String | Symbol, Array[untyped]], String) -> Geometry::Quadrilateral? end end end diff --git a/sig/mindee/parsing/standard/string_field.rbs b/sig/mindee/parsing/standard/string_field.rbs index 9ff2314ac..b569e7d1f 100644 --- a/sig/mindee/parsing/standard/string_field.rbs +++ b/sig/mindee/parsing/standard/string_field.rbs @@ -5,7 +5,7 @@ module Mindee class StringField < BaseField def value: -> String def raw_value: -> String - def initialize: (Hash[Symbol | String, untyped], ?Integer?, ?reconstructed: bool) -> void + def initialize: (Hash[String | Symbol, untyped], ?Integer?, ?reconstructed: bool) -> void end end end diff --git a/sig/mindee/parsing/standard/tax_field.rbs b/sig/mindee/parsing/standard/tax_field.rbs index 0a62bfe56..4f8faf2d2 100644 --- a/sig/mindee/parsing/standard/tax_field.rbs +++ b/sig/mindee/parsing/standard/tax_field.rbs @@ -3,18 +3,19 @@ module Mindee module Parsing module Standard class TaxField < BaseField - def value: -> untyped - def rate: -> untyped - def code: -> untyped - def base: -> untyped - def initialize: (untyped, untyped) -> void - def print_float: (untyped) -> String + attr_reader base: Float + attr_reader code: String + attr_reader rate: Float + attr_reader value: Float? + + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void + def print_float: (Float) -> String def to_s: -> String def printable_values: -> Hash[untyped, String] def to_table_line: -> String end class Taxes < Array[TaxField] - def initialize: (untyped, untyped) -> void + def initialize: (Array[untyped], Integer?) -> void def line_separator: (String) -> String def to_s: -> String end diff --git a/sig/mindee/parsing/universal/universal_list_field.rbs b/sig/mindee/parsing/universal/universal_list_field.rbs index 692cb141e..4bccf4149 100644 --- a/sig/mindee/parsing/universal/universal_list_field.rbs +++ b/sig/mindee/parsing/universal/universal_list_field.rbs @@ -3,11 +3,10 @@ module Mindee module Parsing module Universal class UniversalListField - def page_id: -> Integer? - def page_id=: (Integer?) -> untyped - def values: -> Array[UniversalObjectField | Standard::StringField] - def values=: (Array[UniversalObjectField | Standard::StringField]) -> Array[UniversalObjectField | Standard::StringField] - def initialize: (Array[Hash[Symbol | String, untyped]], ?nil) -> untyped + attr_reader page_id: Integer + attr_reader values: Array[UniversalObjectField | Standard::StringField] + + def initialize: (Array[Hash[String | Symbol, untyped]], ?Integer?) -> void def contents_list: -> Array[String] def contents_string: (?String) -> String def to_s: -> String diff --git a/sig/mindee/parsing/universal/universal_object_field.rbs b/sig/mindee/parsing/universal/universal_object_field.rbs index 5e97e6724..54f641d41 100644 --- a/sig/mindee/parsing/universal/universal_object_field.rbs +++ b/sig/mindee/parsing/universal/universal_object_field.rbs @@ -3,21 +3,27 @@ module Mindee module Parsing module Universal class UniversalObjectField - def page_id: -> Integer? - def page_id=: (Integer?) -> untyped - def confidence: -> Float? - def confidence=: (Float?) -> untyped - def raw_value: -> Hash[Symbol | String, untyped] - def raw_value=: (Hash[Symbol | String, untyped]) -> untyped - def initialize: (Hash[Symbol | String, untyped], ?Integer?) -> void + attr_reader all_values: Hash[String | Symbol, String | Standard::PositionField?] + attr_reader confidence: Float + attr_reader page_id: Integer + attr_reader raw_value: String + + def initialize: (Hash[String | Symbol, untyped], ?Integer?) -> void def str_level: (?Integer) -> String - def method_missing: (Symbol, *Array[untyped]) -> Object + def method_missing: (Symbol, *untyped, untyped) + -> (String + | Integer + | Float + | bool + | Standard::PositionField + | Hash[String | Symbol, untyped] + ?) def respond_to_missing?: (Symbol, ?bool) -> bool def to_s: -> String - def handle_position_field: (String | Symbol, untyped, Integer?) -> void - def handle_default_field: (String | Symbol, untyped) -> void + def handle_position_field: (String | Symbol, Hash[String | Symbol, untyped] | Integer | String | Float | bool?, Integer?) -> void + def handle_default_field: (String | Symbol, Hash[String | Symbol, untyped] | Integer | String | Float | bool?) -> void end - def self.universal_object?: (Hash[Symbol | String, untyped]) -> bool + def self.universal_object?: (Hash[String | Symbol, untyped]) -> bool end end end diff --git a/sig/mindee/parsing/v2/common_response.rbs b/sig/mindee/parsing/v2/common_response.rbs new file mode 100644 index 000000000..8c94189a8 --- /dev/null +++ b/sig/mindee/parsing/v2/common_response.rbs @@ -0,0 +1,11 @@ +# lib/mindee/parsing/v2/common_response.rb +module Mindee + module Parsing + module V2 + class CommonResponse + attr_reader raw_http: Hash[String | Symbol, untyped] + def initialize: (Hash[String | Symbol, untyped]) -> void + end + end + end +end diff --git a/sig/mindee/parsing/v2/error_response.rbs b/sig/mindee/parsing/v2/error_response.rbs new file mode 100644 index 000000000..1964d271a --- /dev/null +++ b/sig/mindee/parsing/v2/error_response.rbs @@ -0,0 +1,16 @@ +# lib/mindee/parsing/v2/error_response.rb +module Mindee + module Parsing + module V2 + class ErrorResponse + attr_reader detail: String + attr_reader status: Integer + def initialize: (Hash[String | Symbol, untyped]) -> void + + def as_hash: -> Hash[Symbol, String | Integer] + + def to_s: -> String + end + end + end +end diff --git a/sig/mindee/parsing/v2/field/base_field.rbs b/sig/mindee/parsing/v2/field/base_field.rbs new file mode 100644 index 000000000..5c401ab1a --- /dev/null +++ b/sig/mindee/parsing/v2/field/base_field.rbs @@ -0,0 +1,17 @@ +# lib/mindee/parsing/v2/field/base_field.rb +module Mindee + module Parsing + module V2 + module Field + class BaseField + attr_reader indent_level: Integer + attr_reader confidence: FieldConfidence? + attr_reader locations: Array[FieldLocation] + + def initialize: (Hash[String | Symbol, untyped], ?Integer) -> void + def self.create_field: (Hash[String | Symbol, untyped], ?Integer) -> (ListField | Field::ObjectField | Field::SimpleField) + end + end + end + end +end diff --git a/sig/mindee/parsing/v2/field/field_confidence.rbs b/sig/mindee/parsing/v2/field/field_confidence.rbs new file mode 100644 index 000000000..16ee1eef8 --- /dev/null +++ b/sig/mindee/parsing/v2/field/field_confidence.rbs @@ -0,0 +1,27 @@ +# lib/mindee/parsing/v2/field/field_confidence.rb +module Mindee + module Parsing + module V2 + module Field + class FieldConfidence + attr_reader value: String + CERTAIN: String + HIGH: String + MEDIUM: String + LOW: String + VALID_VALUES: Array[String] + def initialize: (String) -> void + def self.from_string: (String) -> FieldConfidence + def certain?: -> bool + def high?: -> bool + def medium?: -> bool + def low?: -> bool + def to_s: -> String + def ==: (FieldConfidence) -> bool + def eql?: (FieldConfidence) -> bool + def inspect: -> String + end + end + end + end +end diff --git a/sig/mindee/parsing/v2/field/field_location.rbs b/sig/mindee/parsing/v2/field/field_location.rbs new file mode 100644 index 000000000..d72e31cc6 --- /dev/null +++ b/sig/mindee/parsing/v2/field/field_location.rbs @@ -0,0 +1,16 @@ +# lib/mindee/parsing/v2/field/field_location.rb +module Mindee + module Parsing + module V2 + module Field + class FieldLocation + attr_reader page: Integer? + attr_reader polygon: Geometry::Polygon? + + def initialize: (Hash[String | Symbol, untyped]) -> void + def to_s: -> String + end + end + end + end +end diff --git a/sig/mindee/parsing/v2/field/inference_fields.rbs b/sig/mindee/parsing/v2/field/inference_fields.rbs new file mode 100644 index 000000000..1774a5b11 --- /dev/null +++ b/sig/mindee/parsing/v2/field/inference_fields.rbs @@ -0,0 +1,19 @@ +# lib/mindee/parsing/v2/field/inference_fields.rb +module Mindee + module Parsing + module V2 + module Field + class InferenceFields < Hash[String, ListField | ObjectField | SimpleField?] + attr_reader indent_level: Integer + + def logger: () -> Logger + def initialize: (Hash[String | Symbol, untyped], ?Integer) -> void + def get: (String) -> (ListField | ObjectField | SimpleField?) + def method_missing: (Symbol, *untyped) -> (ListField | ObjectField | SimpleField?) + def respond_to_missing?: (Symbol, ?bool) -> bool + def to_s: (?Integer) -> String + end + end + end + end +end diff --git a/sig/mindee/parsing/v2/field/list_field.rbs b/sig/mindee/parsing/v2/field/list_field.rbs new file mode 100644 index 000000000..2383d1299 --- /dev/null +++ b/sig/mindee/parsing/v2/field/list_field.rbs @@ -0,0 +1,22 @@ +# lib/mindee/parsing/v2/field/list_field.rb +module Mindee + module Parsing + module V2 + module Field + class ListField < BaseField + include Enumerable[BaseField] + + attr_reader items: Array[BaseField] + def initialize: (Hash[String | Symbol, untyped], ?Integer) -> void + def to_s: -> String + def empty?: -> bool + def size: -> Integer + def length: -> Integer + # NOTE: Steep is incapable of handling typing of `each` when multiple types are used. + def each: () { (untyped) -> untyped } -> untyped + def []: (Integer) -> (BaseField) + end + end + end + end +end diff --git a/sig/mindee/parsing/v2/field/object_field.rbs b/sig/mindee/parsing/v2/field/object_field.rbs new file mode 100644 index 000000000..fe66d4ed0 --- /dev/null +++ b/sig/mindee/parsing/v2/field/object_field.rbs @@ -0,0 +1,21 @@ +# TypeProf 0.30.1 + +module Mindee + module Parsing + module V2 + module Field + # A field containing a nested set of inference fields. + class ObjectField < BaseField + attr_reader fields: InferenceFields + def initialize: (Hash[String | Symbol, untyped], ?Integer) -> void + def multi_str: -> String + def respond_to_missing?: (Symbol, bool) -> bool + def single_str: -> String + def to_s: -> String + def to_s_from_list: -> String + def method_missing: (Symbol, *untyped, untyped) -> (ObjectField?) + end + end + end + end +end diff --git a/sig/mindee/parsing/v2/field/simple_field.rbs b/sig/mindee/parsing/v2/field/simple_field.rbs new file mode 100644 index 000000000..c5ac46a7b --- /dev/null +++ b/sig/mindee/parsing/v2/field/simple_field.rbs @@ -0,0 +1,16 @@ +# lib/mindee/parsing/v2/field/simple_field.rb +module Mindee + module Parsing + module V2 + module Field + class SimpleField < BaseField + attr_reader value: String | Integer | Float | bool? + + def initialize: (Hash[String | Symbol, untyped], ?Integer) -> void + def to_s: -> String + def format_numeric_value: (Integer | Float) -> String + end + end + end + end +end diff --git a/sig/mindee/parsing/v2/inference.rbs b/sig/mindee/parsing/v2/inference.rbs new file mode 100644 index 000000000..0d4387f87 --- /dev/null +++ b/sig/mindee/parsing/v2/inference.rbs @@ -0,0 +1,16 @@ +# lib/mindee/parsing/v2/inference.rb +module Mindee + module Parsing + module V2 + class Inference + attr_reader file: InferenceFile + attr_reader id: String + attr_reader model: InferenceModel + attr_reader result: InferenceResult + + def initialize: (Hash[String | Symbol, untyped]) -> void + def to_s: -> String + end + end + end +end diff --git a/sig/mindee/parsing/v2/inference_file.rbs b/sig/mindee/parsing/v2/inference_file.rbs new file mode 100644 index 000000000..43e313115 --- /dev/null +++ b/sig/mindee/parsing/v2/inference_file.rbs @@ -0,0 +1,15 @@ +# lib/mindee/parsing/v2/inference_file.rb +module Mindee + module Parsing + module V2 + class InferenceFile + attr_reader name: String + attr_reader file_alias: String? + attr_reader page_count: Integer + attr_reader mime_type: String + def initialize: (Hash[String | Symbol, untyped]) -> void + def to_s: -> String + end + end + end +end diff --git a/sig/mindee/parsing/v2/inference_model.rbs b/sig/mindee/parsing/v2/inference_model.rbs new file mode 100644 index 000000000..07a9be237 --- /dev/null +++ b/sig/mindee/parsing/v2/inference_model.rbs @@ -0,0 +1,11 @@ +# lib/mindee/parsing/v2/inference_model.rb +module Mindee + module Parsing + module V2 + class InferenceModel + attr_reader id: String + def initialize: (Hash[String | Symbol, untyped]) -> void + end + end + end +end diff --git a/sig/mindee/parsing/v2/inference_response.rbs b/sig/mindee/parsing/v2/inference_response.rbs new file mode 100644 index 000000000..7254f9965 --- /dev/null +++ b/sig/mindee/parsing/v2/inference_response.rbs @@ -0,0 +1,12 @@ +# lib/mindee/parsing/v2/inference_response.rb +module Mindee + module Parsing + module V2 + class InferenceResponse < CommonResponse + attr_reader inference: V2::Inference + def initialize: (Hash[String | Symbol, untyped]) -> void + def to_s: -> String + end + end + end +end diff --git a/sig/mindee/parsing/v2/inference_result.rbs b/sig/mindee/parsing/v2/inference_result.rbs new file mode 100644 index 000000000..b1b6bedc8 --- /dev/null +++ b/sig/mindee/parsing/v2/inference_result.rbs @@ -0,0 +1,13 @@ +# lib/mindee/parsing/v2/inference_result.rb +module Mindee + module Parsing + module V2 + class InferenceResult + attr_reader fields: Field::InferenceFields + attr_reader options: InferenceResultOptions? + def initialize: (Hash[String | Symbol, untyped]) -> void + def to_s: -> String + end + end + end +end diff --git a/sig/mindee/parsing/v2/inference_result_options.rbs b/sig/mindee/parsing/v2/inference_result_options.rbs new file mode 100644 index 000000000..fd289c161 --- /dev/null +++ b/sig/mindee/parsing/v2/inference_result_options.rbs @@ -0,0 +1,11 @@ +# lib/mindee/parsing/v2/inference_result_options.rb +module Mindee + module Parsing + module V2 + class InferenceResultOptions + attr_reader raw_texts: Array[RawText] + def initialize: (Hash[String | Symbol, untyped]) -> void + end + end + end +end diff --git a/sig/mindee/parsing/v2/job.rbs b/sig/mindee/parsing/v2/job.rbs new file mode 100644 index 000000000..7f4afbe00 --- /dev/null +++ b/sig/mindee/parsing/v2/job.rbs @@ -0,0 +1,22 @@ +# lib/mindee/parsing/v2/job.rb +module Mindee + module Parsing + module V2 + class Job + attr_reader alias: String + attr_reader created_at: DateTime? + attr_reader error: ErrorResponse? + attr_reader filename: String + attr_reader id: String + attr_reader model_id: String + attr_reader polling_url: String + attr_reader result_url: String? + attr_reader status: String + attr_reader webhooks: Array[JobWebhook] + + def initialize: (Hash[String | Symbol, untyped]) -> void + def to_s: -> String + end + end + end +end diff --git a/sig/mindee/parsing/v2/job_response.rbs b/sig/mindee/parsing/v2/job_response.rbs new file mode 100644 index 000000000..1ecf8683a --- /dev/null +++ b/sig/mindee/parsing/v2/job_response.rbs @@ -0,0 +1,12 @@ +# lib/mindee/parsing/v2/job_response.rb +module Mindee + module Parsing + module V2 + class JobResponse < CommonResponse + attr_reader job: Job + def initialize: (Hash[String | Symbol, untyped]) -> void + def to_s: -> String + end + end + end +end diff --git a/sig/mindee/parsing/v2/job_webhook.rbs b/sig/mindee/parsing/v2/job_webhook.rbs new file mode 100644 index 000000000..e2869ad98 --- /dev/null +++ b/sig/mindee/parsing/v2/job_webhook.rbs @@ -0,0 +1,17 @@ +# lib/mindee/parsing/v2/job_webhook.rb +module Mindee + module Parsing + module V2 + class JobWebhook + attr_reader created_at: DateTime? + attr_reader error: ErrorResponse + attr_reader id: String + attr_reader status: String + + def initialize: (Hash[String | Symbol, untyped]) -> void + def to_s: -> String + def parse_date: (String?) -> DateTime? + end + end + end +end diff --git a/sig/mindee/parsing/v2/raw_text.rbs b/sig/mindee/parsing/v2/raw_text.rbs new file mode 100644 index 000000000..0f1ce2190 --- /dev/null +++ b/sig/mindee/parsing/v2/raw_text.rbs @@ -0,0 +1,12 @@ +# lib/mindee/parsing/v2/raw_text.rb +module Mindee + module Parsing + module V2 + class RawText + attr_reader page: Integer? + attr_reader content: String? + def initialize: (Hash[String | Symbol, untyped]) -> void + end + end + end +end diff --git a/sig/mindee/pdf/extracted_pdf.rbs b/sig/mindee/pdf/extracted_pdf.rbs index ed76f17f7..d2f2427aa 100644 --- a/sig/mindee/pdf/extracted_pdf.rbs +++ b/sig/mindee/pdf/extracted_pdf.rbs @@ -3,12 +3,12 @@ module Mindee module PDF module PDFExtractor class ExtractedPDF - def pdf_bytes: -> untyped - def filename: -> untyped - def initialize: (untyped, untyped) -> untyped - def page_count: -> nil - def write_to_file: (untyped, ?override: false) -> Integer - def as_input_source: -> untyped + attr_reader pdf_bytes: StringIO + attr_reader filename: String + def initialize: (StringIO, String) -> void + def page_count: -> Integer + def write_to_file: (String, ?override: bool) -> Integer + def as_input_source: -> Input::Source::BytesInputSource end end end diff --git a/sig/mindee/pdf/pdf_compressor.rbs b/sig/mindee/pdf/pdf_compressor.rbs index 91e0bbfed..11fe4e349 100644 --- a/sig/mindee/pdf/pdf_compressor.rbs +++ b/sig/mindee/pdf/pdf_compressor.rbs @@ -4,11 +4,11 @@ PDF: untyped module Mindee module PDF module PDFCompressor - def self.logger: () -> untyped - def self.compress_pdf: (StringIO, ?quality: Integer, ?force_source_text_compression: bool, ?disable_source_text: bool) -> StringIO + def self.logger: () -> Logger + def self.compress_pdf: (StringIO | File, ?quality: Integer, ?force_source_text_compression: bool, ?disable_source_text: bool) -> (StringIO | File) def self.process_pdf_pages: (Origami::PDF, Integer) -> Array[Origami::Page] - def self.create_output_pdf: (Array[Origami::Page], bool, StringIO) -> Origami::PDF - def self.inject_text: (StringIO, Array[Origami::Page]) -> nil + def self.create_output_pdf: (Array[Origami::Page], bool, StringIO | File) -> Origami::PDF + def self.inject_text: (StringIO | File, Array[Origami::Page]) -> nil def self.process_pdf_page: (StringIO, Integer, Integer, Array[Integer]?) -> Origami::Page end end diff --git a/sig/mindee/pdf/pdf_extractor.rbs b/sig/mindee/pdf/pdf_extractor.rbs index 0ee8ba94c..38a5a1fb4 100644 --- a/sig/mindee/pdf/pdf_extractor.rbs +++ b/sig/mindee/pdf/pdf_extractor.rbs @@ -3,13 +3,14 @@ module Mindee module PDF module PDFExtractor class PDFExtractor - def initialize: (untyped) -> StringIO - def page_count: -> untyped - def cut_pages: (Array[untyped]) -> untyped - def extract_sub_documents: (Array[untyped]) -> Array[untyped] - def extract_invoices: (untyped, ?strict: bool) -> Array[untyped] - def source_pdf: -> StringIO - def filename: -> untyped + attr_reader filename: String + attr_reader source_pdf: StringIO + + def initialize: (Input::Source::LocalInputSource) -> void + def page_count: -> Integer + def cut_pages: (Array[Integer]) -> StringIO + def extract_sub_documents: (Array[Array[Integer]]) -> Array[ExtractedPDF] + def extract_invoices: (Array[Product::InvoiceSplitter::InvoiceSplitterV1InvoicePageGroup] | Array [Array[Integer]], ?strict: bool) -> Array[ExtractedPDF] end end end diff --git a/sig/mindee/pdf/pdf_processor.rbs b/sig/mindee/pdf/pdf_processor.rbs index 3697527a7..38085f3ab 100644 --- a/sig/mindee/pdf/pdf_processor.rbs +++ b/sig/mindee/pdf/pdf_processor.rbs @@ -2,10 +2,10 @@ module Mindee module PDF module PDFProcessor - def self.parse: (StringIO, PageOptions) -> StringIO - def self.indexes_from_keep: (Array[Integer], Array[untyped]) -> (Array[Integer] | Array[untyped]) - def self.indexes_from_remove: (Array[Integer], Array[untyped]) -> (Array[Integer] | Array[untyped]) - def self.open_pdf: (StringIO) -> Origami::PDF + def self.parse: (StringIO | File, PageOptions) -> StringIO + def self.indexes_from_keep: (Array[Integer], Array[Integer]) -> (Array[Integer]) + def self.indexes_from_remove: (Array[Integer], Array[Integer]) -> (Array[Integer]) + def self.open_pdf: (StringIO | File) -> Origami::PDF def self.get_page: (Origami::PDF, Integer) -> StringIO end end diff --git a/sig/mindee/pdf/pdf_tools.rbs b/sig/mindee/pdf/pdf_tools.rbs index 5e96d9f38..dc8ae8e9d 100644 --- a/sig/mindee/pdf/pdf_tools.rbs +++ b/sig/mindee/pdf/pdf_tools.rbs @@ -2,22 +2,28 @@ module Mindee module PDF module PDFTools - def to_io_stream: (?Hash[untyped, untyped]) -> StringIO - def self.stream_has_text?: (untyped) -> bool - def self.source_text?: (untyped) -> bool? - def self.create_xobject: (untyped) -> untyped - def self.set_xobject_properties: (untyped, untyped) -> untyped - def self.determine_filter: (untyped) -> (:DCTDecode | :FlateDecode | :LZWDecode) - def self.determine_colorspace: (untyped) -> (:DeviceCMYK | :DeviceGray | :DeviceRGB) - def self.add_content_to_page: (untyped, untyped, untyped, untyped) -> untyped - def compile: (untyped) -> untyped - def intents_as_pdfa1: () -> untyped - def delinearize!: () -> untyped - def linearized?: () -> untyped - def load_all_objects: () -> untyped - def output: (untyped) -> untyped - def self.set_page_dimensions: (untyped, untyped, untyped) -> untyped - def self.process_image_xobject: (untyped, untyped, untyped, untyped) -> untyped + BitsPerComponent: Integer + ColorSpace: Symbol + Contents: Origami::Stream + Height: Integer | Float + Width: Integer | Float + + def to_io_stream: (?Hash[Symbol, untyped]) -> StringIO + def intents_as_pdfa1: () -> void + def delinearize!: () -> void + def linearized?: () -> bool + def compile: (Hash[String | Symbol, untyped]) -> StringIO + def output: (Hash[String | Symbol, untyped]) -> String + def load_all_objects: () -> void + def self.stream_has_text?: (Origami::Stream) -> bool + def self.source_text?: (StringIO | File) -> bool + def self.create_xobject: (MiniMagick::Image) -> Origami::Graphics::ImageXObject + def self.set_xobject_properties: (Origami::Graphics::ImageXObject, MiniMagick::Image) -> void + def self.determine_filter: (MiniMagick::Image) -> (:DCTDecode | :FlateDecode | :LZWDecode) + def self.determine_colorspace: (MiniMagick::Image) -> (:DeviceCMYK | :DeviceGray | :DeviceRGB) + def self.add_content_to_page: (Origami::Page, String, Integer, Integer) -> void + def self.set_page_dimensions: (Origami::Page, Integer | Float, Integer | Float) -> void + def self.process_image_xobject: (MiniMagick::Image | StringIO, Integer, Integer | Float, Integer | Float) -> Origami::Graphics::ImageXObject end end end diff --git a/sig/mindee/product/barcode_reader/barcode_reader_v1.rbs b/sig/mindee/product/barcode_reader/barcode_reader_v1.rbs index f92cb485d..f6c25f5fa 100644 --- a/sig/mindee/product/barcode_reader/barcode_reader_v1.rbs +++ b/sig/mindee/product/barcode_reader/barcode_reader_v1.rbs @@ -4,7 +4,7 @@ module Mindee module Product module BarcodeReader class BarcodeReaderV1 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/barcode_reader/barcode_reader_v1_document.rbs b/sig/mindee/product/barcode_reader/barcode_reader_v1_document.rbs index a0c770466..1cf918b53 100644 --- a/sig/mindee/product/barcode_reader/barcode_reader_v1_document.rbs +++ b/sig/mindee/product/barcode_reader/barcode_reader_v1_document.rbs @@ -4,7 +4,7 @@ module Mindee module Product module BarcodeReader class BarcodeReaderV1Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def codes_1d: -> (Array[Parsing::Standard::StringField]) def codes_2d: -> (Array[Parsing::Standard::StringField]) def to_s: -> String diff --git a/sig/mindee/product/barcode_reader/barcode_reader_v1_page.rbs b/sig/mindee/product/barcode_reader/barcode_reader_v1_page.rbs index a32b8ad73..4236b483e 100644 --- a/sig/mindee/product/barcode_reader/barcode_reader_v1_page.rbs +++ b/sig/mindee/product/barcode_reader/barcode_reader_v1_page.rbs @@ -4,10 +4,10 @@ module Mindee module Product module BarcodeReader class BarcodeReaderV1Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class BarcodeReaderV1PagePrediction < BarcodeReaderV1Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/bill_of_lading/bill_of_lading_v1.rbs b/sig/mindee/product/bill_of_lading/bill_of_lading_v1.rbs index e5ec9295d..bc9546b5c 100644 --- a/sig/mindee/product/bill_of_lading/bill_of_lading_v1.rbs +++ b/sig/mindee/product/bill_of_lading/bill_of_lading_v1.rbs @@ -4,7 +4,7 @@ module Mindee module Product module BillOfLading class BillOfLadingV1 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/bill_of_lading/bill_of_lading_v1_carrier.rbs b/sig/mindee/product/bill_of_lading/bill_of_lading_v1_carrier.rbs index 53f1a0007..b51db8bbe 100644 --- a/sig/mindee/product/bill_of_lading/bill_of_lading_v1_carrier.rbs +++ b/sig/mindee/product/bill_of_lading/bill_of_lading_v1_carrier.rbs @@ -2,11 +2,11 @@ module Mindee module Product module BillOfLading class BillOfLadingV1Carrier < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def name: -> String def professional_number: -> String def scac: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/bill_of_lading/bill_of_lading_v1_carrier_item.rbs b/sig/mindee/product/bill_of_lading/bill_of_lading_v1_carrier_item.rbs index d043b7f72..024021651 100644 --- a/sig/mindee/product/bill_of_lading/bill_of_lading_v1_carrier_item.rbs +++ b/sig/mindee/product/bill_of_lading/bill_of_lading_v1_carrier_item.rbs @@ -2,15 +2,15 @@ module Mindee module Product module BillOfLading class BillOfLadingV1CarrierItem < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def description: -> String def gross_weight: -> Float def measurement: -> Float def measurement_unit: -> String def quantity: -> Float def weight_unit: -> String - def printable_values: -> Hash[Symbol | String, untyped] - def table_printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] + def table_printable_values: -> Hash[String | Symbol, untyped] def to_table_line: -> String def to_s: -> String end diff --git a/sig/mindee/product/bill_of_lading/bill_of_lading_v1_consignee.rbs b/sig/mindee/product/bill_of_lading/bill_of_lading_v1_consignee.rbs index 4e5e3a9b9..5640ae6ac 100644 --- a/sig/mindee/product/bill_of_lading/bill_of_lading_v1_consignee.rbs +++ b/sig/mindee/product/bill_of_lading/bill_of_lading_v1_consignee.rbs @@ -2,12 +2,12 @@ module Mindee module Product module BillOfLading class BillOfLadingV1Consignee < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def address: -> String def email: -> String def name: -> String def phone: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/bill_of_lading/bill_of_lading_v1_document.rbs b/sig/mindee/product/bill_of_lading/bill_of_lading_v1_document.rbs index 68e6a05b0..9b459c7c2 100644 --- a/sig/mindee/product/bill_of_lading/bill_of_lading_v1_document.rbs +++ b/sig/mindee/product/bill_of_lading/bill_of_lading_v1_document.rbs @@ -4,7 +4,7 @@ module Mindee module Product module BillOfLading class BillOfLadingV1Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def bill_of_lading_number: -> (Parsing::Standard::StringField) def carrier: -> (Product::BillOfLading::BillOfLadingV1Carrier) def carrier_items: -> (Product::BillOfLading::BillOfLadingV1CarrierItems) diff --git a/sig/mindee/product/bill_of_lading/bill_of_lading_v1_notify_party.rbs b/sig/mindee/product/bill_of_lading/bill_of_lading_v1_notify_party.rbs index 40a0cd504..f0fb65f0c 100644 --- a/sig/mindee/product/bill_of_lading/bill_of_lading_v1_notify_party.rbs +++ b/sig/mindee/product/bill_of_lading/bill_of_lading_v1_notify_party.rbs @@ -2,12 +2,12 @@ module Mindee module Product module BillOfLading class BillOfLadingV1NotifyParty < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def address: -> String def email: -> String def name: -> String def phone: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/bill_of_lading/bill_of_lading_v1_page.rbs b/sig/mindee/product/bill_of_lading/bill_of_lading_v1_page.rbs index 098c026f8..45964c572 100644 --- a/sig/mindee/product/bill_of_lading/bill_of_lading_v1_page.rbs +++ b/sig/mindee/product/bill_of_lading/bill_of_lading_v1_page.rbs @@ -4,10 +4,10 @@ module Mindee module Product module BillOfLading class BillOfLadingV1Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class BillOfLadingV1PagePrediction < BillOfLadingV1Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/bill_of_lading/bill_of_lading_v1_shipper.rbs b/sig/mindee/product/bill_of_lading/bill_of_lading_v1_shipper.rbs index ea7f8a9ee..67af0cc3d 100644 --- a/sig/mindee/product/bill_of_lading/bill_of_lading_v1_shipper.rbs +++ b/sig/mindee/product/bill_of_lading/bill_of_lading_v1_shipper.rbs @@ -2,12 +2,12 @@ module Mindee module Product module BillOfLading class BillOfLadingV1Shipper < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def address: -> String def email: -> String def name: -> String def phone: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/business_card/business_card_v1.rbs b/sig/mindee/product/business_card/business_card_v1.rbs index 3fb7f15f3..f6eb9c1b3 100644 --- a/sig/mindee/product/business_card/business_card_v1.rbs +++ b/sig/mindee/product/business_card/business_card_v1.rbs @@ -4,7 +4,7 @@ module Mindee module Product module BusinessCard class BusinessCardV1 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/business_card/business_card_v1_document.rbs b/sig/mindee/product/business_card/business_card_v1_document.rbs index 05440b8b7..14286df57 100644 --- a/sig/mindee/product/business_card/business_card_v1_document.rbs +++ b/sig/mindee/product/business_card/business_card_v1_document.rbs @@ -4,7 +4,7 @@ module Mindee module Product module BusinessCard class BusinessCardV1Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def address: -> (Parsing::Standard::StringField) def company: -> (Parsing::Standard::StringField) def email: -> (Parsing::Standard::StringField) diff --git a/sig/mindee/product/business_card/business_card_v1_page.rbs b/sig/mindee/product/business_card/business_card_v1_page.rbs index 8a0c7b30f..bc636440a 100644 --- a/sig/mindee/product/business_card/business_card_v1_page.rbs +++ b/sig/mindee/product/business_card/business_card_v1_page.rbs @@ -4,10 +4,10 @@ module Mindee module Product module BusinessCard class BusinessCardV1Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class BusinessCardV1PagePrediction < BusinessCardV1Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/cropper/cropper_v1.rbs b/sig/mindee/product/cropper/cropper_v1.rbs index b045ce267..e36799d73 100644 --- a/sig/mindee/product/cropper/cropper_v1.rbs +++ b/sig/mindee/product/cropper/cropper_v1.rbs @@ -4,7 +4,7 @@ module Mindee module Product module Cropper class CropperV1 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/cropper/cropper_v1_document.rbs b/sig/mindee/product/cropper/cropper_v1_document.rbs index 04c60c29d..a54ebb097 100644 --- a/sig/mindee/product/cropper/cropper_v1_document.rbs +++ b/sig/mindee/product/cropper/cropper_v1_document.rbs @@ -4,7 +4,7 @@ module Mindee module Product module Cropper class CropperV1Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/cropper/cropper_v1_page.rbs b/sig/mindee/product/cropper/cropper_v1_page.rbs index 14f01d1b9..b041c97d5 100644 --- a/sig/mindee/product/cropper/cropper_v1_page.rbs +++ b/sig/mindee/product/cropper/cropper_v1_page.rbs @@ -4,10 +4,10 @@ module Mindee module Product module Cropper class CropperV1Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class CropperV1PagePrediction < CropperV1Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def cropping: -> Array[Parsing::Standard::PositionField] def to_s: -> String end diff --git a/sig/mindee/product/delivery_note/delivery_note_v1.rbs b/sig/mindee/product/delivery_note/delivery_note_v1.rbs index d0417d2e9..4eccee964 100644 --- a/sig/mindee/product/delivery_note/delivery_note_v1.rbs +++ b/sig/mindee/product/delivery_note/delivery_note_v1.rbs @@ -4,7 +4,7 @@ module Mindee module Product module DeliveryNote class DeliveryNoteV1 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/delivery_note/delivery_note_v1_document.rbs b/sig/mindee/product/delivery_note/delivery_note_v1_document.rbs index 8b0fd425b..eb2059cea 100644 --- a/sig/mindee/product/delivery_note/delivery_note_v1_document.rbs +++ b/sig/mindee/product/delivery_note/delivery_note_v1_document.rbs @@ -4,7 +4,7 @@ module Mindee module Product module DeliveryNote class DeliveryNoteV1Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def customer_address: -> (Parsing::Standard::StringField) def customer_name: -> (Parsing::Standard::StringField) def delivery_date: -> (Parsing::Standard::DateField) diff --git a/sig/mindee/product/delivery_note/delivery_note_v1_page.rbs b/sig/mindee/product/delivery_note/delivery_note_v1_page.rbs index 0c7381006..24792b5bc 100644 --- a/sig/mindee/product/delivery_note/delivery_note_v1_page.rbs +++ b/sig/mindee/product/delivery_note/delivery_note_v1_page.rbs @@ -4,10 +4,10 @@ module Mindee module Product module DeliveryNote class DeliveryNoteV1Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class DeliveryNoteV1PagePrediction < DeliveryNoteV1Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/driver_license/driver_license_v1.rbs b/sig/mindee/product/driver_license/driver_license_v1.rbs index e2efa549d..70cf6686f 100644 --- a/sig/mindee/product/driver_license/driver_license_v1.rbs +++ b/sig/mindee/product/driver_license/driver_license_v1.rbs @@ -4,7 +4,7 @@ module Mindee module Product module DriverLicense class DriverLicenseV1 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/driver_license/driver_license_v1_document.rbs b/sig/mindee/product/driver_license/driver_license_v1_document.rbs index be47a3b35..9946d67fc 100644 --- a/sig/mindee/product/driver_license/driver_license_v1_document.rbs +++ b/sig/mindee/product/driver_license/driver_license_v1_document.rbs @@ -4,7 +4,7 @@ module Mindee module Product module DriverLicense class DriverLicenseV1Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def category: -> (Parsing::Standard::StringField) def country_code: -> (Parsing::Standard::StringField) def date_of_birth: -> (Parsing::Standard::DateField) diff --git a/sig/mindee/product/driver_license/driver_license_v1_page.rbs b/sig/mindee/product/driver_license/driver_license_v1_page.rbs index 1c172f047..d59fc2de7 100644 --- a/sig/mindee/product/driver_license/driver_license_v1_page.rbs +++ b/sig/mindee/product/driver_license/driver_license_v1_page.rbs @@ -4,10 +4,10 @@ module Mindee module Product module DriverLicense class DriverLicenseV1Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class DriverLicenseV1PagePrediction < DriverLicenseV1Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/financial_document/financial_document_v1.rbs b/sig/mindee/product/financial_document/financial_document_v1.rbs index f3c23cc8d..1958f2b86 100644 --- a/sig/mindee/product/financial_document/financial_document_v1.rbs +++ b/sig/mindee/product/financial_document/financial_document_v1.rbs @@ -4,7 +4,7 @@ module Mindee module Product module FinancialDocument class FinancialDocumentV1 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/financial_document/financial_document_v1_document.rbs b/sig/mindee/product/financial_document/financial_document_v1_document.rbs index b9fca7764..e16a6bf81 100644 --- a/sig/mindee/product/financial_document/financial_document_v1_document.rbs +++ b/sig/mindee/product/financial_document/financial_document_v1_document.rbs @@ -4,7 +4,7 @@ module Mindee module Product module FinancialDocument class FinancialDocumentV1Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def billing_address: -> (Parsing::Standard::AddressField) def category: -> (Parsing::Standard::ClassificationField) def customer_address: -> (Parsing::Standard::AddressField) diff --git a/sig/mindee/product/financial_document/financial_document_v1_line_item.rbs b/sig/mindee/product/financial_document/financial_document_v1_line_item.rbs index 4cb2b923e..21994be4d 100644 --- a/sig/mindee/product/financial_document/financial_document_v1_line_item.rbs +++ b/sig/mindee/product/financial_document/financial_document_v1_line_item.rbs @@ -2,7 +2,7 @@ module Mindee module Product module FinancialDocument class FinancialDocumentV1LineItem < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def description: -> String def product_code: -> String def quantity: -> Float @@ -11,8 +11,8 @@ module Mindee def total_amount: -> Float def unit_measure: -> String def unit_price: -> Float - def printable_values: -> Hash[Symbol | String, untyped] - def table_printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] + def table_printable_values: -> Hash[String | Symbol, untyped] def to_table_line: -> String def to_s: -> String end diff --git a/sig/mindee/product/financial_document/financial_document_v1_page.rbs b/sig/mindee/product/financial_document/financial_document_v1_page.rbs index 88bfa9b81..b0cf7072b 100644 --- a/sig/mindee/product/financial_document/financial_document_v1_page.rbs +++ b/sig/mindee/product/financial_document/financial_document_v1_page.rbs @@ -4,10 +4,10 @@ module Mindee module Product module FinancialDocument class FinancialDocumentV1Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class FinancialDocumentV1PagePrediction < FinancialDocumentV1Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/fr/bank_account_details/bank_account_details_v1.rbs b/sig/mindee/product/fr/bank_account_details/bank_account_details_v1.rbs index 0226de7b5..3dbdd649b 100644 --- a/sig/mindee/product/fr/bank_account_details/bank_account_details_v1.rbs +++ b/sig/mindee/product/fr/bank_account_details/bank_account_details_v1.rbs @@ -5,7 +5,7 @@ module Mindee module FR module BankAccountDetails class BankAccountDetailsV1 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/fr/bank_account_details/bank_account_details_v1_document.rbs b/sig/mindee/product/fr/bank_account_details/bank_account_details_v1_document.rbs index eddda8305..77cc8662d 100644 --- a/sig/mindee/product/fr/bank_account_details/bank_account_details_v1_document.rbs +++ b/sig/mindee/product/fr/bank_account_details/bank_account_details_v1_document.rbs @@ -5,7 +5,7 @@ module Mindee module FR module BankAccountDetails class BankAccountDetailsV1Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def account_holder_name: -> (Parsing::Standard::StringField) def iban: -> (Parsing::Standard::StringField) def swift: -> (Parsing::Standard::StringField) diff --git a/sig/mindee/product/fr/bank_account_details/bank_account_details_v1_page.rbs b/sig/mindee/product/fr/bank_account_details/bank_account_details_v1_page.rbs index 7852515b4..9aa88d771 100644 --- a/sig/mindee/product/fr/bank_account_details/bank_account_details_v1_page.rbs +++ b/sig/mindee/product/fr/bank_account_details/bank_account_details_v1_page.rbs @@ -5,10 +5,10 @@ module Mindee module FR module BankAccountDetails class BankAccountDetailsV1Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class BankAccountDetailsV1PagePrediction < BankAccountDetailsV1Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/fr/bank_account_details/bank_account_details_v2.rbs b/sig/mindee/product/fr/bank_account_details/bank_account_details_v2.rbs index 6429e2957..4104f8cac 100644 --- a/sig/mindee/product/fr/bank_account_details/bank_account_details_v2.rbs +++ b/sig/mindee/product/fr/bank_account_details/bank_account_details_v2.rbs @@ -5,7 +5,7 @@ module Mindee module FR module BankAccountDetails class BankAccountDetailsV2 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/fr/bank_account_details/bank_account_details_v2_bban.rbs b/sig/mindee/product/fr/bank_account_details/bank_account_details_v2_bban.rbs index 63a1d4b01..c6db964df 100644 --- a/sig/mindee/product/fr/bank_account_details/bank_account_details_v2_bban.rbs +++ b/sig/mindee/product/fr/bank_account_details/bank_account_details_v2_bban.rbs @@ -3,12 +3,12 @@ module Mindee module FR module BankAccountDetails class BankAccountDetailsV2Bban < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def bban_bank_code: -> String def bban_branch_code: -> String def bban_key: -> String def bban_number: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/fr/bank_account_details/bank_account_details_v2_document.rbs b/sig/mindee/product/fr/bank_account_details/bank_account_details_v2_document.rbs index 64225f36e..11925a9d4 100644 --- a/sig/mindee/product/fr/bank_account_details/bank_account_details_v2_document.rbs +++ b/sig/mindee/product/fr/bank_account_details/bank_account_details_v2_document.rbs @@ -5,7 +5,7 @@ module Mindee module FR module BankAccountDetails class BankAccountDetailsV2Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def account_holders_names: -> (Parsing::Standard::StringField) def bban: -> (Product::FR::BankAccountDetails::BankAccountDetailsV2Bban) def iban: -> (Parsing::Standard::StringField) diff --git a/sig/mindee/product/fr/bank_account_details/bank_account_details_v2_page.rbs b/sig/mindee/product/fr/bank_account_details/bank_account_details_v2_page.rbs index 75b8fa3f2..3b5813802 100644 --- a/sig/mindee/product/fr/bank_account_details/bank_account_details_v2_page.rbs +++ b/sig/mindee/product/fr/bank_account_details/bank_account_details_v2_page.rbs @@ -5,10 +5,10 @@ module Mindee module FR module BankAccountDetails class BankAccountDetailsV2Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class BankAccountDetailsV2PagePrediction < BankAccountDetailsV2Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/fr/bank_statement/bank_statement_v2.rbs b/sig/mindee/product/fr/bank_statement/bank_statement_v2.rbs index eeabf480a..9efba9b4f 100644 --- a/sig/mindee/product/fr/bank_statement/bank_statement_v2.rbs +++ b/sig/mindee/product/fr/bank_statement/bank_statement_v2.rbs @@ -5,7 +5,7 @@ module Mindee module FR module BankStatement class BankStatementV2 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/fr/bank_statement/bank_statement_v2_document.rbs b/sig/mindee/product/fr/bank_statement/bank_statement_v2_document.rbs index 9a536ff4d..22dbadc3a 100644 --- a/sig/mindee/product/fr/bank_statement/bank_statement_v2_document.rbs +++ b/sig/mindee/product/fr/bank_statement/bank_statement_v2_document.rbs @@ -5,7 +5,7 @@ module Mindee module FR module BankStatement class BankStatementV2Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def account_number: -> (Parsing::Standard::StringField) def bank_address: -> (Parsing::Standard::StringField) def bank_name: -> (Parsing::Standard::StringField) diff --git a/sig/mindee/product/fr/bank_statement/bank_statement_v2_page.rbs b/sig/mindee/product/fr/bank_statement/bank_statement_v2_page.rbs index c586ae46c..3da539654 100644 --- a/sig/mindee/product/fr/bank_statement/bank_statement_v2_page.rbs +++ b/sig/mindee/product/fr/bank_statement/bank_statement_v2_page.rbs @@ -5,10 +5,10 @@ module Mindee module FR module BankStatement class BankStatementV2Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class BankStatementV2PagePrediction < BankStatementV2Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/fr/bank_statement/bank_statement_v2_transaction.rbs b/sig/mindee/product/fr/bank_statement/bank_statement_v2_transaction.rbs index 41e4158df..aef64ec1f 100644 --- a/sig/mindee/product/fr/bank_statement/bank_statement_v2_transaction.rbs +++ b/sig/mindee/product/fr/bank_statement/bank_statement_v2_transaction.rbs @@ -3,12 +3,12 @@ module Mindee module FR module BankStatement class BankStatementV2Transaction < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def amount: -> Float def date: -> String def description: -> String - def printable_values: -> Hash[Symbol | String, untyped] - def table_printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] + def table_printable_values: -> Hash[String | Symbol, untyped] def to_table_line: -> String def to_s: -> String end diff --git a/sig/mindee/product/fr/carte_grise/carte_grise_v1.rbs b/sig/mindee/product/fr/carte_grise/carte_grise_v1.rbs index d7d43f769..eb2373bae 100644 --- a/sig/mindee/product/fr/carte_grise/carte_grise_v1.rbs +++ b/sig/mindee/product/fr/carte_grise/carte_grise_v1.rbs @@ -5,7 +5,7 @@ module Mindee module FR module CarteGrise class CarteGriseV1 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/fr/carte_grise/carte_grise_v1_document.rbs b/sig/mindee/product/fr/carte_grise/carte_grise_v1_document.rbs index 41385d932..752493dc0 100644 --- a/sig/mindee/product/fr/carte_grise/carte_grise_v1_document.rbs +++ b/sig/mindee/product/fr/carte_grise/carte_grise_v1_document.rbs @@ -5,7 +5,7 @@ module Mindee module FR module CarteGrise class CarteGriseV1Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def a: -> (Parsing::Standard::StringField) def b: -> (Parsing::Standard::DateField) def c1: -> (Parsing::Standard::StringField) diff --git a/sig/mindee/product/fr/carte_grise/carte_grise_v1_page.rbs b/sig/mindee/product/fr/carte_grise/carte_grise_v1_page.rbs index 3e9cda3a0..a17e25eb3 100644 --- a/sig/mindee/product/fr/carte_grise/carte_grise_v1_page.rbs +++ b/sig/mindee/product/fr/carte_grise/carte_grise_v1_page.rbs @@ -5,10 +5,10 @@ module Mindee module FR module CarteGrise class CarteGriseV1Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class CarteGriseV1PagePrediction < CarteGriseV1Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/fr/energy_bill/energy_bill_v1.rbs b/sig/mindee/product/fr/energy_bill/energy_bill_v1.rbs index 3fd863960..2e94fe391 100644 --- a/sig/mindee/product/fr/energy_bill/energy_bill_v1.rbs +++ b/sig/mindee/product/fr/energy_bill/energy_bill_v1.rbs @@ -5,7 +5,7 @@ module Mindee module FR module EnergyBill class EnergyBillV1 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/fr/energy_bill/energy_bill_v1_document.rbs b/sig/mindee/product/fr/energy_bill/energy_bill_v1_document.rbs index 526d7b7e3..809ed576e 100644 --- a/sig/mindee/product/fr/energy_bill/energy_bill_v1_document.rbs +++ b/sig/mindee/product/fr/energy_bill/energy_bill_v1_document.rbs @@ -5,7 +5,7 @@ module Mindee module FR module EnergyBill class EnergyBillV1Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def contract_id: -> (Parsing::Standard::StringField) def delivery_point: -> (Parsing::Standard::StringField) def due_date: -> (Parsing::Standard::DateField) diff --git a/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_consumer.rbs b/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_consumer.rbs index ad976177e..deb4f8194 100644 --- a/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_consumer.rbs +++ b/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_consumer.rbs @@ -3,10 +3,10 @@ module Mindee module FR module EnergyBill class EnergyBillV1EnergyConsumer < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def address: -> String def name: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_supplier.rbs b/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_supplier.rbs index 4b6ba5528..403898436 100644 --- a/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_supplier.rbs +++ b/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_supplier.rbs @@ -3,10 +3,10 @@ module Mindee module FR module EnergyBill class EnergyBillV1EnergySupplier < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def address: -> String def name: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_usage.rbs b/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_usage.rbs index ba5591548..f2f2f412d 100644 --- a/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_usage.rbs +++ b/sig/mindee/product/fr/energy_bill/energy_bill_v1_energy_usage.rbs @@ -3,7 +3,7 @@ module Mindee module FR module EnergyBill class EnergyBillV1EnergyUsage < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def consumption: -> Float def description: -> String def end_date: -> String @@ -12,8 +12,8 @@ module Mindee def total: -> Float def unit: -> String def unit_price: -> Float - def printable_values: -> Hash[Symbol | String, untyped] - def table_printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] + def table_printable_values: -> Hash[String | Symbol, untyped] def to_table_line: -> String def to_s: -> String end diff --git a/sig/mindee/product/fr/energy_bill/energy_bill_v1_meter_detail.rbs b/sig/mindee/product/fr/energy_bill/energy_bill_v1_meter_detail.rbs index ccfa50a81..7183023c4 100644 --- a/sig/mindee/product/fr/energy_bill/energy_bill_v1_meter_detail.rbs +++ b/sig/mindee/product/fr/energy_bill/energy_bill_v1_meter_detail.rbs @@ -3,11 +3,11 @@ module Mindee module FR module EnergyBill class EnergyBillV1MeterDetail < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def meter_number: -> String def meter_type: -> String def unit: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/fr/energy_bill/energy_bill_v1_page.rbs b/sig/mindee/product/fr/energy_bill/energy_bill_v1_page.rbs index 19b920437..6b395bacd 100644 --- a/sig/mindee/product/fr/energy_bill/energy_bill_v1_page.rbs +++ b/sig/mindee/product/fr/energy_bill/energy_bill_v1_page.rbs @@ -5,10 +5,10 @@ module Mindee module FR module EnergyBill class EnergyBillV1Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class EnergyBillV1PagePrediction < EnergyBillV1Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rbs b/sig/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rbs index 0812fdd83..cd9ac17aa 100644 --- a/sig/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rbs +++ b/sig/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rbs @@ -3,15 +3,15 @@ module Mindee module FR module EnergyBill class EnergyBillV1Subscription < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def description: -> String def end_date: -> String def start_date: -> String def tax_rate: -> Float def total: -> Float def unit_price: -> Float - def printable_values: -> Hash[Symbol | String, untyped] - def table_printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] + def table_printable_values: -> Hash[String | Symbol, untyped] def to_table_line: -> String def to_s: -> String end diff --git a/sig/mindee/product/fr/energy_bill/energy_bill_v1_taxes_and_contribution.rbs b/sig/mindee/product/fr/energy_bill/energy_bill_v1_taxes_and_contribution.rbs index 80fba64ce..3c6ec333f 100644 --- a/sig/mindee/product/fr/energy_bill/energy_bill_v1_taxes_and_contribution.rbs +++ b/sig/mindee/product/fr/energy_bill/energy_bill_v1_taxes_and_contribution.rbs @@ -3,15 +3,15 @@ module Mindee module FR module EnergyBill class EnergyBillV1TaxesAndContribution < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def description: -> String def end_date: -> String def start_date: -> String def tax_rate: -> Float def total: -> Float def unit_price: -> Float - def printable_values: -> Hash[Symbol | String, untyped] - def table_printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] + def table_printable_values: -> Hash[String | Symbol, untyped] def to_table_line: -> String def to_s: -> String end diff --git a/sig/mindee/product/fr/health_card/health_card_v1.rbs b/sig/mindee/product/fr/health_card/health_card_v1.rbs index 35ac7d57c..497e22fb1 100644 --- a/sig/mindee/product/fr/health_card/health_card_v1.rbs +++ b/sig/mindee/product/fr/health_card/health_card_v1.rbs @@ -5,7 +5,7 @@ module Mindee module FR module HealthCard class HealthCardV1 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/fr/health_card/health_card_v1_document.rbs b/sig/mindee/product/fr/health_card/health_card_v1_document.rbs index ba15f3d2d..50a8ea5f6 100644 --- a/sig/mindee/product/fr/health_card/health_card_v1_document.rbs +++ b/sig/mindee/product/fr/health_card/health_card_v1_document.rbs @@ -5,7 +5,7 @@ module Mindee module FR module HealthCard class HealthCardV1Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def given_names: -> (Array[Parsing::Standard::StringField]) def issuance_date: -> (Parsing::Standard::DateField) def social_security: -> (Parsing::Standard::StringField) diff --git a/sig/mindee/product/fr/health_card/health_card_v1_page.rbs b/sig/mindee/product/fr/health_card/health_card_v1_page.rbs index 3ff463d38..6b8858de7 100644 --- a/sig/mindee/product/fr/health_card/health_card_v1_page.rbs +++ b/sig/mindee/product/fr/health_card/health_card_v1_page.rbs @@ -5,10 +5,10 @@ module Mindee module FR module HealthCard class HealthCardV1Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class HealthCardV1PagePrediction < HealthCardV1Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/fr/id_card/id_card_v1.rbs b/sig/mindee/product/fr/id_card/id_card_v1.rbs index 1892193f3..42b46b187 100644 --- a/sig/mindee/product/fr/id_card/id_card_v1.rbs +++ b/sig/mindee/product/fr/id_card/id_card_v1.rbs @@ -5,7 +5,7 @@ module Mindee module FR module IdCard class IdCardV1 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/fr/id_card/id_card_v1_document.rbs b/sig/mindee/product/fr/id_card/id_card_v1_document.rbs index 2e4af6125..08759aac8 100644 --- a/sig/mindee/product/fr/id_card/id_card_v1_document.rbs +++ b/sig/mindee/product/fr/id_card/id_card_v1_document.rbs @@ -5,7 +5,7 @@ module Mindee module FR module IdCard class IdCardV1Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def authority: -> (Parsing::Standard::StringField) def birth_date: -> (Parsing::Standard::DateField) def birth_place: -> (Parsing::Standard::StringField) diff --git a/sig/mindee/product/fr/id_card/id_card_v1_page.rbs b/sig/mindee/product/fr/id_card/id_card_v1_page.rbs index 78f682d77..9cf966626 100644 --- a/sig/mindee/product/fr/id_card/id_card_v1_page.rbs +++ b/sig/mindee/product/fr/id_card/id_card_v1_page.rbs @@ -5,10 +5,10 @@ module Mindee module FR module IdCard class IdCardV1Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class IdCardV1PagePrediction < IdCardV1Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def document_side: -> Parsing::Standard::ClassificationField def to_s: -> String end diff --git a/sig/mindee/product/fr/id_card/id_card_v2.rbs b/sig/mindee/product/fr/id_card/id_card_v2.rbs index eb5ed7513..b64e89040 100644 --- a/sig/mindee/product/fr/id_card/id_card_v2.rbs +++ b/sig/mindee/product/fr/id_card/id_card_v2.rbs @@ -5,7 +5,7 @@ module Mindee module FR module IdCard class IdCardV2 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/fr/id_card/id_card_v2_document.rbs b/sig/mindee/product/fr/id_card/id_card_v2_document.rbs index 22abd2970..6b6a3312f 100644 --- a/sig/mindee/product/fr/id_card/id_card_v2_document.rbs +++ b/sig/mindee/product/fr/id_card/id_card_v2_document.rbs @@ -5,7 +5,7 @@ module Mindee module FR module IdCard class IdCardV2Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def alternate_name: -> (Parsing::Standard::StringField) def authority: -> (Parsing::Standard::StringField) def birth_date: -> (Parsing::Standard::DateField) diff --git a/sig/mindee/product/fr/id_card/id_card_v2_page.rbs b/sig/mindee/product/fr/id_card/id_card_v2_page.rbs index bfbeeb7a7..f9bd4c9b4 100644 --- a/sig/mindee/product/fr/id_card/id_card_v2_page.rbs +++ b/sig/mindee/product/fr/id_card/id_card_v2_page.rbs @@ -5,10 +5,10 @@ module Mindee module FR module IdCard class IdCardV2Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class IdCardV2PagePrediction < IdCardV2Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def document_side: -> Parsing::Standard::ClassificationField def document_type: -> Parsing::Standard::ClassificationField def to_s: -> String diff --git a/sig/mindee/product/fr/payslip/payslip_v2.rbs b/sig/mindee/product/fr/payslip/payslip_v2.rbs index e74b64b94..9e3660bb4 100644 --- a/sig/mindee/product/fr/payslip/payslip_v2.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v2.rbs @@ -5,7 +5,7 @@ module Mindee module FR module Payslip class PayslipV2 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/fr/payslip/payslip_v2_bank_account_detail.rbs b/sig/mindee/product/fr/payslip/payslip_v2_bank_account_detail.rbs index 5c30345e0..4885054ec 100644 --- a/sig/mindee/product/fr/payslip/payslip_v2_bank_account_detail.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v2_bank_account_detail.rbs @@ -3,11 +3,11 @@ module Mindee module FR module Payslip class PayslipV2BankAccountDetail < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def bank_name: -> String def iban: -> String def swift: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/fr/payslip/payslip_v2_document.rbs b/sig/mindee/product/fr/payslip/payslip_v2_document.rbs index 922974b18..fcc5273c8 100644 --- a/sig/mindee/product/fr/payslip/payslip_v2_document.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v2_document.rbs @@ -5,7 +5,7 @@ module Mindee module FR module Payslip class PayslipV2Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def bank_account_details: -> (Product::FR::Payslip::PayslipV2BankAccountDetail) def employee: -> (Product::FR::Payslip::PayslipV2Employee) def employer: -> (Product::FR::Payslip::PayslipV2Employer) diff --git a/sig/mindee/product/fr/payslip/payslip_v2_employee.rbs b/sig/mindee/product/fr/payslip/payslip_v2_employee.rbs index cc1cc577f..9551d0485 100644 --- a/sig/mindee/product/fr/payslip/payslip_v2_employee.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v2_employee.rbs @@ -3,7 +3,7 @@ module Mindee module FR module Payslip class PayslipV2Employee < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def address: -> String def date_of_birth: -> String def first_name: -> String @@ -11,7 +11,7 @@ module Mindee def phone_number: -> String def registration_number: -> String def social_security_number: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/fr/payslip/payslip_v2_employer.rbs b/sig/mindee/product/fr/payslip/payslip_v2_employer.rbs index 06d2dc822..da57db7fa 100644 --- a/sig/mindee/product/fr/payslip/payslip_v2_employer.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v2_employer.rbs @@ -3,7 +3,7 @@ module Mindee module FR module Payslip class PayslipV2Employer < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def address: -> String def company_id: -> String def company_site: -> String @@ -11,7 +11,7 @@ module Mindee def name: -> String def phone_number: -> String def urssaf_number: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/fr/payslip/payslip_v2_employment.rbs b/sig/mindee/product/fr/payslip/payslip_v2_employment.rbs index 774c714bc..2aa5dbb6e 100644 --- a/sig/mindee/product/fr/payslip/payslip_v2_employment.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v2_employment.rbs @@ -3,14 +3,14 @@ module Mindee module FR module Payslip class PayslipV2Employment < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def category: -> String def coefficient: -> Float def collective_agreement: -> String def job_title: -> String def position_level: -> String def start_date: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/fr/payslip/payslip_v2_page.rbs b/sig/mindee/product/fr/payslip/payslip_v2_page.rbs index 8b1b29d52..4b9e3e146 100644 --- a/sig/mindee/product/fr/payslip/payslip_v2_page.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v2_page.rbs @@ -5,10 +5,10 @@ module Mindee module FR module Payslip class PayslipV2Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class PayslipV2PagePrediction < PayslipV2Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/fr/payslip/payslip_v2_pay_detail.rbs b/sig/mindee/product/fr/payslip/payslip_v2_pay_detail.rbs index 9cd65bc66..082f73113 100644 --- a/sig/mindee/product/fr/payslip/payslip_v2_pay_detail.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v2_pay_detail.rbs @@ -3,7 +3,7 @@ module Mindee module FR module Payslip class PayslipV2PayDetail < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def gross_salary: -> Float def gross_salary_ytd: -> Float def income_tax_rate: -> Float @@ -14,7 +14,7 @@ module Mindee def net_taxable_ytd: -> Float def total_cost_employer: -> Float def total_taxes_and_deductions: -> Float - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/fr/payslip/payslip_v2_pay_period.rbs b/sig/mindee/product/fr/payslip/payslip_v2_pay_period.rbs index eb4bf8978..10097ae19 100644 --- a/sig/mindee/product/fr/payslip/payslip_v2_pay_period.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v2_pay_period.rbs @@ -3,13 +3,13 @@ module Mindee module FR module Payslip class PayslipV2PayPeriod < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def end_date: -> String def month: -> String def payment_date: -> String def start_date: -> String def year: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/fr/payslip/payslip_v2_pto.rbs b/sig/mindee/product/fr/payslip/payslip_v2_pto.rbs index a80ad0734..45aae4339 100644 --- a/sig/mindee/product/fr/payslip/payslip_v2_pto.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v2_pto.rbs @@ -3,11 +3,11 @@ module Mindee module FR module Payslip class PayslipV2Pto < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def accrued_this_period: -> Float def balance_end_of_period: -> Float def used_this_period: -> Float - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/fr/payslip/payslip_v2_salary_detail.rbs b/sig/mindee/product/fr/payslip/payslip_v2_salary_detail.rbs index a2f924101..f6deb33ac 100644 --- a/sig/mindee/product/fr/payslip/payslip_v2_salary_detail.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v2_salary_detail.rbs @@ -3,13 +3,13 @@ module Mindee module FR module Payslip class PayslipV2SalaryDetail < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def amount: -> Float def base: -> Float def description: -> String def rate: -> Float - def printable_values: -> Hash[Symbol | String, untyped] - def table_printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] + def table_printable_values: -> Hash[String | Symbol, untyped] def to_table_line: -> String def to_s: -> String end diff --git a/sig/mindee/product/fr/payslip/payslip_v3.rbs b/sig/mindee/product/fr/payslip/payslip_v3.rbs index 193937f10..ab2dbac6e 100644 --- a/sig/mindee/product/fr/payslip/payslip_v3.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v3.rbs @@ -5,7 +5,7 @@ module Mindee module FR module Payslip class PayslipV3 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/fr/payslip/payslip_v3_bank_account_detail.rbs b/sig/mindee/product/fr/payslip/payslip_v3_bank_account_detail.rbs index fbf0ebdf8..a5a161ca6 100644 --- a/sig/mindee/product/fr/payslip/payslip_v3_bank_account_detail.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v3_bank_account_detail.rbs @@ -3,11 +3,11 @@ module Mindee module FR module Payslip class PayslipV3BankAccountDetail < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def bank_name: -> String def iban: -> String def swift: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/fr/payslip/payslip_v3_document.rbs b/sig/mindee/product/fr/payslip/payslip_v3_document.rbs index 33a9dbd3c..deab66dfa 100644 --- a/sig/mindee/product/fr/payslip/payslip_v3_document.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v3_document.rbs @@ -5,7 +5,7 @@ module Mindee module FR module Payslip class PayslipV3Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def bank_account_details: -> (Product::FR::Payslip::PayslipV3BankAccountDetail) def employee: -> (Product::FR::Payslip::PayslipV3Employee) def employer: -> (Product::FR::Payslip::PayslipV3Employer) diff --git a/sig/mindee/product/fr/payslip/payslip_v3_employee.rbs b/sig/mindee/product/fr/payslip/payslip_v3_employee.rbs index a2d2b10c6..8935b9b86 100644 --- a/sig/mindee/product/fr/payslip/payslip_v3_employee.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v3_employee.rbs @@ -3,7 +3,7 @@ module Mindee module FR module Payslip class PayslipV3Employee < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def address: -> String def date_of_birth: -> String def first_name: -> String @@ -11,7 +11,7 @@ module Mindee def phone_number: -> String def registration_number: -> String def social_security_number: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/fr/payslip/payslip_v3_employer.rbs b/sig/mindee/product/fr/payslip/payslip_v3_employer.rbs index 54067b7ee..a05a20013 100644 --- a/sig/mindee/product/fr/payslip/payslip_v3_employer.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v3_employer.rbs @@ -3,7 +3,7 @@ module Mindee module FR module Payslip class PayslipV3Employer < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def address: -> String def company_id: -> String def company_site: -> String @@ -11,7 +11,7 @@ module Mindee def name: -> String def phone_number: -> String def urssaf_number: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/fr/payslip/payslip_v3_employment.rbs b/sig/mindee/product/fr/payslip/payslip_v3_employment.rbs index 3e6f96390..2856d1a85 100644 --- a/sig/mindee/product/fr/payslip/payslip_v3_employment.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v3_employment.rbs @@ -3,7 +3,7 @@ module Mindee module FR module Payslip class PayslipV3Employment < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def category: -> String def coefficient: -> String def collective_agreement: -> String @@ -11,7 +11,7 @@ module Mindee def position_level: -> String def seniority_date: -> String def start_date: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/fr/payslip/payslip_v3_page.rbs b/sig/mindee/product/fr/payslip/payslip_v3_page.rbs index eeaf8d78b..771111d34 100644 --- a/sig/mindee/product/fr/payslip/payslip_v3_page.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v3_page.rbs @@ -5,10 +5,10 @@ module Mindee module FR module Payslip class PayslipV3Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class PayslipV3PagePrediction < PayslipV3Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/fr/payslip/payslip_v3_paid_time_off.rbs b/sig/mindee/product/fr/payslip/payslip_v3_paid_time_off.rbs index d5cdd7fab..5ebb28a41 100644 --- a/sig/mindee/product/fr/payslip/payslip_v3_paid_time_off.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v3_paid_time_off.rbs @@ -3,14 +3,14 @@ module Mindee module FR module Payslip class PayslipV3PaidTimeOff < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def accrued: -> Float def period: -> String def pto_type: -> String def remaining: -> Float def used: -> Float - def printable_values: -> Hash[Symbol | String, untyped] - def table_printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] + def table_printable_values: -> Hash[String | Symbol, untyped] def to_table_line: -> String def to_s: -> String end diff --git a/sig/mindee/product/fr/payslip/payslip_v3_pay_detail.rbs b/sig/mindee/product/fr/payslip/payslip_v3_pay_detail.rbs index 466d7423f..da6b575c6 100644 --- a/sig/mindee/product/fr/payslip/payslip_v3_pay_detail.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v3_pay_detail.rbs @@ -3,7 +3,7 @@ module Mindee module FR module Payslip class PayslipV3PayDetail < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def gross_salary: -> Float def gross_salary_ytd: -> Float def income_tax_rate: -> Float @@ -14,7 +14,7 @@ module Mindee def net_taxable_ytd: -> Float def total_cost_employer: -> Float def total_taxes_and_deductions: -> Float - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/fr/payslip/payslip_v3_pay_period.rbs b/sig/mindee/product/fr/payslip/payslip_v3_pay_period.rbs index eba9d2e76..be74ceda7 100644 --- a/sig/mindee/product/fr/payslip/payslip_v3_pay_period.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v3_pay_period.rbs @@ -3,13 +3,13 @@ module Mindee module FR module Payslip class PayslipV3PayPeriod < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def end_date: -> String def month: -> String def payment_date: -> String def start_date: -> String def year: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/fr/payslip/payslip_v3_salary_detail.rbs b/sig/mindee/product/fr/payslip/payslip_v3_salary_detail.rbs index 5c5d417a1..e560d1c20 100644 --- a/sig/mindee/product/fr/payslip/payslip_v3_salary_detail.rbs +++ b/sig/mindee/product/fr/payslip/payslip_v3_salary_detail.rbs @@ -3,14 +3,14 @@ module Mindee module FR module Payslip class PayslipV3SalaryDetail < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def amount: -> Float def base: -> Float def description: -> String def number: -> Float def rate: -> Float - def printable_values: -> Hash[Symbol | String, untyped] - def table_printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] + def table_printable_values: -> Hash[String | Symbol, untyped] def to_table_line: -> String def to_s: -> String end diff --git a/sig/mindee/product/ind/indian_passport/indian_passport_v1.rbs b/sig/mindee/product/ind/indian_passport/indian_passport_v1.rbs index ecdcf7df1..09fa33b4f 100644 --- a/sig/mindee/product/ind/indian_passport/indian_passport_v1.rbs +++ b/sig/mindee/product/ind/indian_passport/indian_passport_v1.rbs @@ -5,7 +5,7 @@ module Mindee module IND module IndianPassport class IndianPassportV1 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/ind/indian_passport/indian_passport_v1_document.rbs b/sig/mindee/product/ind/indian_passport/indian_passport_v1_document.rbs index 33a6e1f87..dab7c5f73 100644 --- a/sig/mindee/product/ind/indian_passport/indian_passport_v1_document.rbs +++ b/sig/mindee/product/ind/indian_passport/indian_passport_v1_document.rbs @@ -5,7 +5,7 @@ module Mindee module IND module IndianPassport class IndianPassportV1Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def address1: -> (Parsing::Standard::StringField) def address2: -> (Parsing::Standard::StringField) def address3: -> (Parsing::Standard::StringField) diff --git a/sig/mindee/product/ind/indian_passport/indian_passport_v1_page.rbs b/sig/mindee/product/ind/indian_passport/indian_passport_v1_page.rbs index 4d3324179..a5a04c18a 100644 --- a/sig/mindee/product/ind/indian_passport/indian_passport_v1_page.rbs +++ b/sig/mindee/product/ind/indian_passport/indian_passport_v1_page.rbs @@ -5,10 +5,10 @@ module Mindee module IND module IndianPassport class IndianPassportV1Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class IndianPassportV1PagePrediction < IndianPassportV1Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/international_id/international_id_v2.rbs b/sig/mindee/product/international_id/international_id_v2.rbs index dcd65fbbb..2d3209608 100644 --- a/sig/mindee/product/international_id/international_id_v2.rbs +++ b/sig/mindee/product/international_id/international_id_v2.rbs @@ -4,7 +4,7 @@ module Mindee module Product module InternationalId class InternationalIdV2 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/international_id/international_id_v2_document.rbs b/sig/mindee/product/international_id/international_id_v2_document.rbs index 5acda5f8e..89605400a 100644 --- a/sig/mindee/product/international_id/international_id_v2_document.rbs +++ b/sig/mindee/product/international_id/international_id_v2_document.rbs @@ -4,7 +4,7 @@ module Mindee module Product module InternationalId class InternationalIdV2Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def address: -> (Parsing::Standard::StringField) def birth_date: -> (Parsing::Standard::DateField) def birth_place: -> (Parsing::Standard::StringField) diff --git a/sig/mindee/product/international_id/international_id_v2_page.rbs b/sig/mindee/product/international_id/international_id_v2_page.rbs index 154f6fec4..aff9c96ec 100644 --- a/sig/mindee/product/international_id/international_id_v2_page.rbs +++ b/sig/mindee/product/international_id/international_id_v2_page.rbs @@ -4,10 +4,10 @@ module Mindee module Product module InternationalId class InternationalIdV2Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class InternationalIdV2PagePrediction < InternationalIdV2Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/invoice/invoice_v4.rbs b/sig/mindee/product/invoice/invoice_v4.rbs index b6df6ecfb..dce951753 100644 --- a/sig/mindee/product/invoice/invoice_v4.rbs +++ b/sig/mindee/product/invoice/invoice_v4.rbs @@ -4,7 +4,7 @@ module Mindee module Product module Invoice class InvoiceV4 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/invoice/invoice_v4_document.rbs b/sig/mindee/product/invoice/invoice_v4_document.rbs index 78823fc07..c1ac95247 100644 --- a/sig/mindee/product/invoice/invoice_v4_document.rbs +++ b/sig/mindee/product/invoice/invoice_v4_document.rbs @@ -4,7 +4,7 @@ module Mindee module Product module Invoice class InvoiceV4Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def billing_address: -> (Parsing::Standard::AddressField) def category: -> (Parsing::Standard::ClassificationField) def customer_address: -> (Parsing::Standard::AddressField) diff --git a/sig/mindee/product/invoice/invoice_v4_line_item.rbs b/sig/mindee/product/invoice/invoice_v4_line_item.rbs index d0cd2fc29..b4217c6f1 100644 --- a/sig/mindee/product/invoice/invoice_v4_line_item.rbs +++ b/sig/mindee/product/invoice/invoice_v4_line_item.rbs @@ -2,7 +2,7 @@ module Mindee module Product module Invoice class InvoiceV4LineItem < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def description: -> String def product_code: -> String def quantity: -> Float @@ -11,8 +11,8 @@ module Mindee def total_amount: -> Float def unit_measure: -> String def unit_price: -> Float - def printable_values: -> Hash[Symbol | String, untyped] - def table_printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] + def table_printable_values: -> Hash[String | Symbol, untyped] def to_table_line: -> String def to_s: -> String end diff --git a/sig/mindee/product/invoice/invoice_v4_page.rbs b/sig/mindee/product/invoice/invoice_v4_page.rbs index e40b49f2c..041228d4b 100644 --- a/sig/mindee/product/invoice/invoice_v4_page.rbs +++ b/sig/mindee/product/invoice/invoice_v4_page.rbs @@ -4,10 +4,10 @@ module Mindee module Product module Invoice class InvoiceV4Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class InvoiceV4PagePrediction < InvoiceV4Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/invoice_splitter/invoice_splitter_v1.rbs b/sig/mindee/product/invoice_splitter/invoice_splitter_v1.rbs index c86051e01..e34fb52e6 100644 --- a/sig/mindee/product/invoice_splitter/invoice_splitter_v1.rbs +++ b/sig/mindee/product/invoice_splitter/invoice_splitter_v1.rbs @@ -4,7 +4,7 @@ module Mindee module Product module InvoiceSplitter class InvoiceSplitterV1 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/invoice_splitter/invoice_splitter_v1_document.rbs b/sig/mindee/product/invoice_splitter/invoice_splitter_v1_document.rbs index ba6329436..890486052 100644 --- a/sig/mindee/product/invoice_splitter/invoice_splitter_v1_document.rbs +++ b/sig/mindee/product/invoice_splitter/invoice_splitter_v1_document.rbs @@ -4,7 +4,7 @@ module Mindee module Product module InvoiceSplitter class InvoiceSplitterV1Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def invoice_page_groups: -> (Product::InvoiceSplitter::InvoiceSplitterV1InvoicePageGroups) def invoice_page_groups_separator: (String) -> String def invoice_page_groups_to_s: -> String diff --git a/sig/mindee/product/invoice_splitter/invoice_splitter_v1_invoice_page_group.rbs b/sig/mindee/product/invoice_splitter/invoice_splitter_v1_invoice_page_group.rbs index 805166b94..5782f3038 100644 --- a/sig/mindee/product/invoice_splitter/invoice_splitter_v1_invoice_page_group.rbs +++ b/sig/mindee/product/invoice_splitter/invoice_splitter_v1_invoice_page_group.rbs @@ -2,10 +2,10 @@ module Mindee module Product module InvoiceSplitter class InvoiceSplitterV1InvoicePageGroup < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def page_indexes: -> Array[Integer] - def printable_values: -> Hash[Symbol | String, untyped] - def table_printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] + def table_printable_values: -> Hash[String | Symbol, untyped] def to_table_line: -> String def to_s: -> String end diff --git a/sig/mindee/product/invoice_splitter/invoice_splitter_v1_page.rbs b/sig/mindee/product/invoice_splitter/invoice_splitter_v1_page.rbs index 689753f43..2ed881454 100644 --- a/sig/mindee/product/invoice_splitter/invoice_splitter_v1_page.rbs +++ b/sig/mindee/product/invoice_splitter/invoice_splitter_v1_page.rbs @@ -4,10 +4,10 @@ module Mindee module Product module InvoiceSplitter class InvoiceSplitterV1Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class InvoiceSplitterV1PagePrediction < InvoiceSplitterV1Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/multi_receipts_detector/multi_receipts_detector_v1.rbs b/sig/mindee/product/multi_receipts_detector/multi_receipts_detector_v1.rbs index d433be3f2..0a6979a95 100644 --- a/sig/mindee/product/multi_receipts_detector/multi_receipts_detector_v1.rbs +++ b/sig/mindee/product/multi_receipts_detector/multi_receipts_detector_v1.rbs @@ -4,7 +4,7 @@ module Mindee module Product module MultiReceiptsDetector class MultiReceiptsDetectorV1 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_document.rbs b/sig/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_document.rbs index 22e75d251..eafb6b58a 100644 --- a/sig/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_document.rbs +++ b/sig/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_document.rbs @@ -4,7 +4,7 @@ module Mindee module Product module MultiReceiptsDetector class MultiReceiptsDetectorV1Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def receipts: -> (Array[Parsing::Standard::PositionField]) def to_s: -> String end diff --git a/sig/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_page.rbs b/sig/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_page.rbs index 2c677dcd3..949e77e52 100644 --- a/sig/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_page.rbs +++ b/sig/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_page.rbs @@ -4,10 +4,10 @@ module Mindee module Product module MultiReceiptsDetector class MultiReceiptsDetectorV1Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class MultiReceiptsDetectorV1PagePrediction < MultiReceiptsDetectorV1Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1.rbs b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1.rbs index cfd9ef90f..dd062e7ca 100644 --- a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1.rbs +++ b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1.rbs @@ -4,7 +4,7 @@ module Mindee module Product module NutritionFactsLabel class NutritionFactsLabelV1 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_added_sugar.rbs b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_added_sugar.rbs index 5e1797bcc..5e68f62dc 100644 --- a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_added_sugar.rbs +++ b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_added_sugar.rbs @@ -2,11 +2,11 @@ module Mindee module Product module NutritionFactsLabel class NutritionFactsLabelV1AddedSugar < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def daily_value: -> Float def per_100g: -> Float def per_serving: -> Float - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_calorie.rbs b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_calorie.rbs index 892993b9f..5d7d0e157 100644 --- a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_calorie.rbs +++ b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_calorie.rbs @@ -2,11 +2,11 @@ module Mindee module Product module NutritionFactsLabel class NutritionFactsLabelV1Calorie < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def daily_value: -> Float def per_100g: -> Float def per_serving: -> Float - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_cholesterol.rbs b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_cholesterol.rbs index d42a60af4..64a333512 100644 --- a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_cholesterol.rbs +++ b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_cholesterol.rbs @@ -2,11 +2,11 @@ module Mindee module Product module NutritionFactsLabel class NutritionFactsLabelV1Cholesterol < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def daily_value: -> Float def per_100g: -> Float def per_serving: -> Float - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_dietary_fiber.rbs b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_dietary_fiber.rbs index feeb28ed1..4c9d93cb3 100644 --- a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_dietary_fiber.rbs +++ b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_dietary_fiber.rbs @@ -2,11 +2,11 @@ module Mindee module Product module NutritionFactsLabel class NutritionFactsLabelV1DietaryFiber < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def daily_value: -> Float def per_100g: -> Float def per_serving: -> Float - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_document.rbs b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_document.rbs index 7f02aba96..51cdef350 100644 --- a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_document.rbs +++ b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_document.rbs @@ -4,7 +4,7 @@ module Mindee module Product module NutritionFactsLabel class NutritionFactsLabelV1Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def added_sugars: -> (Product::NutritionFactsLabel::NutritionFactsLabelV1AddedSugar) def calories: -> (Product::NutritionFactsLabel::NutritionFactsLabelV1Calorie) def cholesterol: -> (Product::NutritionFactsLabel::NutritionFactsLabelV1Cholesterol) diff --git a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_nutrient.rbs b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_nutrient.rbs index 4e6a177d8..4f25611a3 100644 --- a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_nutrient.rbs +++ b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_nutrient.rbs @@ -2,14 +2,14 @@ module Mindee module Product module NutritionFactsLabel class NutritionFactsLabelV1Nutrient < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def daily_value: -> Float def name: -> String def per_100g: -> Float def per_serving: -> Float def unit: -> String - def printable_values: -> Hash[Symbol | String, untyped] - def table_printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] + def table_printable_values: -> Hash[String | Symbol, untyped] def to_table_line: -> String def to_s: -> String end diff --git a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_page.rbs b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_page.rbs index f0fa02ecb..55cb379c9 100644 --- a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_page.rbs +++ b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_page.rbs @@ -4,10 +4,10 @@ module Mindee module Product module NutritionFactsLabel class NutritionFactsLabelV1Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class NutritionFactsLabelV1PagePrediction < NutritionFactsLabelV1Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_protein.rbs b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_protein.rbs index c25e7ab5b..8aa82f0e1 100644 --- a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_protein.rbs +++ b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_protein.rbs @@ -2,11 +2,11 @@ module Mindee module Product module NutritionFactsLabel class NutritionFactsLabelV1Protein < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def daily_value: -> Float def per_100g: -> Float def per_serving: -> Float - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_saturated_fat.rbs b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_saturated_fat.rbs index 7c3bf76ff..313412d7e 100644 --- a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_saturated_fat.rbs +++ b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_saturated_fat.rbs @@ -2,11 +2,11 @@ module Mindee module Product module NutritionFactsLabel class NutritionFactsLabelV1SaturatedFat < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def daily_value: -> Float def per_100g: -> Float def per_serving: -> Float - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_serving_size.rbs b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_serving_size.rbs index e31b5f9c3..62b0671cb 100644 --- a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_serving_size.rbs +++ b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_serving_size.rbs @@ -2,10 +2,10 @@ module Mindee module Product module NutritionFactsLabel class NutritionFactsLabelV1ServingSize < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def amount: -> Float def unit: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_sodium.rbs b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_sodium.rbs index 6221b6fbb..04114e225 100644 --- a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_sodium.rbs +++ b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_sodium.rbs @@ -2,12 +2,12 @@ module Mindee module Product module NutritionFactsLabel class NutritionFactsLabelV1Sodium < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def daily_value: -> Float def per_100g: -> Float def per_serving: -> Float def unit: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_carbohydrate.rbs b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_carbohydrate.rbs index 9ec1a14cc..cfd0aa186 100644 --- a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_carbohydrate.rbs +++ b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_carbohydrate.rbs @@ -2,11 +2,11 @@ module Mindee module Product module NutritionFactsLabel class NutritionFactsLabelV1TotalCarbohydrate < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def daily_value: -> Float def per_100g: -> Float def per_serving: -> Float - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_fat.rbs b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_fat.rbs index 2474c5c83..9e80c01e4 100644 --- a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_fat.rbs +++ b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_fat.rbs @@ -2,11 +2,11 @@ module Mindee module Product module NutritionFactsLabel class NutritionFactsLabelV1TotalFat < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def daily_value: -> Float def per_100g: -> Float def per_serving: -> Float - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_sugar.rbs b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_sugar.rbs index 229535e42..d259e2c16 100644 --- a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_sugar.rbs +++ b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_sugar.rbs @@ -2,11 +2,11 @@ module Mindee module Product module NutritionFactsLabel class NutritionFactsLabelV1TotalSugar < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def daily_value: -> Float def per_100g: -> Float def per_serving: -> Float - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_trans_fat.rbs b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_trans_fat.rbs index 765d8b8c6..52084790b 100644 --- a/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_trans_fat.rbs +++ b/sig/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_trans_fat.rbs @@ -2,11 +2,11 @@ module Mindee module Product module NutritionFactsLabel class NutritionFactsLabelV1TransFat < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def daily_value: -> Float def per_100g: -> Float def per_serving: -> Float - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/passport/passport_v1.rbs b/sig/mindee/product/passport/passport_v1.rbs index f548ffc75..e4c84f49a 100644 --- a/sig/mindee/product/passport/passport_v1.rbs +++ b/sig/mindee/product/passport/passport_v1.rbs @@ -4,7 +4,7 @@ module Mindee module Product module Passport class PassportV1 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/passport/passport_v1_document.rbs b/sig/mindee/product/passport/passport_v1_document.rbs index 6e7fd345a..1f2c6dd18 100644 --- a/sig/mindee/product/passport/passport_v1_document.rbs +++ b/sig/mindee/product/passport/passport_v1_document.rbs @@ -4,7 +4,7 @@ module Mindee module Product module Passport class PassportV1Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def birth_date: -> (Parsing::Standard::DateField) def birth_place: -> (Parsing::Standard::StringField) def country: -> (Parsing::Standard::StringField) diff --git a/sig/mindee/product/passport/passport_v1_page.rbs b/sig/mindee/product/passport/passport_v1_page.rbs index 5dbe3cb38..33d9a2fc8 100644 --- a/sig/mindee/product/passport/passport_v1_page.rbs +++ b/sig/mindee/product/passport/passport_v1_page.rbs @@ -4,10 +4,10 @@ module Mindee module Product module Passport class PassportV1Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class PassportV1PagePrediction < PassportV1Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/receipt/receipt_v5.rbs b/sig/mindee/product/receipt/receipt_v5.rbs index 58a33fb7a..025be2f62 100644 --- a/sig/mindee/product/receipt/receipt_v5.rbs +++ b/sig/mindee/product/receipt/receipt_v5.rbs @@ -4,7 +4,7 @@ module Mindee module Product module Receipt class ReceiptV5 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/receipt/receipt_v5_document.rbs b/sig/mindee/product/receipt/receipt_v5_document.rbs index 901659c10..ffe778796 100644 --- a/sig/mindee/product/receipt/receipt_v5_document.rbs +++ b/sig/mindee/product/receipt/receipt_v5_document.rbs @@ -4,7 +4,7 @@ module Mindee module Product module Receipt class ReceiptV5Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def category: -> (Parsing::Standard::ClassificationField) def date: -> (Parsing::Standard::DateField) def document_type: -> (Parsing::Standard::ClassificationField) diff --git a/sig/mindee/product/receipt/receipt_v5_line_item.rbs b/sig/mindee/product/receipt/receipt_v5_line_item.rbs index 48029f4e6..35fdcd097 100644 --- a/sig/mindee/product/receipt/receipt_v5_line_item.rbs +++ b/sig/mindee/product/receipt/receipt_v5_line_item.rbs @@ -2,13 +2,13 @@ module Mindee module Product module Receipt class ReceiptV5LineItem < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def description: -> String def quantity: -> Float def total_amount: -> Float def unit_price: -> Float - def printable_values: -> Hash[Symbol | String, untyped] - def table_printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] + def table_printable_values: -> Hash[String | Symbol, untyped] def to_table_line: -> String def to_s: -> String end diff --git a/sig/mindee/product/receipt/receipt_v5_page.rbs b/sig/mindee/product/receipt/receipt_v5_page.rbs index 43f9487f9..92afc1c08 100644 --- a/sig/mindee/product/receipt/receipt_v5_page.rbs +++ b/sig/mindee/product/receipt/receipt_v5_page.rbs @@ -4,10 +4,10 @@ module Mindee module Product module Receipt class ReceiptV5Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class ReceiptV5PagePrediction < ReceiptV5Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/resume/resume_v1.rbs b/sig/mindee/product/resume/resume_v1.rbs index b6e3b3969..be7ab1f4a 100644 --- a/sig/mindee/product/resume/resume_v1.rbs +++ b/sig/mindee/product/resume/resume_v1.rbs @@ -4,7 +4,7 @@ module Mindee module Product module Resume class ResumeV1 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/resume/resume_v1_certificate.rbs b/sig/mindee/product/resume/resume_v1_certificate.rbs index 0f6fe453c..4fb5c1b53 100644 --- a/sig/mindee/product/resume/resume_v1_certificate.rbs +++ b/sig/mindee/product/resume/resume_v1_certificate.rbs @@ -2,13 +2,13 @@ module Mindee module Product module Resume class ResumeV1Certificate < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def grade: -> String def name: -> String def provider: -> String def year: -> String - def printable_values: -> Hash[Symbol | String, untyped] - def table_printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] + def table_printable_values: -> Hash[String | Symbol, untyped] def to_table_line: -> String def to_s: -> String end diff --git a/sig/mindee/product/resume/resume_v1_document.rbs b/sig/mindee/product/resume/resume_v1_document.rbs index 586f4d086..4b0b83dd2 100644 --- a/sig/mindee/product/resume/resume_v1_document.rbs +++ b/sig/mindee/product/resume/resume_v1_document.rbs @@ -4,7 +4,7 @@ module Mindee module Product module Resume class ResumeV1Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def address: -> (Parsing::Standard::StringField) def certificates: -> (Product::Resume::ResumeV1Certificates) def document_language: -> (Parsing::Standard::StringField) diff --git a/sig/mindee/product/resume/resume_v1_education.rbs b/sig/mindee/product/resume/resume_v1_education.rbs index bf0da62fd..8485ffaf8 100644 --- a/sig/mindee/product/resume/resume_v1_education.rbs +++ b/sig/mindee/product/resume/resume_v1_education.rbs @@ -2,7 +2,7 @@ module Mindee module Product module Resume class ResumeV1Education < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def degree_domain: -> String def degree_type: -> String def end_month: -> String @@ -10,8 +10,8 @@ module Mindee def school: -> String def start_month: -> String def start_year: -> String - def printable_values: -> Hash[Symbol | String, untyped] - def table_printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] + def table_printable_values: -> Hash[String | Symbol, untyped] def to_table_line: -> String def to_s: -> String end diff --git a/sig/mindee/product/resume/resume_v1_language.rbs b/sig/mindee/product/resume/resume_v1_language.rbs index efbf4658d..9b721f5b7 100644 --- a/sig/mindee/product/resume/resume_v1_language.rbs +++ b/sig/mindee/product/resume/resume_v1_language.rbs @@ -2,11 +2,11 @@ module Mindee module Product module Resume class ResumeV1Language < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def language: -> String def level: -> String - def printable_values: -> Hash[Symbol | String, untyped] - def table_printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] + def table_printable_values: -> Hash[String | Symbol, untyped] def to_table_line: -> String def to_s: -> String end diff --git a/sig/mindee/product/resume/resume_v1_page.rbs b/sig/mindee/product/resume/resume_v1_page.rbs index 82138774c..b4a568376 100644 --- a/sig/mindee/product/resume/resume_v1_page.rbs +++ b/sig/mindee/product/resume/resume_v1_page.rbs @@ -4,10 +4,10 @@ module Mindee module Product module Resume class ResumeV1Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class ResumeV1PagePrediction < ResumeV1Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/resume/resume_v1_professional_experience.rbs b/sig/mindee/product/resume/resume_v1_professional_experience.rbs index c42140b4e..234096979 100644 --- a/sig/mindee/product/resume/resume_v1_professional_experience.rbs +++ b/sig/mindee/product/resume/resume_v1_professional_experience.rbs @@ -2,7 +2,7 @@ module Mindee module Product module Resume class ResumeV1ProfessionalExperience < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def contract_type: -> String def department: -> String def description: -> String @@ -12,8 +12,8 @@ module Mindee def role: -> String def start_month: -> String def start_year: -> String - def printable_values: -> Hash[Symbol | String, untyped] - def table_printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] + def table_printable_values: -> Hash[String | Symbol, untyped] def to_table_line: -> String def to_s: -> String end diff --git a/sig/mindee/product/resume/resume_v1_social_networks_url.rbs b/sig/mindee/product/resume/resume_v1_social_networks_url.rbs index beca1ef28..db2204185 100644 --- a/sig/mindee/product/resume/resume_v1_social_networks_url.rbs +++ b/sig/mindee/product/resume/resume_v1_social_networks_url.rbs @@ -2,11 +2,11 @@ module Mindee module Product module Resume class ResumeV1SocialNetworksUrl < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def name: -> String def url: -> String - def printable_values: -> Hash[Symbol | String, untyped] - def table_printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] + def table_printable_values: -> Hash[String | Symbol, untyped] def to_table_line: -> String def to_s: -> String end diff --git a/sig/mindee/product/universal/universal.rbs b/sig/mindee/product/universal/universal.rbs index 12ce49b1e..4371feccb 100644 --- a/sig/mindee/product/universal/universal.rbs +++ b/sig/mindee/product/universal/universal.rbs @@ -3,11 +3,11 @@ module Mindee module Product module Universal class Universal < Parsing::Common::Inference - def initialize: (untyped) -> untyped - def endpoint_name: -> untyped - def endpoint_version: -> untyped - def has_async: -> untyped - def has_sync: -> untyped + def initialize: (Hash[String | Symbol, untyped]) -> void + def endpoint_name: -> String + def endpoint_version: -> String + def has_async: -> bool + def has_sync: -> bool end end end diff --git a/sig/mindee/product/universal/universal_document.rbs b/sig/mindee/product/universal/universal_document.rbs index dfed539b0..a8a1d70fe 100644 --- a/sig/mindee/product/universal/universal_document.rbs +++ b/sig/mindee/product/universal/universal_document.rbs @@ -3,7 +3,7 @@ module Mindee module Product module Universal class UniversalDocument < Parsing::Common::Document - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/universal/universal_page.rbs b/sig/mindee/product/universal/universal_page.rbs index f928c8eb2..b53ebe251 100644 --- a/sig/mindee/product/universal/universal_page.rbs +++ b/sig/mindee/product/universal/universal_page.rbs @@ -3,10 +3,10 @@ module Mindee module Product module Universal class UniversalPage < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class UniversalPagePrediction < UniversalPrediction - def initialize: (Hash[Symbol | String, untyped], ?nil) -> void + def initialize: (Hash[String | Symbol, untyped], ?nil) -> void def to_s: -> String end end diff --git a/sig/mindee/product/universal/universal_prediction.rbs b/sig/mindee/product/universal/universal_prediction.rbs index 176e49048..b3badf94f 100644 --- a/sig/mindee/product/universal/universal_prediction.rbs +++ b/sig/mindee/product/universal/universal_prediction.rbs @@ -3,15 +3,15 @@ module Mindee module Product module Universal class UniversalPrediction < Parsing::Common::Prediction - def fields: -> Hash[Symbol | String, untyped] + def fields: -> Hash[String | Symbol, untyped] def initialize: (untyped?) -> void def to_s: -> String def generate_field_string: (String, Parsing::Universal::UniversalListField, Regexp) -> String - def generate_list_field_string: (String, Hash[Symbol | String, untyped], Regexp) -> String + def generate_list_field_string: (String, Hash[String | Symbol, untyped], Regexp) -> String def generate_sub_value_string: (String, Parsing::Universal::UniversalListField, Regexp) -> String - def single_fields: -> Hash[Symbol | String, untyped] - def list_fields: -> Hash[Symbol | String, Parsing::Universal::UniversalListField] - def object_fields: -> Hash[Symbol | String, untyped] + def single_fields: -> Hash[String | Symbol, untyped] + def list_fields: -> Hash[String | Symbol, Parsing::Universal::UniversalListField] + def object_fields: -> Hash[String | Symbol, untyped] def list_field_names: -> Array[untyped] end end diff --git a/sig/mindee/product/us/bank_check/bank_check_v1.rbs b/sig/mindee/product/us/bank_check/bank_check_v1.rbs index 7374d8bb0..6447d243a 100644 --- a/sig/mindee/product/us/bank_check/bank_check_v1.rbs +++ b/sig/mindee/product/us/bank_check/bank_check_v1.rbs @@ -5,7 +5,7 @@ module Mindee module US module BankCheck class BankCheckV1 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/us/bank_check/bank_check_v1_document.rbs b/sig/mindee/product/us/bank_check/bank_check_v1_document.rbs index 5729db258..34983c309 100644 --- a/sig/mindee/product/us/bank_check/bank_check_v1_document.rbs +++ b/sig/mindee/product/us/bank_check/bank_check_v1_document.rbs @@ -5,7 +5,7 @@ module Mindee module US module BankCheck class BankCheckV1Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def account_number: -> (Parsing::Standard::StringField) def amount: -> (Parsing::Standard::AmountField) def check_number: -> (Parsing::Standard::StringField) diff --git a/sig/mindee/product/us/bank_check/bank_check_v1_page.rbs b/sig/mindee/product/us/bank_check/bank_check_v1_page.rbs index baba8e1a0..624527667 100644 --- a/sig/mindee/product/us/bank_check/bank_check_v1_page.rbs +++ b/sig/mindee/product/us/bank_check/bank_check_v1_page.rbs @@ -5,10 +5,10 @@ module Mindee module US module BankCheck class BankCheckV1Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class BankCheckV1PagePrediction < BankCheckV1Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def check_position: -> Parsing::Standard::PositionField def signatures_positions: -> Array[Parsing::Standard::PositionField] def to_s: -> String diff --git a/sig/mindee/product/us/healthcare_card/healthcare_card_v1.rbs b/sig/mindee/product/us/healthcare_card/healthcare_card_v1.rbs index 8a1e32842..847b6a612 100644 --- a/sig/mindee/product/us/healthcare_card/healthcare_card_v1.rbs +++ b/sig/mindee/product/us/healthcare_card/healthcare_card_v1.rbs @@ -5,7 +5,7 @@ module Mindee module US module HealthcareCard class HealthcareCardV1 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/us/healthcare_card/healthcare_card_v1_copay.rbs b/sig/mindee/product/us/healthcare_card/healthcare_card_v1_copay.rbs index d6fbe188a..a90161305 100644 --- a/sig/mindee/product/us/healthcare_card/healthcare_card_v1_copay.rbs +++ b/sig/mindee/product/us/healthcare_card/healthcare_card_v1_copay.rbs @@ -3,11 +3,11 @@ module Mindee module US module HealthcareCard class HealthcareCardV1Copay < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def service_fees: -> Float def service_name: -> String - def printable_values: -> Hash[Symbol | String, untyped] - def table_printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] + def table_printable_values: -> Hash[String | Symbol, untyped] def to_table_line: -> String def to_s: -> String end diff --git a/sig/mindee/product/us/healthcare_card/healthcare_card_v1_document.rbs b/sig/mindee/product/us/healthcare_card/healthcare_card_v1_document.rbs index c184f881e..6f6ec9b8c 100644 --- a/sig/mindee/product/us/healthcare_card/healthcare_card_v1_document.rbs +++ b/sig/mindee/product/us/healthcare_card/healthcare_card_v1_document.rbs @@ -5,7 +5,7 @@ module Mindee module US module HealthcareCard class HealthcareCardV1Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def company_name: -> (Parsing::Standard::StringField) def copays: -> (Product::US::HealthcareCard::HealthcareCardV1Copays) def dependents: -> (Array[Parsing::Standard::StringField]) diff --git a/sig/mindee/product/us/healthcare_card/healthcare_card_v1_page.rbs b/sig/mindee/product/us/healthcare_card/healthcare_card_v1_page.rbs index 50d3ea42c..cf6b9255f 100644 --- a/sig/mindee/product/us/healthcare_card/healthcare_card_v1_page.rbs +++ b/sig/mindee/product/us/healthcare_card/healthcare_card_v1_page.rbs @@ -5,10 +5,10 @@ module Mindee module US module HealthcareCard class HealthcareCardV1Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class HealthcareCardV1PagePrediction < HealthcareCardV1Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/us/us_mail/us_mail_v2.rbs b/sig/mindee/product/us/us_mail/us_mail_v2.rbs index 5a425db67..7a15ab2e6 100644 --- a/sig/mindee/product/us/us_mail/us_mail_v2.rbs +++ b/sig/mindee/product/us/us_mail/us_mail_v2.rbs @@ -5,7 +5,7 @@ module Mindee module US module UsMail class UsMailV2 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/us/us_mail/us_mail_v2_document.rbs b/sig/mindee/product/us/us_mail/us_mail_v2_document.rbs index 4272c1722..9e47d1f1e 100644 --- a/sig/mindee/product/us/us_mail/us_mail_v2_document.rbs +++ b/sig/mindee/product/us/us_mail/us_mail_v2_document.rbs @@ -5,7 +5,7 @@ module Mindee module US module UsMail class UsMailV2Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def recipient_addresses: -> (Product::US::UsMail::UsMailV2RecipientAddresses) def recipient_names: -> (Array[Parsing::Standard::StringField]) def sender_address: -> (Product::US::UsMail::UsMailV2SenderAddress) diff --git a/sig/mindee/product/us/us_mail/us_mail_v2_page.rbs b/sig/mindee/product/us/us_mail/us_mail_v2_page.rbs index 90dcc4ca2..03e6f9884 100644 --- a/sig/mindee/product/us/us_mail/us_mail_v2_page.rbs +++ b/sig/mindee/product/us/us_mail/us_mail_v2_page.rbs @@ -5,10 +5,10 @@ module Mindee module US module UsMail class UsMailV2Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class UsMailV2PagePrediction < UsMailV2Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/us/us_mail/us_mail_v2_recipient_address.rbs b/sig/mindee/product/us/us_mail/us_mail_v2_recipient_address.rbs index ea801f6a2..03885a4ec 100644 --- a/sig/mindee/product/us/us_mail/us_mail_v2_recipient_address.rbs +++ b/sig/mindee/product/us/us_mail/us_mail_v2_recipient_address.rbs @@ -3,7 +3,7 @@ module Mindee module US module UsMail class UsMailV2RecipientAddress < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def city: -> String def complete: -> String def is_address_change: -> bool @@ -11,8 +11,8 @@ module Mindee def private_mailbox_number: -> String def state: -> String def street: -> String - def printable_values: -> Hash[Symbol | String, untyped] - def table_printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] + def table_printable_values: -> Hash[String | Symbol, untyped] def to_table_line: -> String def to_s: -> String end diff --git a/sig/mindee/product/us/us_mail/us_mail_v2_sender_address.rbs b/sig/mindee/product/us/us_mail/us_mail_v2_sender_address.rbs index ac8d97e0f..b6c4958fc 100644 --- a/sig/mindee/product/us/us_mail/us_mail_v2_sender_address.rbs +++ b/sig/mindee/product/us/us_mail/us_mail_v2_sender_address.rbs @@ -3,13 +3,13 @@ module Mindee module US module UsMail class UsMailV2SenderAddress < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def city: -> String def complete: -> String def postal_code: -> String def state: -> String def street: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/us/us_mail/us_mail_v3.rbs b/sig/mindee/product/us/us_mail/us_mail_v3.rbs index 9cb95c954..67efde76d 100644 --- a/sig/mindee/product/us/us_mail/us_mail_v3.rbs +++ b/sig/mindee/product/us/us_mail/us_mail_v3.rbs @@ -5,7 +5,7 @@ module Mindee module US module UsMail class UsMailV3 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/us/us_mail/us_mail_v3_document.rbs b/sig/mindee/product/us/us_mail/us_mail_v3_document.rbs index e3d271712..20b351207 100644 --- a/sig/mindee/product/us/us_mail/us_mail_v3_document.rbs +++ b/sig/mindee/product/us/us_mail/us_mail_v3_document.rbs @@ -5,7 +5,7 @@ module Mindee module US module UsMail class UsMailV3Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def is_return_to_sender: -> (Parsing::Standard::BooleanField) def recipient_addresses: -> (Product::US::UsMail::UsMailV3RecipientAddresses) def recipient_names: -> (Array[Parsing::Standard::StringField]) diff --git a/sig/mindee/product/us/us_mail/us_mail_v3_page.rbs b/sig/mindee/product/us/us_mail/us_mail_v3_page.rbs index 78581df80..279eaa147 100644 --- a/sig/mindee/product/us/us_mail/us_mail_v3_page.rbs +++ b/sig/mindee/product/us/us_mail/us_mail_v3_page.rbs @@ -5,10 +5,10 @@ module Mindee module US module UsMail class UsMailV3Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class UsMailV3PagePrediction < UsMailV3Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/us/us_mail/us_mail_v3_recipient_address.rbs b/sig/mindee/product/us/us_mail/us_mail_v3_recipient_address.rbs index 88846fed8..b10006886 100644 --- a/sig/mindee/product/us/us_mail/us_mail_v3_recipient_address.rbs +++ b/sig/mindee/product/us/us_mail/us_mail_v3_recipient_address.rbs @@ -3,7 +3,7 @@ module Mindee module US module UsMail class UsMailV3RecipientAddress < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def city: -> String def complete: -> String def is_address_change: -> bool @@ -12,8 +12,8 @@ module Mindee def state: -> String def street: -> String def unit: -> String - def printable_values: -> Hash[Symbol | String, untyped] - def table_printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] + def table_printable_values: -> Hash[String | Symbol, untyped] def to_table_line: -> String def to_s: -> String end diff --git a/sig/mindee/product/us/us_mail/us_mail_v3_sender_address.rbs b/sig/mindee/product/us/us_mail/us_mail_v3_sender_address.rbs index e70c60c4b..2928e024e 100644 --- a/sig/mindee/product/us/us_mail/us_mail_v3_sender_address.rbs +++ b/sig/mindee/product/us/us_mail/us_mail_v3_sender_address.rbs @@ -3,13 +3,13 @@ module Mindee module US module UsMail class UsMailV3SenderAddress < Parsing::Standard::FeatureField - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def city: -> String def complete: -> String def postal_code: -> String def state: -> String def street: -> String - def printable_values: -> Hash[Symbol | String, untyped] + def printable_values: -> Hash[String | Symbol, untyped] def to_s: -> String end end diff --git a/sig/mindee/product/us/w9/w9_v1.rbs b/sig/mindee/product/us/w9/w9_v1.rbs index e70c580bc..a7e8bd007 100644 --- a/sig/mindee/product/us/w9/w9_v1.rbs +++ b/sig/mindee/product/us/w9/w9_v1.rbs @@ -5,7 +5,7 @@ module Mindee module US module W9 class W9V1 < Parsing::Common::Inference - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end end end diff --git a/sig/mindee/product/us/w9/w9_v1_document.rbs b/sig/mindee/product/us/w9/w9_v1_document.rbs index 73c197331..67fd37879 100644 --- a/sig/mindee/product/us/w9/w9_v1_document.rbs +++ b/sig/mindee/product/us/w9/w9_v1_document.rbs @@ -5,7 +5,7 @@ module Mindee module US module W9 class W9V1Document < Parsing::Common::Prediction - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def to_s: -> String end end diff --git a/sig/mindee/product/us/w9/w9_v1_page.rbs b/sig/mindee/product/us/w9/w9_v1_page.rbs index b007d99d2..1c49ec761 100644 --- a/sig/mindee/product/us/w9/w9_v1_page.rbs +++ b/sig/mindee/product/us/w9/w9_v1_page.rbs @@ -5,10 +5,10 @@ module Mindee module US module W9 class W9V1Page < Parsing::Common::Page - def initialize: (Hash[Symbol | String, untyped]) -> void + def initialize: (Hash[String | Symbol, untyped]) -> void end class W9V1PagePrediction < W9V1Document - def initialize: (Hash[Symbol | String, untyped], Integer?) -> void + def initialize: (Hash[String | Symbol, untyped], Integer?) -> void def address: -> Parsing::Standard::StringField def business_name: -> Parsing::Standard::StringField def city_state_zip: -> Parsing::Standard::StringField diff --git a/sig/mindee/version.rbs b/sig/mindee/version.rbs index cf67f15db..3ecc31574 100644 --- a/sig/mindee/version.rbs +++ b/sig/mindee/version.rbs @@ -1,6 +1,6 @@ # lib/mindee/version.rb module Mindee VERSION: String - def self.find_platform: -> (Symbol | Hash[Symbol | String, Regexp])? - PLATFORM: (Hash[Symbol | String, Regexp] | Symbol) + def self.find_platform: -> (Symbol | Hash[String | Symbol, Regexp])? + PLATFORM: (Hash[String | Symbol, Regexp] | Symbol) end diff --git a/spec/client_v2_integration.rb b/spec/client_v2_integration.rb new file mode 100644 index 000000000..33846bcfd --- /dev/null +++ b/spec/client_v2_integration.rb @@ -0,0 +1,99 @@ +# frozen_string_literal: true + +RSpec.describe 'Mindee::ClientV2 – integration tests (V2)', :integration, order: :defined do + let(:api_key) { ENV.fetch('MINDEE_V2_API_KEY') } + let(:model_id) { ENV.fetch('MINDEE_V2_FINDOC_MODEL_ID') } + let(:blank_pdf_url) { ENV.fetch('MINDEE_V2_SE_TESTS_BLANK_PDF_URL') } + + let(:client) { Mindee::ClientV2.new(api_key: api_key) } + + it 'parses an empty multi-page PDF successfully' do + src_path = File.join(__dir__ || './', 'data', 'file_types', 'pdf', 'multipage_cut-2.pdf') + input = Mindee::Input::Source::FileInputSource.new(File.open(src_path, 'rb'), 'multipage_cut-2.pdf') + + polling = Mindee::Input::PollingOptions.new( + initial_delay_sec: 3.0, + delay_sec: 1.5, + max_retries: 80 + ) + + params = Mindee::Input::InferenceParameters.new(model_id, + rag: false, + file_alias: 'ruby-integration-test', + polling_options: polling) + + resp = client.enqueue_and_get_inference(input, params) + + expect(resp).not_to be_nil + expect(resp.inference).not_to be_nil + + expect(resp.inference.file).not_to be_nil + expect(resp.inference.file.name).to eq('multipage_cut-2.pdf') + + expect(resp.inference.model).not_to be_nil + expect(resp.inference.model.id).to eq(model_id) + + expect(resp.inference.result).not_to be_nil + expect(resp.inference.result.options).to be_nil + end + + it 'parses a filled single-page image successfully' do + src_path = File.join(__dir__ || './', 'data', 'products', 'financial_document', 'default_sample.jpg') + input = Mindee::Input::Source::FileInputSource.new(File.open(src_path, 'rb'), 'default_sample.jpg') + + params = Mindee::Input::InferenceParameters.new(model_id, + rag: false, + file_alias: 'ruby-integration-test') + + resp = client.enqueue_and_get_inference(input, params) + + expect(resp).not_to be_nil + expect(resp.inference.file.name).to eq('default_sample.jpg') + expect(resp.inference.model.id).to eq(model_id) + + fields = resp.inference.result.fields + expect(fields).not_to be_nil + expect(fields['supplier_name']).not_to be_nil + expect(fields['supplier_name'].value).to eq('John Smith') + end + + it 'raises MindeeHTTPErrorV2 (422) on invalid model id' do + src_path = File.join(__dir__ || './', 'data', 'file_types', 'pdf', 'blank_1.pdf') + input = Mindee::Input::Source::FileInputSource.new(File.open(src_path, 'rb'), 'blank_1.pdf') + + params = Mindee::Input::InferenceParameters.new('INVALID_MODEL_ID') + + expect do + client.enqueue_inference(input, params) + end.to raise_error(Mindee::Errors::MindeeHTTPErrorV2) { |e| expect(e.status).to eq(422) } + end + + it 'raises MindeeHTTPErrorV2 (422) on invalid webhook id' do + src_path = File.join(__dir__ || './', 'data', 'file_types', 'pdf', 'blank_1.pdf') + input = Mindee::Input::Source::FileInputSource.new(File.open(src_path, 'rb'), 'blank_1.pdf') + + params = Mindee::Input::InferenceParameters.new(model_id, + webhook_ids: ['INVALID_WEBHOOK_ID']) + + expect do + client.enqueue_inference(input, params) + end.to raise_error(Mindee::Errors::MindeeHTTPErrorV2) { |e| expect(e.status).to eq(422) } + end + + it 'raises MindeeHTTPErrorV2 on invalid job id' do + expect do + client.get_inference('INVALID_JOB_ID') + end.to raise_error(Mindee::Errors::MindeeHTTPErrorV2) { |e| expect(e.status).to eq(422) } + end + + it 'parses an URL input source without errors' do + url_input = Mindee::Input::Source::URLInputSource.new(blank_pdf_url) + + params = Mindee::Input::InferenceParameters.new(model_id) + + resp = client.enqueue_and_get_inference(url_input, params) + + expect(resp).not_to be_nil + expect(resp.inference).not_to be_nil + end +end diff --git a/spec/client_v2_spec.rb b/spec/client_v2_spec.rb new file mode 100644 index 000000000..65c6209dc --- /dev/null +++ b/spec/client_v2_spec.rb @@ -0,0 +1,89 @@ +# frozen_string_literal: true + +require 'json' +require 'mindee' +require_relative 'http/mock_http_response' # <- the original helper + +RSpec.describe Mindee::ClientV2 do + let(:file_types_dir) { File.join(__dir__ || './', 'data', 'file_types') } + let(:v2_data_dir) { File.join(__dir__ || './', 'data', 'v2') } + let(:input_doc) { Mindee::Input::Source::PathInputSource.new(File.join(file_types_dir, 'pdf', 'blank.pdf')) } + let(:base_url) { 'https://dummy-url' } + let(:api_key) { 'dummy-api-key' } + + let(:client) do + ENV['MINDEE_V2_BASE_URL'] = 'https://dummy-url' + Mindee::ClientV2.new(api_key: api_key) + end + let(:api) do + client.instance_variable_get(:@mindee_api) + end + + let(:json400) do + { + status: 400, + detail: 'Unsupported content.', + } + end + + def build_mock_http_response(hash, status_code = 400, status_msg = 'Bad Request') + MockHTTPResponse.new('1.1', status_code.to_s, status_msg, hash) + end + + def stub_next_request_with(method, hash:, status_code: 0) + fake_response = build_mock_http_response(hash, status_code) + allow_any_instance_of(Mindee::HTTP::MindeeApiV2) + .to receive(method) + .and_return(fake_response) + end + + it 'inherits base URL, token & headers from the env / options' do + settings = api.settings + + expect(settings.base_url).to eq(base_url) + expect(settings.api_key).to eq(api_key) + end + + it 'enqueue(path) raises MindeeHTTPErrorV2 on 4xx' do + expect do + stub_next_request_with(:enqueue, hash: JSON.generate(json400)) + client.enqueue_inference(input_doc, model_id: 'dummy-model') + end.to raise_error(Mindee::Errors::MindeeHTTPErrorV2) { |e| + expect(e.status).to eq(400) + expect(e.detail).to eq('Unsupported content.') + } + end + + it 'enqueue_and_get_inference(path) raises MindeeHTTPErrorV2 on 4xx' do + expect do + stub_next_request_with(:enqueue, hash: JSON.generate(json400)) + client.enqueue_and_get_inference(input_doc, model_id: 'dummy-model') + end.to raise_error(Mindee::Errors::MindeeHTTPErrorV2) { |e| + expect(e.status).to eq(400) + expect(e.detail).to eq('Unsupported content.') + } + end + + it 'bubbles-up HTTP errors with details' do + error_hash = json400.merge({ status: 413, detail: 'File exceeds size limit' }) + + expect do + stub_next_request_with(:enqueue, hash: JSON.generate(error_hash)) + client.enqueue_inference(input_doc, model_id: 'dummy-model') + end.to raise_error(Mindee::Errors::MindeeHTTPErrorV2) { |e| + expect(e.status).to eq(413) + expect(e.detail).to include('File exceeds size limit') + } + end + + it 'get_job(job_id) returns a fully-formed JobResponse' do + json_path = File.join(v2_data_dir, 'job', 'ok_processing.json') + parsed = File.read(json_path) + stub_next_request_with(:inference_job_req_get, hash: parsed, status_code: 200) + + resp = client.get_job('123e4567-e89b-12d3-a456-426614174000') + expect(resp).to be_a(Mindee::Parsing::V2::JobResponse) + expect(resp.job.status).to eq('Processing') + end + ENV.delete('MINDEE_V2_BASE_URL') +end diff --git a/spec/data b/spec/data index e48b26e52..f0175f0ee 160000 --- a/spec/data +++ b/spec/data @@ -1 +1 @@ -Subproject commit e48b26e5250cbbab9d3ee6c66c0eb85b667a4bb8 +Subproject commit f0175f0ee644b57b409e6ad7e1c030f28fbe57ef diff --git a/spec/input/sources/files_handling_spec.rb b/spec/input/sources/files_handling_spec.rb index 46786d59f..22b536469 100644 --- a/spec/input/sources/files_handling_spec.rb +++ b/spec/input/sources/files_handling_spec.rb @@ -10,8 +10,8 @@ file = File.join(DATA_DIR, 'file_types/receipt.jpg') input = Mindee::Input::Source::PathInputSource.new(file) read_f = input.read_contents - expect(read_f.length).to eq(3) - expect(read_f[1]).to eq(File.read(file, mode: 'rb')) + expect(read_f.length).to eq(2) + expect(read_f[0]).to eq(File.read(file, mode: 'rb')) end end @@ -20,8 +20,8 @@ file = File.join(DATA_DIR, 'file_types/receipt.jpga') input = Mindee::Input::Source::PathInputSource.new(file) read_f = input.read_contents - expect(read_f.length).to eq(3) - expect(read_f[1]).to eq(File.read(file, mode: 'rb')) + expect(read_f.length).to eq(2) + expect(read_f[0]).to eq(File.read(file, mode: 'rb')) end end @@ -30,8 +30,8 @@ file = File.join(DATA_DIR, 'file_types/receipt.heic') input = Mindee::Input::Source::PathInputSource.new(file) read_f = input.read_contents - expect(read_f.length).to eq(3) - expect(read_f[1]).to eq(File.read(file, mode: 'rb')) + expect(read_f.length).to eq(2) + expect(read_f[0]).to eq(File.read(file, mode: 'rb')) end end @@ -40,8 +40,8 @@ file = File.join(DATA_DIR, 'file_types/receipt.tif') input = Mindee::Input::Source::PathInputSource.new(file) read_f = input.read_contents - expect(read_f.length).to eq(3) - expect(read_f[1]).to eq(File.read(file, mode: 'rb')) + expect(read_f.length).to eq(2) + expect(read_f[0]).to eq(File.read(file, mode: 'rb')) end end @@ -50,8 +50,8 @@ file = File.join(DATA_DIR, 'file_types/receipt.tiff') input = Mindee::Input::Source::PathInputSource.new(file) read_f = input.read_contents - expect(read_f.length).to eq(3) - expect(read_f[1]).to eq(File.read(file, mode: 'rb')) + expect(read_f.length).to eq(2) + expect(read_f[0]).to eq(File.read(file, mode: 'rb')) end end @@ -60,8 +60,8 @@ file = File.join(DATA_DIR, 'file_types/receipt.txt') input = Mindee::Input::Source::Base64InputSource.new(File.read(file), 'receipt.txt') read_f = input.read_contents - expect(read_f.length).to eq(3) - expect(read_f[1].gsub("\n", '')).to eq(File.read(file).gsub("\n", '')) + expect(read_f.length).to eq(2) + expect(read_f[0].gsub("\n", '')).to eq(File.read(file).gsub("\n", '')) end end @@ -71,9 +71,9 @@ input = Mindee::Input::Source::PathInputSource.new(file) read_f = input.read_contents file_contents = File.read(file) - expect(read_f[1]).to_not eq(Base64.encode64(file_contents)) - expect(read_f.length).to eq(3) - expect(Base64.decode64(read_f[1])).to eq(Base64.decode64(file_contents)) + expect(read_f[0]).to_not eq(Base64.encode64(file_contents)) + expect(read_f.length).to eq(2) + expect(Base64.decode64(read_f[0])).to eq(Base64.decode64(file_contents)) end end @@ -83,9 +83,9 @@ input = Mindee::Input::Source::PathInputSource.new(file) read_f = input.read_contents file_contents = File.read(file) - expect(read_f[1]).to_not eq(Base64.encode64(file_contents)) - expect(read_f.length).to eq(3) - expect(Base64.decode64(read_f[1])).to eq(Base64.decode64(file_contents)) + expect(read_f[0]).to_not eq(Base64.encode64(file_contents)) + expect(read_f.length).to eq(2) + expect(Base64.decode64(read_f[0])).to eq(Base64.decode64(file_contents)) end end end diff --git a/spec/input/sources/sources_spec.rb b/spec/input/sources/sources_spec.rb index 3ea20f047..3baf8f042 100644 --- a/spec/input/sources/sources_spec.rb +++ b/spec/input/sources/sources_spec.rb @@ -76,7 +76,7 @@ expect do source_doc_fixed = mindee_client.source_from_path("#{DATA_DIR}/file_types/pdf/broken_invoice.pdf", repair_pdf: true) - expect(source_doc_fixed.read_contents[1].to_s).to eq(source_doc_original.read_contents[1].to_s) + expect(source_doc_fixed.read_contents[0].to_s).to eq(source_doc_original.read_contents[0].to_s) end.not_to raise_error end end diff --git a/spec/parsing/v2/inference_spec.rb b/spec/parsing/v2/inference_spec.rb new file mode 100644 index 000000000..ead03ffdb --- /dev/null +++ b/spec/parsing/v2/inference_spec.rb @@ -0,0 +1,263 @@ +# frozen_string_literal: true + +require 'mindee' + +RSpec.describe 'inference' do + let(:v2_data_dir) { File.join(DATA_DIR, 'v2') } + let(:findoc_path) { File.join(v2_data_dir, 'products', 'financial_document') } + let(:inference_path) { File.join(v2_data_dir, 'inference') } + let(:deep_nested_field_path) { File.join(inference_path, 'deep_nested_fields.json') } + let(:standard_field_path) { File.join(inference_path, 'standard_field_types.json') } + let(:standard_field_rst_path) { File.join(inference_path, 'standard_field_types.rst') } + let(:location_field_path) { File.join(findoc_path, 'complete_with_coordinates.json') } + let(:raw_text_path) { File.join(inference_path, 'raw_texts.json') } + let(:blank_path) { File.join(findoc_path, 'blank.json') } + let(:complete_path) { File.join(findoc_path, 'complete.json') } + + def load_v2_inference(resource_path) + local_response = Mindee::Input::LocalResponse.new(resource_path) + local_response.deserialize_response(Mindee::Parsing::V2::InferenceResponse) + end + + simple_field = Mindee::Parsing::V2::Field::SimpleField + object_field = Mindee::Parsing::V2::Field::ObjectField + list_field = Mindee::Parsing::V2::Field::ListField + field_conf = Mindee::Parsing::V2::Field::FieldConfidence + + describe 'simple' do + it 'loads a blank inference with valid properties' do + response = load_v2_inference(blank_path) + fields = response.inference.result.fields + + expect(fields).not_to be_empty + expect(fields.size).to eq(21) + expect(fields).to have_key('taxes') + expect(fields['taxes']).not_to be_nil + expect(fields['taxes']).to be_a(list_field) + + expect(fields['supplier_address']).not_to be_nil + expect(fields['supplier_address']).to be_a(object_field) + + fields.each_value do |entry| + next if entry.is_a?(simple_field) && entry.value.nil? + + case entry + when simple_field + expect(entry.value).not_to be_nil + when object_field + expect(entry.fields).not_to be_nil + when list_field + expect(entry.items).not_to be_nil + else + raise "Unknown field type: #{entry.class}" + end + end + end + + it 'loads a complete inference with valid properties' do + response = load_v2_inference(complete_path) + inf = response.inference + + expect(inf).not_to be_nil + expect(inf.id).to eq('12345678-1234-1234-1234-123456789abc') + + model = inf.model + expect(model).not_to be_nil + expect(model.id).to eq('12345678-1234-1234-1234-123456789abc') + + file = inf.file + expect(file).not_to be_nil + expect(file.name).to eq('complete.jpg') + expect(file.file_alias).to be_nil + expect(file.page_count).to eq(1) + expect(file.mime_type).to eq('image/jpeg') + + fields = inf.result.fields + expect(fields).not_to be_empty + expect(fields.size).to eq(21) + + date_field = fields['date'] + expect(date_field).to be_a(simple_field) + expect(date_field.value).to eq('2019-11-02') + + expect(fields).to have_key('taxes') + taxes = fields['taxes'] + expect(taxes).to be_a(list_field) + + taxes_list = taxes + expect(taxes_list.items.length).to eq(1) + expect(taxes_list.to_s).to be_a(String) + expect(taxes_list.to_s).to_not be_empty + + first_tax_item = taxes_list.items.first + expect(first_tax_item).to be_a(object_field) + + tax_item_obj = first_tax_item + expect(tax_item_obj.fields.size).to eq(3) + + base_field = tax_item_obj.fields['base'] + expect(base_field).to be_a(simple_field) + expect(base_field.value).to eq(31.5) + + expect(fields).to have_key('supplier_address') + supplier_address = fields['supplier_address'] + expect(supplier_address).to be_a(object_field) + + supplier_obj = supplier_address + country_field = supplier_obj.fields['country'] + expect(country_field).to be_a(simple_field) + expect(country_field.value).to eq('USA') + expect(country_field.to_s).to eq('USA') + expect(supplier_address.to_s).to be_a(String) + expect(supplier_address.to_s).to_not be_empty + + customer_addr = fields['customer_address'] + expect(customer_addr).to be_a(object_field) + city_field = customer_addr.fields['city'] + expect(city_field).to be_a(simple_field) + expect(city_field.value).to eq('New York') + + expect(inf.result.options).to be_nil + end + end + + describe 'nested' do + it 'loads a deep nested object' do + response = load_v2_inference(deep_nested_field_path) + fields = response.inference.result.fields + + expect(fields['field_simple']).to be_a(simple_field) + expect(fields['field_object']).to be_a(object_field) + + field_object = fields['field_object'] + lvl1 = field_object.fields + + expect(lvl1['sub_object_list']).to be_a(list_field) + expect(lvl1['sub_object_object']).to be_a(object_field) + + sub_object_object = lvl1['sub_object_object'] + lvl2 = sub_object_object.fields + + expect(lvl2['sub_object_object_sub_object_list']).to be_a(list_field) + + nested_list = lvl2['sub_object_object_sub_object_list'] + expect(nested_list.items).not_to be_empty + expect(nested_list.items.first).to be_a(object_field) + + first_item_obj = nested_list.items.first + deep_simple = first_item_obj.fields['sub_object_object_sub_object_list_simple'] + + expect(deep_simple).to be_a(simple_field) + expect(deep_simple.value).to eq('value_9') + end + end + + describe 'standard field types' do + it 'recognizes all field variants' do + response = load_v2_inference(standard_field_path) + fields = response.inference.result.fields + + expect(fields['field_simple_string']).to be_a(simple_field) + expect(fields['field_simple_string'].value).to eq('field_simple_string-value') + + expect(fields['field_simple_float']).to be_a(simple_field) + expect(fields['field_simple_float'].value).to eq(1.1) + + expect(fields['field_simple_int']).to be_a(simple_field) + expect(fields['field_simple_int'].value).to eq(12.0) + + expect(fields['field_simple_zero']).to be_a(simple_field) + expect(fields['field_simple_zero'].value).to eq(0) + + expect(fields['field_simple_bool']).to be_a(simple_field) + expect(fields['field_simple_bool'].value).to eq(true) + + expect(fields['field_simple_null']).to be_a(simple_field) + expect(fields['field_simple_null'].value).to be_nil + + expect(fields['field_object']).to be_a(object_field) + expect(fields['field_simple_list']).to be_a(list_field) + expect(fields['field_object_list']).to be_a(list_field) + end + end + + describe 'options' do + it 'exposes raw texts' do + response = load_v2_inference(raw_text_path) + opts = response.inference.result.options + + expect(opts).not_to be_nil + raw_texts = + if opts.respond_to?(:raw_texts) + opts.raw_texts + elsif opts.respond_to?(:get_raw_texts) + opts.get_raw_texts + else + [] + end + + expect(raw_texts).to be_a(Array) + expect(raw_texts.length).to eq(2) + + first = raw_texts.first + page = first.respond_to?(:page) ? first.page : first[:page] + content = first.respond_to?(:content) ? first.content : first[:content] + + expect(page).to eq(0) + expect(content).to eq('This is the raw text of the first page...') + end + end + + describe 'rst display' do + it 'is properly exposed' do + response = load_v2_inference(standard_field_path) + rst_string = File.read(standard_field_rst_path, encoding: 'UTF-8') + + expect(response.inference).not_to be_nil + expect(response.inference.to_s).to eq(rst_string) + end + end + + describe 'field locations and confidence' do + it 'are properly exposed' do + response = load_v2_inference(location_field_path) + + expect(response.inference).not_to be_nil + + date_field = response.inference.result.fields['date'] + expect(date_field).to be_a(simple_field) + expect(date_field.locations).to be_an(Array) + expect(date_field.locations[0]).not_to be_nil + expect(date_field.locations[0].page).to eq(0) + + polygon = date_field.locations[0].polygon + expect(polygon[0].length).to eq(2) + + expect(polygon[0][0]).to be_within(1e-12).of(0.948979073166918) + expect(polygon[0][1]).to be_within(1e-12).of(0.23097924535067715) + + expect(polygon[1][0]).to be_within(1e-12).of(0.85422) + expect(polygon[1][1]).to be_within(1e-12).of(0.230072) + + expect(polygon[2][0]).to be_within(1e-12).of(0.8540899268330819) + expect(polygon[2][1]).to be_within(1e-12).of(0.24365775464932288) + + expect(polygon[3][0]).to be_within(1e-12).of(0.948849) + expect(polygon[3][1]).to be_within(1e-12).of(0.244565) + + # Confidence can be a FieldConfidence instance or a String depending on implementation. + conf_value = + if date_field.confidence.respond_to?(:to_s) + date_field.confidence.to_s + else + date_field.confidence + end + expect(conf_value).to eq('Medium') + + # Optional strict check if equality supports comparing with FieldConfidence constants: + if defined?(field_conf) && field_conf.respond_to?(:from_string) + expect(conf_value).to eq(field_conf.from_string('Medium').to_s) + end + end + end +end diff --git a/spec/test_code_samples.sh b/spec/test_code_samples.sh index 2860be1c8..5bce39501 100755 --- a/spec/test_code_samples.sh +++ b/spec/test_code_samples.sh @@ -5,6 +5,8 @@ OUTPUT_FILE='./_test.rb' ACCOUNT=$1 ENDPOINT=$2 API_KEY=$3 +API_KEY_V2=$4 +MODEL_ID=$5 if [ -z "${ACCOUNT}" ]; then echo "ACCOUNT is required"; exit 1; fi if [ -z "${ENDPOINT}" ]; then echo "ENDPOINT is required"; exit 1; fi @@ -20,6 +22,14 @@ do sed "s/my-api-key/${API_KEY}/" "$f" > $OUTPUT_FILE sed -i 's/\/path\/to\/the\/file.ext/.\/spec\/data\/file_types\/pdf\/blank_1.pdf/' $OUTPUT_FILE + if echo "${f}" | grep -q "default_v2.txt" + then + sed -i "s/MY_API_KEY/$API_KEY_V2/" $OUTPUT_FILE + sed -i "s/MY_MODEL_ID/$MODEL_ID/" $OUTPUT_FILE + else + sed -i "s/my-api-key/$API_KEY/" $OUTPUT_FILE + fi + if echo "$f" | grep -q "custom_v1.txt" then sed -i "s/my-account/$ACCOUNT/g" $OUTPUT_FILE