Class: Retab::FileBlueprint

Inherits:
Types::BaseModel show all
Defined in:
lib/retab/files/file_blueprint.rb

Constant Summary collapse

HASH_ATTRS =
{
  object: :object,
  id: :id,
  file: :file,
  mode: :mode,
  intent: :intent,
  output: :output,
  status: :status,
  error: :error,
  created_at: :created_at,
  started_at: :started_at,
  completed_at: :completed_at
}.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) ⇒ FileBlueprint

Returns a new instance of FileBlueprint.



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/retab/files/file_blueprint.rb', line 36

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @object = hash[:object].nil? ? "file.blueprint" : hash[:object]
  @id = hash[:id]
  @file = hash[:file] ? Retab::FileRef.new(hash[:file]) : nil
  @mode = hash[:mode]
  @intent = hash[:intent]
  @output = hash[:output] || {}
  @status = hash[:status].nil? ? "pending" : hash[:status]
  @error = hash[:error] ? Retab::PrimitiveError.new(hash[:error]) : nil
  @created_at = hash[:created_at]
  @started_at = hash[:started_at]
  @completed_at = hash[:completed_at]
end

Instance Attribute Details

#completed_atObject

Returns the value of attribute completed_at.



22
23
24
# File 'lib/retab/files/file_blueprint.rb', line 22

def completed_at
  @completed_at
end

#created_atObject

Returns the value of attribute created_at.



22
23
24
# File 'lib/retab/files/file_blueprint.rb', line 22

def created_at
  @created_at
end

#errorObject

Returns the value of attribute error.



22
23
24
# File 'lib/retab/files/file_blueprint.rb', line 22

def error
  @error
end

#fileObject

Returns the value of attribute file.



22
23
24
# File 'lib/retab/files/file_blueprint.rb', line 22

def file
  @file
end

#idObject

Returns the value of attribute id.



22
23
24
# File 'lib/retab/files/file_blueprint.rb', line 22

def id
  @id
end

#intentObject

Returns the value of attribute intent.



22
23
24
# File 'lib/retab/files/file_blueprint.rb', line 22

def intent
  @intent
end

#modeObject

Returns the value of attribute mode.



22
23
24
# File 'lib/retab/files/file_blueprint.rb', line 22

def mode
  @mode
end

#objectObject

Returns the value of attribute object.



22
23
24
# File 'lib/retab/files/file_blueprint.rb', line 22

def object
  @object
end

#outputObject

Returns the value of attribute output.



22
23
24
# File 'lib/retab/files/file_blueprint.rb', line 22

def output
  @output
end

#started_atObject

Returns the value of attribute started_at.



22
23
24
# File 'lib/retab/files/file_blueprint.rb', line 22

def started_at
  @started_at
end

#statusObject

Returns the value of attribute status.



22
23
24
# File 'lib/retab/files/file_blueprint.rb', line 22

def status
  @status
end