Class: Mindee::V2::Product::OCR::Params::OCRParameters

Inherits:
Input::BaseParameters show all
Defined in:
lib/mindee/v2/product/ocr/params/ocr_parameters.rb

Overview

Parameters accepted by the ocr utility v2 endpoint.

Instance Attribute Summary

Attributes inherited from Input::BaseParameters

#close_file, #file_alias, #model_id, #polling_options, #webhook_ids

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Input::BaseParameters

#append_form_data, load_from_hash, #slug, #validate_async_params

Constructor Details

#initialize(model_id, file_alias: nil, webhook_ids: nil, polling_options: nil, close_file: true) ⇒ OCRParameters

Returns a new instance of OCRParameters.

Parameters:

  • model_id (String)

    ID of the model

  • file_alias (String, nil) (defaults to: nil)

    File alias, if applicable.

  • webhook_ids (Array<String>, nil) (defaults to: nil)

    List of webhook IDs to propagate the API response to.

  • polling_options (Hash, nil) (defaults to: nil)

    Options for polling. Set only if having timeout issues.

  • close_file (Boolean, nil) (defaults to: true)

    Whether to close the file after parsing.



21
22
23
24
25
26
27
28
29
# File 'lib/mindee/v2/product/ocr/params/ocr_parameters.rb', line 21

def initialize(
  model_id,
  file_alias: nil,
  webhook_ids: nil,
  polling_options: nil,
  close_file: true
)
  super
end

Class Method Details

.from_hash(params: {}) ⇒ OCRParameters

Loads the parameters from a Hash.

Parameters:

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

    Parameters to provide as a hash.

Returns:



34
35
36
37
38
39
40
41
# File 'lib/mindee/v2/product/ocr/params/ocr_parameters.rb', line 34

def self.from_hash(params: {})
  OCRParameters.new(
    params.fetch(:model_id),
    file_alias: params.fetch(:file_alias, nil),
    webhook_ids: params.fetch(:webhook_ids, nil),
    close_file: params.fetch(:close_file, true)
  )
end

.slugString

Returns Slug for the endpoint.

Returns:

  • (String)

    Slug for the endpoint.



12
13
14
# File 'lib/mindee/v2/product/ocr/params/ocr_parameters.rb', line 12

def self.slug
  'ocr'
end