Class: Mindee::ParseOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/mindee/client.rb

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.



60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/mindee/client.rb', line 60

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)
  @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_wordsObject

Returns the value of attribute all_words.



57
58
59
# File 'lib/mindee/client.rb', line 57

def all_words
  @all_words
end

#close_fileObject

Returns the value of attribute close_file.



57
58
59
# File 'lib/mindee/client.rb', line 57

def close_file
  @close_file
end

#cropperObject

Returns the value of attribute cropper.



57
58
59
# File 'lib/mindee/client.rb', line 57

def cropper
  @cropper
end

#delay_secObject

Delay between polling attempts. Defaults to 1.5.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/mindee/client.rb', line 56

class ParseOptions
  attr_accessor :all_words, :full_text, :close_file, :page_options, :cropper,
                :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)
    @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_textObject

Returns the value of attribute full_text.



57
58
59
# File 'lib/mindee/client.rb', line 57

def full_text
  @full_text
end

#initial_delay_secObject

Initial delay before polling. Defaults to 2.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/mindee/client.rb', line 56

class ParseOptions
  attr_accessor :all_words, :full_text, :close_file, :page_options, :cropper,
                :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)
    @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_retriesObject

Maximum number of retries. Defaults to 80.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/mindee/client.rb', line 56

class ParseOptions
  attr_accessor :all_words, :full_text, :close_file, :page_options, :cropper,
                :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)
    @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_optionsObject

Returns the value of attribute page_options.



57
58
59
# File 'lib/mindee/client.rb', line 57

def page_options
  @page_options
end