Class: SDM::ApprovalFlowStep

Inherits:
Object
  • Object
show all
Defined in:
lib/models/porcelain.rb

Overview

An approval step for an approval workflow. Specifies approvers and conditions for approval to be granted.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(approvers: nil, quantifier: nil, skip_after: nil) ⇒ ApprovalFlowStep

Returns a new instance of ApprovalFlowStep.



2767
2768
2769
2770
2771
2772
2773
2774
2775
# File 'lib/models/porcelain.rb', line 2767

def initialize(
  approvers: nil,
  quantifier: nil,
  skip_after: nil
)
  @approvers = approvers == nil ? [] : approvers
  @quantifier = quantifier == nil ? "" : quantifier
  @skip_after = skip_after == nil ? nil : skip_after
end

Instance Attribute Details

#approversObject

The approvers for this approval step



2761
2762
2763
# File 'lib/models/porcelain.rb', line 2761

def approvers
  @approvers
end

#quantifierObject

Whether "any" or "all" approvers must approve for this approval step to pass. Optional, defaults to "any".



2763
2764
2765
# File 'lib/models/porcelain.rb', line 2763

def quantifier
  @quantifier
end

#skip_afterObject

Duration after which this approval step will be skipped if no approval is given. Optional, if not provided an approver must approve before the step passes.



2765
2766
2767
# File 'lib/models/porcelain.rb', line 2765

def skip_after
  @skip_after
end

Instance Method Details

#to_json(options = {}) ⇒ Object



2777
2778
2779
2780
2781
2782
2783
# File 'lib/models/porcelain.rb', line 2777

def to_json(options = {})
  hash = {}
  self.instance_variables.each do |var|
    hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var
  end
  hash.to_json
end