Class: Retab::Edit
- Inherits:
-
Types::BaseModel
- Object
- Types::BaseModel
- Retab::Edit
- Defined in:
- lib/retab/edits/edit.rb
Constant Summary collapse
- HASH_ATTRS =
{ id: :id, file: :file, model: :model, instructions: :instructions, config: :config, template_id: :template_id, output: :output, status: :status, error: :error, filled_document_ref: :filled_document_ref, usage: :usage, created_at: :created_at }.freeze
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#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.
-
#filled_document_ref ⇒ Object
Returns the value of attribute filled_document_ref.
-
#id ⇒ Object
Returns the value of attribute id.
-
#instructions ⇒ Object
Returns the value of attribute instructions.
-
#model ⇒ Object
Returns the value of attribute model.
-
#output ⇒ Object
Returns the value of attribute output.
-
#status ⇒ Object
Returns the value of attribute status.
-
#template_id ⇒ Object
Returns the value of attribute template_id.
-
#usage ⇒ Object
Returns the value of attribute usage.
Attributes inherited from Types::BaseModel
Instance Method Summary collapse
-
#initialize(json) ⇒ Edit
constructor
A new instance of Edit.
Methods inherited from Types::BaseModel
deep_symbolize, #inspect, normalize, #to_h, #to_json
Constructor Details
#initialize(json) ⇒ Edit
Returns a new instance of Edit.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/retab/edits/edit.rb', line 38 def initialize(json) super() hash = self.class.normalize(json) @id = hash[:id] @file = hash[:file] ? Retab::FileRef.new(hash[:file]) : nil @model = hash[:model] @instructions = hash[:instructions] @config = hash[:config] ? Retab::EditConfig.new(hash[:config]) : nil @template_id = hash[:template_id] @output = hash[:output] ? Retab::EditResult.new(hash[:output]) : nil @status = hash[:status].nil? ? "pending" : hash[:status] @error = hash[:error] ? Retab::PrimitiveError.new(hash[:error]) : nil @filled_document_ref = hash[:filled_document_ref] ? Retab::FileRef.new(hash[:filled_document_ref]) : nil @usage = hash[:usage] ? Retab::RetabUsage.new(hash[:usage]) : nil @created_at = hash[:created_at] end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
23 24 25 |
# File 'lib/retab/edits/edit.rb', line 23 def config @config end |
#created_at ⇒ Object
Returns the value of attribute created_at.
23 24 25 |
# File 'lib/retab/edits/edit.rb', line 23 def created_at @created_at end |
#error ⇒ Object
Returns the value of attribute error.
23 24 25 |
# File 'lib/retab/edits/edit.rb', line 23 def error @error end |
#file ⇒ Object
Returns the value of attribute file.
23 24 25 |
# File 'lib/retab/edits/edit.rb', line 23 def file @file end |
#filled_document_ref ⇒ Object
Returns the value of attribute filled_document_ref.
23 24 25 |
# File 'lib/retab/edits/edit.rb', line 23 def filled_document_ref @filled_document_ref end |
#id ⇒ Object
Returns the value of attribute id.
23 24 25 |
# File 'lib/retab/edits/edit.rb', line 23 def id @id end |
#instructions ⇒ Object
Returns the value of attribute instructions.
23 24 25 |
# File 'lib/retab/edits/edit.rb', line 23 def instructions @instructions end |
#model ⇒ Object
Returns the value of attribute model.
23 24 25 |
# File 'lib/retab/edits/edit.rb', line 23 def model @model end |
#output ⇒ Object
Returns the value of attribute output.
23 24 25 |
# File 'lib/retab/edits/edit.rb', line 23 def output @output end |
#status ⇒ Object
Returns the value of attribute status.
23 24 25 |
# File 'lib/retab/edits/edit.rb', line 23 def status @status end |
#template_id ⇒ Object
Returns the value of attribute template_id.
23 24 25 |
# File 'lib/retab/edits/edit.rb', line 23 def template_id @template_id end |
#usage ⇒ Object
Returns the value of attribute usage.
23 24 25 |
# File 'lib/retab/edits/edit.rb', line 23 def usage @usage end |