Class: OCI::AiDocument::Models::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/ai_document/models/table.rb

Overview

The table extracted from a document.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Table

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/oci/ai_document/models/table.rb', line 83

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.row_count = attributes[:'rowCount'] if attributes[:'rowCount']

  raise 'You cannot provide both :rowCount and :row_count' if attributes.key?(:'rowCount') && attributes.key?(:'row_count')

  self.row_count = attributes[:'row_count'] if attributes[:'row_count']

  self.column_count = attributes[:'columnCount'] if attributes[:'columnCount']

  raise 'You cannot provide both :columnCount and :column_count' if attributes.key?(:'columnCount') && attributes.key?(:'column_count')

  self.column_count = attributes[:'column_count'] if attributes[:'column_count']

  self.header_rows = attributes[:'headerRows'] if attributes[:'headerRows']

  raise 'You cannot provide both :headerRows and :header_rows' if attributes.key?(:'headerRows') && attributes.key?(:'header_rows')

  self.header_rows = attributes[:'header_rows'] if attributes[:'header_rows']

  self.body_rows = attributes[:'bodyRows'] if attributes[:'bodyRows']

  raise 'You cannot provide both :bodyRows and :body_rows' if attributes.key?(:'bodyRows') && attributes.key?(:'body_rows')

  self.body_rows = attributes[:'body_rows'] if attributes[:'body_rows']

  self.footer_rows = attributes[:'footerRows'] if attributes[:'footerRows']

  raise 'You cannot provide both :footerRows and :footer_rows' if attributes.key?(:'footerRows') && attributes.key?(:'footer_rows')

  self.footer_rows = attributes[:'footer_rows'] if attributes[:'footer_rows']

  self.confidence = attributes[:'confidence'] if attributes[:'confidence']

  self.bounding_polygon = attributes[:'boundingPolygon'] if attributes[:'boundingPolygon']

  raise 'You cannot provide both :boundingPolygon and :bounding_polygon' if attributes.key?(:'boundingPolygon') && attributes.key?(:'bounding_polygon')

  self.bounding_polygon = attributes[:'bounding_polygon'] if attributes[:'bounding_polygon']
end

Instance Attribute Details

#body_rowsArray<OCI::AiDocument::Models::TableRow>

[Required] The body rows.



26
27
28
# File 'lib/oci/ai_document/models/table.rb', line 26

def body_rows
  @body_rows
end

#bounding_polygonOCI::AiDocument::Models::BoundingPolygon

This attribute is required.



38
39
40
# File 'lib/oci/ai_document/models/table.rb', line 38

def bounding_polygon
  @bounding_polygon
end

#column_countInteger

[Required] The number of columns.

Returns:

  • (Integer)


18
19
20
# File 'lib/oci/ai_document/models/table.rb', line 18

def column_count
  @column_count
end

#confidenceFloat

[Required] The confidence score between 0 and 1.

Returns:

  • (Float)


34
35
36
# File 'lib/oci/ai_document/models/table.rb', line 34

def confidence
  @confidence
end

[Required] the footer rows.



30
31
32
# File 'lib/oci/ai_document/models/table.rb', line 30

def footer_rows
  @footer_rows
end

#header_rowsArray<OCI::AiDocument::Models::TableRow>

[Required] The header rows.



22
23
24
# File 'lib/oci/ai_document/models/table.rb', line 22

def header_rows
  @header_rows
end

#row_countInteger

[Required] The number of rows.

Returns:

  • (Integer)


14
15
16
# File 'lib/oci/ai_document/models/table.rb', line 14

def row_count
  @row_count
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/oci/ai_document/models/table.rb', line 41

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'row_count': :'rowCount',
    'column_count': :'columnCount',
    'header_rows': :'headerRows',
    'body_rows': :'bodyRows',
    'footer_rows': :'footerRows',
    'confidence': :'confidence',
    'bounding_polygon': :'boundingPolygon'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/oci/ai_document/models/table.rb', line 56

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'row_count': :'Integer',
    'column_count': :'Integer',
    'header_rows': :'Array<OCI::AiDocument::Models::TableRow>',
    'body_rows': :'Array<OCI::AiDocument::Models::TableRow>',
    'footer_rows': :'Array<OCI::AiDocument::Models::TableRow>',
    'confidence': :'Float',
    'bounding_polygon': :'OCI::AiDocument::Models::BoundingPolygon'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/oci/ai_document/models/table.rb', line 135

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    row_count == other.row_count &&
    column_count == other.column_count &&
    header_rows == other.header_rows &&
    body_rows == other.body_rows &&
    footer_rows == other.footer_rows &&
    confidence == other.confidence &&
    bounding_polygon == other.bounding_polygon
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/oci/ai_document/models/table.rb', line 171

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


151
152
153
# File 'lib/oci/ai_document/models/table.rb', line 151

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



160
161
162
# File 'lib/oci/ai_document/models/table.rb', line 160

def hash
  [row_count, column_count, header_rows, body_rows, footer_rows, confidence, bounding_polygon].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



204
205
206
207
208
209
210
211
212
213
# File 'lib/oci/ai_document/models/table.rb', line 204

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



198
199
200
# File 'lib/oci/ai_document/models/table.rb', line 198

def to_s
  to_hash.to_s
end