Class: Retab::Review

Inherits:
Types::BaseModel 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,
  workflow_run_id: :workflow_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

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) ⇒ Review

Returns a new instance of Review.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/retab/workflow_reviews/review.rb', line 37

def initialize(json)
  hash = self.class.normalize(json)
  @id = hash[:id]
  @workflow_id = hash[:workflow_id]
  @workflow_version_id = hash[:workflow_version_id]
  @workflow_run_id = hash[:workflow_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" then Retab::ReviewAllOf.new(hash[:triggered_by]) when "always" then Retab::ReviewAlways.new(hash[:triggered_by]) when "any_of" then Retab::ReviewAnyOf.new(hash[:triggered_by]) when "any_required_field_null" then Retab::ReviewAnyRequiredFieldNull.new(hash[:triggered_by]) when "any_split_pages_lt" then Retab::ReviewAnySplitPagesLt.new(hash[:triggered_by]) when "boundary_confidence_lt" then Retab::ReviewBoundaryConfidenceLt.new(hash[:triggered_by]) when "branch_in" then Retab::ReviewBranchIn.new(hash[:triggered_by]) when "category_in" then Retab::ReviewCategoryIn.new(hash[:triggered_by]) when "confidence_lt" then Retab::ReviewConfidenceLt.new(hash[:triggered_by]) when "field_confidence_lt" then Retab::ReviewFieldConfidenceLt.new(hash[:triggered_by]) when "json_condition" then Retab::ReviewJsonCondition.new(hash[:triggered_by]) when "split_count_neq" then Retab::ReviewSplitCountNeq.new(hash[:triggered_by]) when "top_margin_lt" then Retab::ReviewTopMarginLt.new(hash[:triggered_by]) when "validation_failed" then 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

#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_run_idObject

Returns the value of attribute workflow_run_id.



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

def workflow_run_id
  @workflow_run_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