Class: Retab::Review

Inherits:
Types::BaseModel
  • Object
show all
Defined in:
lib/retab/workflow_reviews/review.rb

Constant Summary collapse

HASH_ATTRS =
{
  id: :id,
  workflow_id: :workflow_id,
  workflow_version_id: :workflow_version_id,
  run_id: :run_id,
  block_id: :block_id,
  step_id: :step_id,
  parent_step_id: :parent_step_id,
  iteration_key: :iteration_key,
  block_type: :block_type,
  triggered_by: :triggered_by,
  created_at: :created_at,
  decision: :decision
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Review

Returns a new instance of Review.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/retab/workflow_reviews/review.rb', line 38

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @id = hash[:id]
  @workflow_id = hash[:workflow_id]
  @workflow_version_id = hash[:workflow_version_id]
  @run_id = hash[:run_id]
  @block_id = hash[:block_id]
  @step_id = hash[:step_id]
  @parent_step_id = hash[:parent_step_id]
  @iteration_key = hash[:iteration_key]
  @block_type = hash[:block_type]
  @triggered_by = hash[:triggered_by] ? (
    case hash[:triggered_by][:kind]
    when "all_of"
      Retab::ReviewAllOf.new(hash[:triggered_by])
    when "always"
      Retab::ReviewAlways.new(hash[:triggered_by])
    when "any_of"
      Retab::ReviewAnyOf.new(hash[:triggered_by])
    when "any_required_field_null"
      Retab::ReviewAnyRequiredFieldNull.new(hash[:triggered_by])
    when "any_split_pages_lt"
      Retab::ReviewAnySplitPagesLt.new(hash[:triggered_by])
    when "boundary_confidence_lt"
      Retab::ReviewBoundaryConfidenceLt.new(hash[:triggered_by])
    when "branch_in"
      Retab::ReviewBranchIn.new(hash[:triggered_by])
    when "category_in"
      Retab::ReviewCategoryIn.new(hash[:triggered_by])
    when "confidence_lt"
      Retab::ReviewConfidenceLt.new(hash[:triggered_by])
    when "json_condition"
      Retab::ReviewJsonCondition.new(hash[:triggered_by])
    when "split_count_neq"
      Retab::ReviewSplitCountNeq.new(hash[:triggered_by])
    when "top_margin_lt"
      Retab::ReviewTopMarginLt.new(hash[:triggered_by])
    when "validation_failed"
      Retab::ReviewValidationFailed.new(hash[:triggered_by])
    else
      hash[:triggered_by]
    end
  ) : nil
  @created_at = hash[:created_at]
  @decision = hash[:decision] ? Retab::ReviewDecision.new(hash[:decision]) : nil
end

Instance Attribute Details

#block_idObject

Returns the value of attribute block_id.



23
24
25
# File 'lib/retab/workflow_reviews/review.rb', line 23

def block_id
  @block_id
end

#block_typeObject

Returns the value of attribute block_type.



23
24
25
# File 'lib/retab/workflow_reviews/review.rb', line 23

def block_type
  @block_type
end

#created_atObject

Returns the value of attribute created_at.



23
24
25
# File 'lib/retab/workflow_reviews/review.rb', line 23

def created_at
  @created_at
end

#decisionObject

Returns the value of attribute decision.



23
24
25
# File 'lib/retab/workflow_reviews/review.rb', line 23

def decision
  @decision
end

#idObject

Returns the value of attribute id.



23
24
25
# File 'lib/retab/workflow_reviews/review.rb', line 23

def id
  @id
end

#iteration_keyObject

Returns the value of attribute iteration_key.



23
24
25
# File 'lib/retab/workflow_reviews/review.rb', line 23

def iteration_key
  @iteration_key
end

#parent_step_idObject

Returns the value of attribute parent_step_id.



23
24
25
# File 'lib/retab/workflow_reviews/review.rb', line 23

def parent_step_id
  @parent_step_id
end

#run_idObject

Returns the value of attribute run_id.



23
24
25
# File 'lib/retab/workflow_reviews/review.rb', line 23

def run_id
  @run_id
end

#step_idObject

Returns the value of attribute step_id.



23
24
25
# File 'lib/retab/workflow_reviews/review.rb', line 23

def step_id
  @step_id
end

#triggered_byObject

Returns the value of attribute triggered_by.



23
24
25
# File 'lib/retab/workflow_reviews/review.rb', line 23

def triggered_by
  @triggered_by
end

#workflow_idObject

Returns the value of attribute workflow_id.



23
24
25
# File 'lib/retab/workflow_reviews/review.rb', line 23

def workflow_id
  @workflow_id
end

#workflow_version_idObject

Returns the value of attribute workflow_version_id.



23
24
25
# File 'lib/retab/workflow_reviews/review.rb', line 23

def workflow_version_id
  @workflow_version_id
end