Class: Retab::WorkflowTable

Inherits:
Types::BaseModel show all
Defined in:
lib/retab/tables/workflow_table.rb

Constant Summary collapse

HASH_ATTRS =
{
  id: :id,
  name: :name,
  filename: :filename,
  source_file_id: :source_file_id,
  snapshot_file_id: :snapshot_file_id,
  row_count: :row_count,
  columns: :columns,
  sample_rows: :sample_rows,
  metadata: :metadata,
  uploaded_by_user_id: :uploaded_by_user_id,
  created_at: :created_at,
  updated_at: :updated_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) ⇒ WorkflowTable

Returns a new instance of WorkflowTable.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/retab/tables/workflow_table.rb', line 38

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @id = hash[:id]
  @name = hash[:name]
  @filename = hash[:filename]
  @source_file_id = hash[:source_file_id].nil? ? "" : hash[:source_file_id]
  @snapshot_file_id = hash[:snapshot_file_id].nil? ? "" : hash[:snapshot_file_id]
  @row_count = hash[:row_count]
  @columns = (hash[:columns] || []).map { |item| item ? Retab::WorkflowTableColumn.new(item) : nil }
  @sample_rows = (hash[:sample_rows] || []).map { |item| item || {} }
  @metadata = hash[:metadata] || {}
  @uploaded_by_user_id = hash[:uploaded_by_user_id]
  @created_at = hash[:created_at]
  @updated_at = hash[:updated_at]
end

Instance Attribute Details

#columnsObject

Returns the value of attribute columns.



23
24
25
# File 'lib/retab/tables/workflow_table.rb', line 23

def columns
  @columns
end

#created_atObject

Returns the value of attribute created_at.



23
24
25
# File 'lib/retab/tables/workflow_table.rb', line 23

def created_at
  @created_at
end

#filenameObject

Returns the value of attribute filename.



23
24
25
# File 'lib/retab/tables/workflow_table.rb', line 23

def filename
  @filename
end

#idObject

Returns the value of attribute id.



23
24
25
# File 'lib/retab/tables/workflow_table.rb', line 23

def id
  @id
end

#metadataObject

Returns the value of attribute metadata.



23
24
25
# File 'lib/retab/tables/workflow_table.rb', line 23

def 
  @metadata
end

#nameObject

Returns the value of attribute name.



23
24
25
# File 'lib/retab/tables/workflow_table.rb', line 23

def name
  @name
end

#row_countObject

Returns the value of attribute row_count.



23
24
25
# File 'lib/retab/tables/workflow_table.rb', line 23

def row_count
  @row_count
end

#sample_rowsObject

Returns the value of attribute sample_rows.



23
24
25
# File 'lib/retab/tables/workflow_table.rb', line 23

def sample_rows
  @sample_rows
end

#snapshot_file_idObject

Returns the value of attribute snapshot_file_id.



23
24
25
# File 'lib/retab/tables/workflow_table.rb', line 23

def snapshot_file_id
  @snapshot_file_id
end

#source_file_idObject

Returns the value of attribute source_file_id.



23
24
25
# File 'lib/retab/tables/workflow_table.rb', line 23

def source_file_id
  @source_file_id
end

#updated_atObject

Returns the value of attribute updated_at.



23
24
25
# File 'lib/retab/tables/workflow_table.rb', line 23

def updated_at
  @updated_at
end

#uploaded_by_user_idObject

Returns the value of attribute uploaded_by_user_id.



23
24
25
# File 'lib/retab/tables/workflow_table.rb', line 23

def uploaded_by_user_id
  @uploaded_by_user_id
end