Class: Retab::Extraction
- Inherits:
-
Types::BaseModel
- Object
- Types::BaseModel
- Retab::Extraction
- 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, status: :status, error: :error, consensus: :consensus, metadata: :metadata, usage: :usage, created_at: :created_at }.freeze
Instance Attribute Summary collapse
-
#consensus ⇒ Object
Returns the value of attribute consensus.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#error ⇒ Object
Returns the value of attribute error.
-
#file ⇒ Object
Returns the value of attribute file.
-
#id ⇒ Object
Returns the value of attribute id.
-
#image_resolution_dpi ⇒ Object
Returns the value of attribute image_resolution_dpi.
-
#instructions ⇒ Object
Returns the value of attribute instructions.
-
#json_schema ⇒ Object
Returns the value of attribute json_schema.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#model ⇒ Object
Returns the value of attribute model.
-
#n_consensus ⇒ Object
Returns the value of attribute n_consensus.
-
#output ⇒ Object
Returns the value of attribute output.
-
#status ⇒ Object
Returns the value of attribute status.
-
#usage ⇒ Object
Returns the value of attribute usage.
Attributes inherited from Types::BaseModel
Instance Method Summary collapse
-
#initialize(json) ⇒ Extraction
constructor
A new instance of Extraction.
Methods inherited from Types::BaseModel
deep_symbolize, #inspect, normalize, #to_h, #to_json
Constructor Details
#initialize(json) ⇒ Extraction
Returns a new instance of Extraction.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/retab/extractions/extraction.rb', line 42 def initialize(json) super() 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] || {} @status = hash[:status].nil? ? "pending" : hash[:status] @error = hash[:error] ? Retab::PrimitiveError.new(hash[:error]) : nil @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
#consensus ⇒ Object
Returns the value of attribute consensus.
25 26 27 |
# File 'lib/retab/extractions/extraction.rb', line 25 def consensus @consensus end |
#created_at ⇒ Object
Returns the value of attribute created_at.
25 26 27 |
# File 'lib/retab/extractions/extraction.rb', line 25 def created_at @created_at end |
#error ⇒ Object
Returns the value of attribute error.
25 26 27 |
# File 'lib/retab/extractions/extraction.rb', line 25 def error @error end |
#file ⇒ Object
Returns the value of attribute file.
25 26 27 |
# File 'lib/retab/extractions/extraction.rb', line 25 def file @file end |
#id ⇒ Object
Returns the value of attribute id.
25 26 27 |
# File 'lib/retab/extractions/extraction.rb', line 25 def id @id end |
#image_resolution_dpi ⇒ Object
Returns the value of attribute image_resolution_dpi.
25 26 27 |
# File 'lib/retab/extractions/extraction.rb', line 25 def image_resolution_dpi @image_resolution_dpi end |
#instructions ⇒ Object
Returns the value of attribute instructions.
25 26 27 |
# File 'lib/retab/extractions/extraction.rb', line 25 def instructions @instructions end |
#json_schema ⇒ Object
Returns the value of attribute json_schema.
25 26 27 |
# File 'lib/retab/extractions/extraction.rb', line 25 def json_schema @json_schema end |
#metadata ⇒ Object
Returns the value of attribute metadata.
25 26 27 |
# File 'lib/retab/extractions/extraction.rb', line 25 def @metadata end |
#model ⇒ Object
Returns the value of attribute model.
25 26 27 |
# File 'lib/retab/extractions/extraction.rb', line 25 def model @model end |
#n_consensus ⇒ Object
Returns the value of attribute n_consensus.
25 26 27 |
# File 'lib/retab/extractions/extraction.rb', line 25 def n_consensus @n_consensus end |
#output ⇒ Object
Returns the value of attribute output.
25 26 27 |
# File 'lib/retab/extractions/extraction.rb', line 25 def output @output end |
#status ⇒ Object
Returns the value of attribute status.
25 26 27 |
# File 'lib/retab/extractions/extraction.rb', line 25 def status @status end |
#usage ⇒ Object
Returns the value of attribute usage.
25 26 27 |
# File 'lib/retab/extractions/extraction.rb', line 25 def usage @usage end |