Class: Retab::Extraction

Inherits:
Types::BaseModel show all
Defined in:
lib/retab/extractions/extraction.rb

Constant Summary collapse

HASH_ATTRS =
{
  id: :id,
  file: :file,
  model: :model,
  json_schema: :json_schema,
  n_consensus: :n_consensus,
  image_resolution_dpi: :image_resolution_dpi,
  instructions: :instructions,
  output: :output,
  consensus: :consensus,
  metadata: :metadata,
  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

#inspect, normalize, #to_h, #to_json

Constructor Details

#initialize(json) ⇒ Extraction

Returns a new instance of Extraction.



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

def initialize(json)
  hash = self.class.normalize(json)
  @id = hash[:id]
  @file = hash[:file] ? Retab::FileRef.new(hash[:file]) : nil
  @model = hash[:model]
  @json_schema = hash[:json_schema] || {}
  @n_consensus = hash[:n_consensus]
  @image_resolution_dpi = hash[:image_resolution_dpi]
  @instructions = hash[:instructions]
  @output = hash[:output] || {}
  @consensus = hash[:consensus] ? Retab::ExtractionConsensus.new(hash[:consensus]) : nil
  @metadata = hash[:metadata] || {}
  @usage = hash[:usage] ? Retab::RetabUsage.new(hash[:usage]) : nil
  @created_at = hash[:created_at]
end

Instance Attribute Details

#consensusObject

Returns the value of attribute consensus.



23
24
25
# File 'lib/retab/extractions/extraction.rb', line 23

def consensus
  @consensus
end

#created_atObject

Returns the value of attribute created_at.



23
24
25
# File 'lib/retab/extractions/extraction.rb', line 23

def created_at
  @created_at
end

#fileObject

Returns the value of attribute file.



23
24
25
# File 'lib/retab/extractions/extraction.rb', line 23

def file
  @file
end

#idObject

Returns the value of attribute id.



23
24
25
# File 'lib/retab/extractions/extraction.rb', line 23

def id
  @id
end

#image_resolution_dpiObject

Returns the value of attribute image_resolution_dpi.



23
24
25
# File 'lib/retab/extractions/extraction.rb', line 23

def image_resolution_dpi
  @image_resolution_dpi
end

#instructionsObject

Returns the value of attribute instructions.



23
24
25
# File 'lib/retab/extractions/extraction.rb', line 23

def instructions
  @instructions
end

#json_schemaObject

Returns the value of attribute json_schema.



23
24
25
# File 'lib/retab/extractions/extraction.rb', line 23

def json_schema
  @json_schema
end

#metadataObject

Returns the value of attribute metadata.



23
24
25
# File 'lib/retab/extractions/extraction.rb', line 23

def 
  @metadata
end

#modelObject

Returns the value of attribute model.



23
24
25
# File 'lib/retab/extractions/extraction.rb', line 23

def model
  @model
end

#n_consensusObject

Returns the value of attribute n_consensus.



23
24
25
# File 'lib/retab/extractions/extraction.rb', line 23

def n_consensus
  @n_consensus
end

#outputObject

Returns the value of attribute output.



23
24
25
# File 'lib/retab/extractions/extraction.rb', line 23

def output
  @output
end

#usageObject

Returns the value of attribute usage.



23
24
25
# File 'lib/retab/extractions/extraction.rb', line 23

def usage
  @usage
end