Class: Retab::ReviewAllOf

Inherits:
Types::BaseModel show all
Defined in:
lib/retab/workflow_reviews/review_all_of.rb

Constant Summary collapse

HASH_ATTRS =
{
  kind: :kind,
  predicates: :predicates
}.freeze

Instance Attribute Summary collapse

Attributes inherited from Types::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Types::BaseModel

deep_symbolize, #inspect, normalize, #to_h, #to_json

Constructor Details

#initialize(json) ⇒ ReviewAllOf

Returns a new instance of ReviewAllOf.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/retab/workflow_reviews/review_all_of.rb', line 18

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @kind = hash[:kind]
  @predicates = (hash[:predicates] || []).map { |item|
    item ? (
      case item[:kind]
      when "all_of"
        Retab::ReviewAllOf.new(item)
      when "always"
        Retab::ReviewAlways.new(item)
      when "any_of"
        Retab::ReviewAnyOf.new(item)
      when "any_required_field_null"
        Retab::ReviewAnyRequiredFieldNull.new(item)
      when "any_split_pages_lt"
        Retab::ReviewAnySplitPagesLt.new(item)
      when "boundary_confidence_lt"
        Retab::ReviewBoundaryConfidenceLt.new(item)
      when "branch_in"
        Retab::ReviewBranchIn.new(item)
      when "category_in"
        Retab::ReviewCategoryIn.new(item)
      when "confidence_lt"
        Retab::ReviewConfidenceLt.new(item)
      when "field_confidence_lt"
        Retab::ReviewFieldConfidenceLt.new(item)
      when "json_condition"
        Retab::ReviewJsonCondition.new(item)
      when "split_count_neq"
        Retab::ReviewSplitCountNeq.new(item)
      when "top_margin_lt"
        Retab::ReviewTopMarginLt.new(item)
      when "validation_failed"
        Retab::ReviewValidationFailed.new(item)
      else
        item
      end
    ) : nil
  }
end

Instance Attribute Details

#kindObject

Returns the value of attribute kind.



13
14
15
# File 'lib/retab/workflow_reviews/review_all_of.rb', line 13

def kind
  @kind
end

#predicatesObject

Returns the value of attribute predicates.



13
14
15
# File 'lib/retab/workflow_reviews/review_all_of.rb', line 13

def predicates
  @predicates
end