Class: Retab::AssertionResult

Inherits:
Types::BaseModel show all
Defined in:
lib/retab/workflow_test_run_results/assertion_result.rb

Constant Summary collapse

HASH_ATTRS =
{
  assertion_id: :assertion_id,
  condition_kind: :condition_kind,
  outcome: :outcome,
  actual_value: :actual_value,
  expected_value: :expected_value,
  score: :score,
  threshold: :threshold,
  metric_kind: :metric_kind,
  assertion_label: :assertion_label,
  failure: :failure
}.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) ⇒ AssertionResult

Returns a new instance of AssertionResult.



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/retab/workflow_test_run_results/assertion_result.rb', line 33

def initialize(json)
  hash = self.class.normalize(json)
  @assertion_id = hash[:assertion_id]
  @condition_kind = hash[:condition_kind]
  @outcome = hash[:outcome]
  @actual_value = hash[:actual_value]
  @expected_value = hash[:expected_value]
  @score = hash[:score]
  @threshold = hash[:threshold]
  @metric_kind = hash[:metric_kind]
  @assertion_label = hash[:assertion_label]
  @failure = hash[:failure] ? Retab::AssertionFailure.new(hash[:failure]) : nil
end

Instance Attribute Details

#actual_valueObject

Returns the value of attribute actual_value.



21
22
23
# File 'lib/retab/workflow_test_run_results/assertion_result.rb', line 21

def actual_value
  @actual_value
end

#assertion_idObject

Returns the value of attribute assertion_id.



21
22
23
# File 'lib/retab/workflow_test_run_results/assertion_result.rb', line 21

def assertion_id
  @assertion_id
end

#assertion_labelObject

Returns the value of attribute assertion_label.



21
22
23
# File 'lib/retab/workflow_test_run_results/assertion_result.rb', line 21

def assertion_label
  @assertion_label
end

#condition_kindObject

Returns the value of attribute condition_kind.



21
22
23
# File 'lib/retab/workflow_test_run_results/assertion_result.rb', line 21

def condition_kind
  @condition_kind
end

#expected_valueObject

Returns the value of attribute expected_value.



21
22
23
# File 'lib/retab/workflow_test_run_results/assertion_result.rb', line 21

def expected_value
  @expected_value
end

#failureObject

Returns the value of attribute failure.



21
22
23
# File 'lib/retab/workflow_test_run_results/assertion_result.rb', line 21

def failure
  @failure
end

#metric_kindObject

Returns the value of attribute metric_kind.



21
22
23
# File 'lib/retab/workflow_test_run_results/assertion_result.rb', line 21

def metric_kind
  @metric_kind
end

#outcomeObject

Returns the value of attribute outcome.



21
22
23
# File 'lib/retab/workflow_test_run_results/assertion_result.rb', line 21

def outcome
  @outcome
end

#scoreObject

Returns the value of attribute score.



21
22
23
# File 'lib/retab/workflow_test_run_results/assertion_result.rb', line 21

def score
  @score
end

#thresholdObject

Returns the value of attribute threshold.



21
22
23
# File 'lib/retab/workflow_test_run_results/assertion_result.rb', line 21

def threshold
  @threshold
end