Class: Retab::ParseRequest

Inherits:
Types::BaseModel show all
Defined in:
lib/retab/parses/parse_request.rb

Constant Summary collapse

HASH_ATTRS =
{
  document: :document,
  model: :model,
  table_parsing_format: :table_parsing_format,
  image_resolution_dpi: :image_resolution_dpi,
  instructions: :instructions,
  bust_cache: :bust_cache,
  background: :background
}.freeze

Instance Attribute Summary collapse

Attributes inherited from Types::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Types::BaseModel

deep_symbolize, #inspect, normalize, #to_h, #to_json

Constructor Details

#initialize(json) ⇒ ParseRequest

Returns a new instance of ParseRequest.



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/retab/parses/parse_request.rb', line 28

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @document = hash[:document] ? Retab::MimeData.new(hash[:document]) : nil
  @model = hash[:model].nil? ? "retab-small" : hash[:model]
  @table_parsing_format = hash[:table_parsing_format].nil? ? "html" : hash[:table_parsing_format]
  @image_resolution_dpi = hash[:image_resolution_dpi]
  @instructions = hash[:instructions]
  @bust_cache = hash[:bust_cache].nil? ? false : hash[:bust_cache]
  @background = hash[:background].nil? ? false : hash[:background]
end

Instance Attribute Details

#backgroundObject

Returns the value of attribute background.



18
19
20
# File 'lib/retab/parses/parse_request.rb', line 18

def background
  @background
end

#bust_cacheObject

Returns the value of attribute bust_cache.



18
19
20
# File 'lib/retab/parses/parse_request.rb', line 18

def bust_cache
  @bust_cache
end

#documentObject

Returns the value of attribute document.



18
19
20
# File 'lib/retab/parses/parse_request.rb', line 18

def document
  @document
end

#image_resolution_dpiObject

Returns the value of attribute image_resolution_dpi.



18
19
20
# File 'lib/retab/parses/parse_request.rb', line 18

def image_resolution_dpi
  @image_resolution_dpi
end

#instructionsObject

Returns the value of attribute instructions.



18
19
20
# File 'lib/retab/parses/parse_request.rb', line 18

def instructions
  @instructions
end

#modelObject

Returns the value of attribute model.



18
19
20
# File 'lib/retab/parses/parse_request.rb', line 18

def model
  @model
end

#table_parsing_formatObject

Returns the value of attribute table_parsing_format.



18
19
20
# File 'lib/retab/parses/parse_request.rb', line 18

def table_parsing_format
  @table_parsing_format
end