Class: Retab::ClassificationRequest

Inherits:
Types::BaseModel show all
Defined in:
lib/retab/classifications/classification_request.rb

Constant Summary collapse

HASH_ATTRS =
{
  document: :document,
  categories: :categories,
  model: :model,
  first_n_pages: :first_n_pages,
  instructions: :instructions,
  n_consensus: :n_consensus,
  bust_cache: :bust_cache
}.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) ⇒ ClassificationRequest

Returns a new instance of ClassificationRequest.



27
28
29
30
31
32
33
34
35
36
# File 'lib/retab/classifications/classification_request.rb', line 27

def initialize(json)
  hash = self.class.normalize(json)
  @document = hash[:document] ? Retab::MimeData.new(hash[:document]) : nil
  @categories = (hash[:categories] || []).map { |item| item ? Retab::Category.new(item) : nil }
  @model = hash[:model]
  @first_n_pages = hash[:first_n_pages]
  @instructions = hash[:instructions]
  @n_consensus = hash[:n_consensus]
  @bust_cache = hash[:bust_cache]
end

Instance Attribute Details

#bust_cacheObject

Returns the value of attribute bust_cache.



18
19
20
# File 'lib/retab/classifications/classification_request.rb', line 18

def bust_cache
  @bust_cache
end

#categoriesObject

Returns the value of attribute categories.



18
19
20
# File 'lib/retab/classifications/classification_request.rb', line 18

def categories
  @categories
end

#documentObject

Returns the value of attribute document.



18
19
20
# File 'lib/retab/classifications/classification_request.rb', line 18

def document
  @document
end

#first_n_pagesObject

Returns the value of attribute first_n_pages.



18
19
20
# File 'lib/retab/classifications/classification_request.rb', line 18

def first_n_pages
  @first_n_pages
end

#instructionsObject

Returns the value of attribute instructions.



18
19
20
# File 'lib/retab/classifications/classification_request.rb', line 18

def instructions
  @instructions
end

#modelObject

Returns the value of attribute model.



18
19
20
# File 'lib/retab/classifications/classification_request.rb', line 18

def model
  @model
end

#n_consensusObject

Returns the value of attribute n_consensus.



18
19
20
# File 'lib/retab/classifications/classification_request.rb', line 18

def n_consensus
  @n_consensus
end