Class: Retab::Workflow

Inherits:
Types::BaseModel 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,
  capabilities: :capabilities,
  authz_status: :authz_status
}.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) ⇒ Workflow

Returns a new instance of Workflow.



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/retab/workflows/workflow.rb', line 32

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]
  @capabilities = (hash[:capabilities] || [])
  @authz_status = hash[:authz_status]
end

Instance Attribute Details

#authz_statusObject

Returns the value of attribute authz_status.



20
21
22
# File 'lib/retab/workflows/workflow.rb', line 20

def authz_status
  @authz_status
end

#capabilitiesObject

Returns the value of attribute capabilities.



20
21
22
# File 'lib/retab/workflows/workflow.rb', line 20

def capabilities
  @capabilities
end

#created_atObject

Returns the value of attribute created_at.



20
21
22
# File 'lib/retab/workflows/workflow.rb', line 20

def created_at
  @created_at
end

#descriptionObject

Returns the value of attribute description.



20
21
22
# File 'lib/retab/workflows/workflow.rb', line 20

def description
  @description
end

#idObject

Returns the value of attribute id.



20
21
22
# File 'lib/retab/workflows/workflow.rb', line 20

def id
  @id
end

#nameObject

Returns the value of attribute name.



20
21
22
# File 'lib/retab/workflows/workflow.rb', line 20

def name
  @name
end

#project_idObject

Returns the value of attribute project_id.



20
21
22
# File 'lib/retab/workflows/workflow.rb', line 20

def project_id
  @project_id
end

#publishedObject

Returns the value of attribute published.



20
21
22
# File 'lib/retab/workflows/workflow.rb', line 20

def published
  @published
end

#updated_atObject

Returns the value of attribute updated_at.



20
21
22
# File 'lib/retab/workflows/workflow.rb', line 20

def updated_at
  @updated_at
end