Class: Retab::SplitRequest

Inherits:
Types::BaseModel show all
Defined in:
lib/retab/splits/split_request.rb

Constant Summary collapse

HASH_ATTRS =
{
  document: :document,
  subdocuments: :subdocuments,
  model: :model,
  instructions: :instructions,
  n_consensus: :n_consensus,
  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) ⇒ SplitRequest

Returns a new instance of SplitRequest.



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

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @document = hash[:document] ? Retab::MimeData.new(hash[:document]) : nil
  @subdocuments = (hash[:subdocuments] || []).map { |item| item ? Retab::Subdocument.new(item) : nil }
  @model = hash[:model].nil? ? "retab-small" : hash[:model]
  @instructions = hash[:instructions]
  @n_consensus = hash[:n_consensus]
  @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/splits/split_request.rb', line 18

def background
  @background
end

#bust_cacheObject

Returns the value of attribute bust_cache.



18
19
20
# File 'lib/retab/splits/split_request.rb', line 18

def bust_cache
  @bust_cache
end

#documentObject

Returns the value of attribute document.



18
19
20
# File 'lib/retab/splits/split_request.rb', line 18

def document
  @document
end

#instructionsObject

Returns the value of attribute instructions.



18
19
20
# File 'lib/retab/splits/split_request.rb', line 18

def instructions
  @instructions
end

#modelObject

Returns the value of attribute model.



18
19
20
# File 'lib/retab/splits/split_request.rb', line 18

def model
  @model
end

#n_consensusObject

Returns the value of attribute n_consensus.



18
19
20
# File 'lib/retab/splits/split_request.rb', line 18

def n_consensus
  @n_consensus
end

#subdocumentsObject

Returns the value of attribute subdocuments.



18
19
20
# File 'lib/retab/splits/split_request.rb', line 18

def subdocuments
  @subdocuments
end