Class: Retab::PartitionWorkflowArtifact

Inherits:
Types::BaseModel show all
Defined in:
lib/retab/workflow_artifacts/partition_workflow_artifact.rb

Constant Summary collapse

HASH_ATTRS =
{
  id: :id,
  file: :file,
  model: :model,
  key: :key,
  instructions: :instructions,
  n_consensus: :n_consensus,
  allow_overlap: :allow_overlap,
  output: :output,
  status: :status,
  error: :error,
  consensus: :consensus,
  usage: :usage,
  created_at: :created_at,
  operation: :operation
}.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) ⇒ PartitionWorkflowArtifact

Returns a new instance of PartitionWorkflowArtifact.



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/retab/workflow_artifacts/partition_workflow_artifact.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]
  @key = hash[:key]
  @instructions = hash[:instructions]
  @n_consensus = hash[:n_consensus]
  @allow_overlap = hash[:allow_overlap].nil? ? true : hash[:allow_overlap]
  @output = (hash[:output] || []).map { |item| item ? Retab::PartitionChunk.new(item) : nil }
  @status = hash[:status].nil? ? "pending" : hash[:status]
  @error = hash[:error] ? Retab::PrimitiveError.new(hash[:error]) : nil
  @consensus = hash[:consensus] ? Retab::PartitionConsensus.new(hash[:consensus]) : nil
  @usage = hash[:usage] ? Retab::RetabUsage.new(hash[:usage]) : nil
  @created_at = hash[:created_at]
  @operation = hash[:operation].nil? ? "partition" : hash[:operation]
end

Instance Attribute Details

#allow_overlapObject

Returns the value of attribute allow_overlap.



25
26
27
# File 'lib/retab/workflow_artifacts/partition_workflow_artifact.rb', line 25

def allow_overlap
  @allow_overlap
end

#consensusObject

Returns the value of attribute consensus.



25
26
27
# File 'lib/retab/workflow_artifacts/partition_workflow_artifact.rb', line 25

def consensus
  @consensus
end

#created_atObject

Returns the value of attribute created_at.



25
26
27
# File 'lib/retab/workflow_artifacts/partition_workflow_artifact.rb', line 25

def created_at
  @created_at
end

#errorObject

Returns the value of attribute error.



25
26
27
# File 'lib/retab/workflow_artifacts/partition_workflow_artifact.rb', line 25

def error
  @error
end

#fileObject

Returns the value of attribute file.



25
26
27
# File 'lib/retab/workflow_artifacts/partition_workflow_artifact.rb', line 25

def file
  @file
end

#idObject

Returns the value of attribute id.



25
26
27
# File 'lib/retab/workflow_artifacts/partition_workflow_artifact.rb', line 25

def id
  @id
end

#instructionsObject

Returns the value of attribute instructions.



25
26
27
# File 'lib/retab/workflow_artifacts/partition_workflow_artifact.rb', line 25

def instructions
  @instructions
end

#keyObject

Returns the value of attribute key.



25
26
27
# File 'lib/retab/workflow_artifacts/partition_workflow_artifact.rb', line 25

def key
  @key
end

#modelObject

Returns the value of attribute model.



25
26
27
# File 'lib/retab/workflow_artifacts/partition_workflow_artifact.rb', line 25

def model
  @model
end

#n_consensusObject

Returns the value of attribute n_consensus.



25
26
27
# File 'lib/retab/workflow_artifacts/partition_workflow_artifact.rb', line 25

def n_consensus
  @n_consensus
end

#operationObject

Returns the value of attribute operation.



25
26
27
# File 'lib/retab/workflow_artifacts/partition_workflow_artifact.rb', line 25

def operation
  @operation
end

#outputObject

Returns the value of attribute output.



25
26
27
# File 'lib/retab/workflow_artifacts/partition_workflow_artifact.rb', line 25

def output
  @output
end

#statusObject

Returns the value of attribute status.



25
26
27
# File 'lib/retab/workflow_artifacts/partition_workflow_artifact.rb', line 25

def status
  @status
end

#usageObject

Returns the value of attribute usage.



25
26
27
# File 'lib/retab/workflow_artifacts/partition_workflow_artifact.rb', line 25

def usage
  @usage
end