Class: OCI::AiDocument::Models::Page

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

Overview

One page document analysis result.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Page

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/oci/ai_document/models/page.rb', line 109

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.page_number = attributes[:'pageNumber'] if attributes[:'pageNumber']

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

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

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

  self.detected_document_types = attributes[:'detectedDocumentTypes'] if attributes[:'detectedDocumentTypes']

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

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

  self.detected_languages = attributes[:'detectedLanguages'] if attributes[:'detectedLanguages']

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

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

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

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

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

  self.document_fields = attributes[:'documentFields'] if attributes[:'documentFields']

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

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

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

  self.bar_codes = attributes[:'barCodes'] if attributes[:'barCodes']

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

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

  self.selection_marks = attributes[:'selectionMarks'] if attributes[:'selectionMarks']

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

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

Instance Attribute Details

#bar_codesArray<OCI::AiDocument::Models::BarCode>

The bar codes detected on the page.



48
49
50
# File 'lib/oci/ai_document/models/page.rb', line 48

def bar_codes
  @bar_codes
end

#detected_document_typesArray<OCI::AiDocument::Models::DetectedDocumentType>

An array of detected document types.



20
21
22
# File 'lib/oci/ai_document/models/page.rb', line 20

def detected_document_types
  @detected_document_types
end

#detected_languagesArray<OCI::AiDocument::Models::DetectedLanguage>

An array of detected languages.



24
25
26
# File 'lib/oci/ai_document/models/page.rb', line 24

def detected_languages
  @detected_languages
end

#dimensionsOCI::AiDocument::Models::Dimensions



16
17
18
# File 'lib/oci/ai_document/models/page.rb', line 16

def dimensions
  @dimensions
end

#document_fieldsArray<OCI::AiDocument::Models::DocumentField>

The form fields detected on the page.



40
41
42
# File 'lib/oci/ai_document/models/page.rb', line 40

def document_fields
  @document_fields
end

#linesArray<OCI::AiDocument::Models::Line>

The lines of text detected on the page.

Returns:



32
33
34
# File 'lib/oci/ai_document/models/page.rb', line 32

def lines
  @lines
end

#page_numberInteger

[Required] The document page number.

Returns:

  • (Integer)


13
14
15
# File 'lib/oci/ai_document/models/page.rb', line 13

def page_number
  @page_number
end

#selection_marksArray<OCI::AiDocument::Models::SelectionMark>

The checkboxes and selection marks detected on the page.



52
53
54
# File 'lib/oci/ai_document/models/page.rb', line 52

def selection_marks
  @selection_marks
end

#signaturesArray<OCI::AiDocument::Models::Signature>

The signatures detected on the page.



44
45
46
# File 'lib/oci/ai_document/models/page.rb', line 44

def signatures
  @signatures
end

#tablesArray<OCI::AiDocument::Models::Table>

The tables detected on the page.

Returns:



36
37
38
# File 'lib/oci/ai_document/models/page.rb', line 36

def tables
  @tables
end

#wordsArray<OCI::AiDocument::Models::Word>

The words detected on the page.

Returns:



28
29
30
# File 'lib/oci/ai_document/models/page.rb', line 28

def words
  @words
end

Class Method Details

.attribute_mapObject

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



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

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'page_number': :'pageNumber',
    'dimensions': :'dimensions',
    'detected_document_types': :'detectedDocumentTypes',
    'detected_languages': :'detectedLanguages',
    'words': :'words',
    'lines': :'lines',
    'tables': :'tables',
    'document_fields': :'documentFields',
    'signatures': :'signatures',
    'bar_codes': :'barCodes',
    'selection_marks': :'selectionMarks'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/oci/ai_document/models/page.rb', line 74

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'page_number': :'Integer',
    'dimensions': :'OCI::AiDocument::Models::Dimensions',
    'detected_document_types': :'Array<OCI::AiDocument::Models::DetectedDocumentType>',
    'detected_languages': :'Array<OCI::AiDocument::Models::DetectedLanguage>',
    'words': :'Array<OCI::AiDocument::Models::Word>',
    'lines': :'Array<OCI::AiDocument::Models::Line>',
    'tables': :'Array<OCI::AiDocument::Models::Table>',
    'document_fields': :'Array<OCI::AiDocument::Models::DocumentField>',
    'signatures': :'Array<OCI::AiDocument::Models::Signature>',
    'bar_codes': :'Array<OCI::AiDocument::Models::BarCode>',
    'selection_marks': :'Array<OCI::AiDocument::Models::SelectionMark>'
    # 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



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/oci/ai_document/models/page.rb', line 169

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

  self.class == other.class &&
    page_number == other.page_number &&
    dimensions == other.dimensions &&
    detected_document_types == other.detected_document_types &&
    detected_languages == other.detected_languages &&
    words == other.words &&
    lines == other.lines &&
    tables == other.tables &&
    document_fields == other.document_fields &&
    signatures == other.signatures &&
    bar_codes == other.bar_codes &&
    selection_marks == other.selection_marks
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



209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/oci/ai_document/models/page.rb', line 209

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


189
190
191
# File 'lib/oci/ai_document/models/page.rb', line 189

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



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

def hash
  [page_number, dimensions, detected_document_types, detected_languages, words, lines, tables, document_fields, signatures, bar_codes, selection_marks].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



242
243
244
245
246
247
248
249
250
251
# File 'lib/oci/ai_document/models/page.rb', line 242

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



236
237
238
# File 'lib/oci/ai_document/models/page.rb', line 236

def to_s
  to_hash.to_s
end