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,
  published: :published,
  email_trigger: :email_trigger,
  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

#inspect, normalize, #to_h, #to_json

Constructor Details

#initialize(json) ⇒ Workflow

Returns a new instance of Workflow.



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

def initialize(json)
  hash = self.class.normalize(json)
  @id = hash[:id]
  @name = hash[:name]
  @description = hash[:description]
  @published = hash[:published] ? Retab::WorkflowPublished.new(hash[:published]) : nil
  @email_trigger = hash[:email_trigger] ? Retab::WorkflowEmailTrigger.new(hash[:email_trigger]) : 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

#email_triggerObject

Returns the value of attribute email_trigger.



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

def email_trigger
  @email_trigger
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

#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