Class: Retab::Parse

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

Constant Summary collapse

HASH_ATTRS =
{
  id: :id,
  file: :file,
  model: :model,
  table_parsing_format: :table_parsing_format,
  image_resolution_dpi: :image_resolution_dpi,
  instructions: :instructions,
  output: :output,
  status: :status,
  error: :error,
  usage: :usage,
  created_at: :created_at
}.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) ⇒ Parse

Returns a new instance of Parse.



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/retab/parses/parse.rb', line 36

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @id = hash[:id]
  @file = hash[:file] ? Retab::FileRef.new(hash[:file]) : nil
  @model = hash[:model]
  @table_parsing_format = hash[:table_parsing_format]
  @image_resolution_dpi = hash[:image_resolution_dpi]
  @instructions = hash[:instructions]
  @output = hash[:output] ? Retab::ParseOutput.new(hash[:output]) : nil
  @status = hash[:status].nil? ? "pending" : hash[:status]
  @error = hash[:error] ? Retab::PrimitiveError.new(hash[:error]) : nil
  @usage = hash[:usage] ? Retab::RetabUsage.new(hash[:usage]) : nil
  @created_at = hash[:created_at]
end

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



22
23
24
# File 'lib/retab/parses/parse.rb', line 22

def created_at
  @created_at
end

#errorObject

Returns the value of attribute error.



22
23
24
# File 'lib/retab/parses/parse.rb', line 22

def error
  @error
end

#fileObject

Returns the value of attribute file.



22
23
24
# File 'lib/retab/parses/parse.rb', line 22

def file
  @file
end

#idObject

Returns the value of attribute id.



22
23
24
# File 'lib/retab/parses/parse.rb', line 22

def id
  @id
end

#image_resolution_dpiObject

Returns the value of attribute image_resolution_dpi.



22
23
24
# File 'lib/retab/parses/parse.rb', line 22

def image_resolution_dpi
  @image_resolution_dpi
end

#instructionsObject

Returns the value of attribute instructions.



22
23
24
# File 'lib/retab/parses/parse.rb', line 22

def instructions
  @instructions
end

#modelObject

Returns the value of attribute model.



22
23
24
# File 'lib/retab/parses/parse.rb', line 22

def model
  @model
end

#outputObject

Returns the value of attribute output.



22
23
24
# File 'lib/retab/parses/parse.rb', line 22

def output
  @output
end

#statusObject

Returns the value of attribute status.



22
23
24
# File 'lib/retab/parses/parse.rb', line 22

def status
  @status
end

#table_parsing_formatObject

Returns the value of attribute table_parsing_format.



22
23
24
# File 'lib/retab/parses/parse.rb', line 22

def table_parsing_format
  @table_parsing_format
end

#usageObject

Returns the value of attribute usage.



22
23
24
# File 'lib/retab/parses/parse.rb', line 22

def usage
  @usage
end