Class: Retab::Workflow

Inherits:
Types::BaseModel
  • Object
show all
Defined in:
lib/retab/workflows/workflow.rb

Constant Summary collapse

HASH_ATTRS =
{
  id: :id,
  name: :name,
  description: :description,
  project_id: :project_id,
  published: :published,
  created_at: :created_at,
  updated_at: :updated_at
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Workflow

Returns a new instance of Workflow.



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/retab/workflows/workflow.rb', line 28

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @id = hash[:id]
  @name = hash[:name].nil? ? "Untitled Workflow" : hash[:name]
  @description = hash[:description].nil? ? "" : hash[:description]
  @project_id = hash[:project_id]
  @published = hash[:published] ? Retab::WorkflowPublished.new(hash[:published]) : nil
  @created_at = hash[:created_at]
  @updated_at = hash[:updated_at]
end

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



18
19
20
# File 'lib/retab/workflows/workflow.rb', line 18

def created_at
  @created_at
end

#descriptionObject

Returns the value of attribute description.



18
19
20
# File 'lib/retab/workflows/workflow.rb', line 18

def description
  @description
end

#idObject

Returns the value of attribute id.



18
19
20
# File 'lib/retab/workflows/workflow.rb', line 18

def id
  @id
end

#nameObject

Returns the value of attribute name.



18
19
20
# File 'lib/retab/workflows/workflow.rb', line 18

def name
  @name
end

#project_idObject

Returns the value of attribute project_id.



18
19
20
# File 'lib/retab/workflows/workflow.rb', line 18

def project_id
  @project_id
end

#publishedObject

Returns the value of attribute published.



18
19
20
# File 'lib/retab/workflows/workflow.rb', line 18

def published
  @published
end

#updated_atObject

Returns the value of attribute updated_at.



18
19
20
# File 'lib/retab/workflows/workflow.rb', line 18

def updated_at
  @updated_at
end