Class: Retab::SourcesResponse

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

Constant Summary collapse

HASH_ATTRS =
{
  object: :object,
  extraction_id: :extraction_id,
  document_type: :document_type,
  file: :file,
  extraction: :extraction,
  sources: :sources
}.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) ⇒ SourcesResponse

Returns a new instance of SourcesResponse.



25
26
27
28
29
30
31
32
33
# File 'lib/retab/extractions/sources_response.rb', line 25

def initialize(json)
  hash = self.class.normalize(json)
  @object = hash[:object]
  @extraction_id = hash[:extraction_id]
  @document_type = hash[:document_type]
  @file = hash[:file] ? Retab::FileRef.new(hash[:file]) : nil
  @extraction = hash[:extraction] || {}
  @sources = hash[:sources] || {}
end

Instance Attribute Details

#document_typeObject

Returns the value of attribute document_type.



17
18
19
# File 'lib/retab/extractions/sources_response.rb', line 17

def document_type
  @document_type
end

#extractionObject

Returns the value of attribute extraction.



17
18
19
# File 'lib/retab/extractions/sources_response.rb', line 17

def extraction
  @extraction
end

#extraction_idObject

Returns the value of attribute extraction_id.



17
18
19
# File 'lib/retab/extractions/sources_response.rb', line 17

def extraction_id
  @extraction_id
end

#fileObject

Returns the value of attribute file.



17
18
19
# File 'lib/retab/extractions/sources_response.rb', line 17

def file
  @file
end

#objectObject

Returns the value of attribute object.



17
18
19
# File 'lib/retab/extractions/sources_response.rb', line 17

def object
  @object
end

#sourcesObject

Returns the value of attribute sources.



17
18
19
# File 'lib/retab/extractions/sources_response.rb', line 17

def sources
  @sources
end