Class: Retab::ConditionEvaluationResult

Inherits:
Types::BaseModel show all
Defined in:
lib/retab/workflow_artifacts/condition_evaluation_result.rb

Constant Summary collapse

HASH_ATTRS =
{
  condition_id: :condition_id,
  path: :path,
  operator: :operator,
  expected: :expected,
  actual: :actual,
  matched: :matched,
  branch_name: :branch_name,
  logical_operator: :logical_operator,
  per_item: :per_item,
  sub_evaluations: :sub_evaluations,
  details: :details
}.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) ⇒ ConditionEvaluationResult

Returns a new instance of ConditionEvaluationResult.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/retab/workflow_artifacts/condition_evaluation_result.rb', line 35

def initialize(json)
  hash = self.class.normalize(json)
  @condition_id = hash[:condition_id]
  @path = hash[:path]
  @operator = hash[:operator]
  @expected = hash[:expected]
  @actual = hash[:actual]
  @matched = hash[:matched]
  @branch_name = hash[:branch_name]
  @logical_operator = hash[:logical_operator]
  @per_item = (hash[:per_item] || []).map { |item| item ? Retab::ConditionEvaluationPerItem.new(item) : nil }
  @sub_evaluations = (hash[:sub_evaluations] || []).map { |item| item ? Retab::ConditionEvaluationSubCondition.new(item) : nil }
  @details = hash[:details] ? Retab::ConditionEvaluationDetails.new(hash[:details]) : nil
end

Instance Attribute Details

#actualObject

Returns the value of attribute actual.



22
23
24
# File 'lib/retab/workflow_artifacts/condition_evaluation_result.rb', line 22

def actual
  @actual
end

#branch_nameObject

Returns the value of attribute branch_name.



22
23
24
# File 'lib/retab/workflow_artifacts/condition_evaluation_result.rb', line 22

def branch_name
  @branch_name
end

#condition_idObject

Returns the value of attribute condition_id.



22
23
24
# File 'lib/retab/workflow_artifacts/condition_evaluation_result.rb', line 22

def condition_id
  @condition_id
end

#detailsObject

Returns the value of attribute details.



22
23
24
# File 'lib/retab/workflow_artifacts/condition_evaluation_result.rb', line 22

def details
  @details
end

#expectedObject

Returns the value of attribute expected.



22
23
24
# File 'lib/retab/workflow_artifacts/condition_evaluation_result.rb', line 22

def expected
  @expected
end

#logical_operatorObject

Returns the value of attribute logical_operator.



22
23
24
# File 'lib/retab/workflow_artifacts/condition_evaluation_result.rb', line 22

def logical_operator
  @logical_operator
end

#matchedObject

Returns the value of attribute matched.



22
23
24
# File 'lib/retab/workflow_artifacts/condition_evaluation_result.rb', line 22

def matched
  @matched
end

#operatorObject

Returns the value of attribute operator.



22
23
24
# File 'lib/retab/workflow_artifacts/condition_evaluation_result.rb', line 22

def operator
  @operator
end

#pathObject

Returns the value of attribute path.



22
23
24
# File 'lib/retab/workflow_artifacts/condition_evaluation_result.rb', line 22

def path
  @path
end

#per_itemObject

Returns the value of attribute per_item.



22
23
24
# File 'lib/retab/workflow_artifacts/condition_evaluation_result.rb', line 22

def per_item
  @per_item
end

#sub_evaluationsObject

Returns the value of attribute sub_evaluations.



22
23
24
# File 'lib/retab/workflow_artifacts/condition_evaluation_result.rb', line 22

def sub_evaluations
  @sub_evaluations
end