Class: Mindee::V1::ParseOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/mindee/v1/client.rb,
sig/mindee/v1/client.rbs

Overview

Class for configuration options in parse calls.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params: {}) ⇒ ParseOptions

Returns a new instance of ParseOptions.

Parameters:

  • params: (Hash[String | Symbol, untyped]) (defaults to: {})


40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/mindee/v1/client.rb', line 40

def initialize(params: {})
  params = params.transform_keys(&:to_sym)
  @all_words = params.fetch(:all_words, false)
  @full_text = params.fetch(:full_text, false)
  @close_file = params.fetch(:close_file, true)
  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
  @cropper = params.fetch(:cropper, false)
  @rag = params.fetch(:rag, false)
  @workflow_id = params.fetch(:workflow_id, nil)
  @initial_delay_sec = params.fetch(:initial_delay_sec, 2)
  @delay_sec = params.fetch(:delay_sec, 1.5)
  @max_retries = params.fetch(:max_retries, 80)
end

Instance Attribute Details

#all_wordsBoolean

Returns the value of attribute all_words.

Returns:

  • (Boolean)


37
38
39
# File 'lib/mindee/v1/client.rb', line 37

def all_words
  @all_words
end

#close_fileBoolean

Returns the value of attribute close_file.

Returns:

  • (Boolean)


37
38
39
# File 'lib/mindee/v1/client.rb', line 37

def close_file
  @close_file
end

#cropperBoolean

Returns the value of attribute cropper.

Returns:

  • (Boolean)


37
38
39
# File 'lib/mindee/v1/client.rb', line 37

def cropper
  @cropper
end

#delay_secInteger, Float

Delay between polling attempts. Defaults to 1.5.

Returns:

  • (Integer, Float)


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/mindee/v1/client.rb', line 36

class ParseOptions
  attr_accessor :all_words, :full_text, :close_file, :page_options, :cropper, :rag,
                :workflow_id, :initial_delay_sec, :delay_sec, :max_retries

  def initialize(params: {})
    params = params.transform_keys(&:to_sym)
    @all_words = params.fetch(:all_words, false)
    @full_text = params.fetch(:full_text, false)
    @close_file = params.fetch(:close_file, true)
    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
    @cropper = params.fetch(:cropper, false)
    @rag = params.fetch(:rag, false)
    @workflow_id = params.fetch(:workflow_id, nil)
    @initial_delay_sec = params.fetch(:initial_delay_sec, 2)
    @delay_sec = params.fetch(:delay_sec, 1.5)
    @max_retries = params.fetch(:max_retries, 80)
  end
end

#full_textBoolean

Returns the value of attribute full_text.

Returns:

  • (Boolean)


37
38
39
# File 'lib/mindee/v1/client.rb', line 37

def full_text
  @full_text
end

#initial_delay_secInteger, Float

Initial delay before polling. Defaults to 2.

Returns:

  • (Integer, Float)


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/mindee/v1/client.rb', line 36

class ParseOptions
  attr_accessor :all_words, :full_text, :close_file, :page_options, :cropper, :rag,
                :workflow_id, :initial_delay_sec, :delay_sec, :max_retries

  def initialize(params: {})
    params = params.transform_keys(&:to_sym)
    @all_words = params.fetch(:all_words, false)
    @full_text = params.fetch(:full_text, false)
    @close_file = params.fetch(:close_file, true)
    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
    @cropper = params.fetch(:cropper, false)
    @rag = params.fetch(:rag, false)
    @workflow_id = params.fetch(:workflow_id, nil)
    @initial_delay_sec = params.fetch(:initial_delay_sec, 2)
    @delay_sec = params.fetch(:delay_sec, 1.5)
    @max_retries = params.fetch(:max_retries, 80)
  end
end

#max_retriesInteger

Maximum number of retries. Defaults to 80.

Returns:

  • (Integer)


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/mindee/v1/client.rb', line 36

class ParseOptions
  attr_accessor :all_words, :full_text, :close_file, :page_options, :cropper, :rag,
                :workflow_id, :initial_delay_sec, :delay_sec, :max_retries

  def initialize(params: {})
    params = params.transform_keys(&:to_sym)
    @all_words = params.fetch(:all_words, false)
    @full_text = params.fetch(:full_text, false)
    @close_file = params.fetch(:close_file, true)
    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
    @cropper = params.fetch(:cropper, false)
    @rag = params.fetch(:rag, false)
    @workflow_id = params.fetch(:workflow_id, nil)
    @initial_delay_sec = params.fetch(:initial_delay_sec, 2)
    @delay_sec = params.fetch(:delay_sec, 1.5)
    @max_retries = params.fetch(:max_retries, 80)
  end
end

#page_optionsPageOptions

Returns the value of attribute page_options.

Returns:



37
38
39
# File 'lib/mindee/v1/client.rb', line 37

def page_options
  @page_options
end

#ragBoolean

Returns the value of attribute rag.

Returns:

  • (Boolean)


37
38
39
# File 'lib/mindee/v1/client.rb', line 37

def rag
  @rag
end

#workflow_idString?

Returns the value of attribute workflow_id.

Returns:

  • (String, nil)


37
38
39
# File 'lib/mindee/v1/client.rb', line 37

def workflow_id
  @workflow_id
end