Class: OCI::AiDocument::Models::Page
- Inherits:
-
Object
- Object
- OCI::AiDocument::Models::Page
- Defined in:
- lib/oci/ai_document/models/page.rb
Overview
One page document analysis result.
Instance Attribute Summary collapse
-
#detected_document_types ⇒ Array<OCI::AiDocument::Models::DetectedDocumentType>
An array of detected document types.
-
#detected_languages ⇒ Array<OCI::AiDocument::Models::DetectedLanguage>
An array of detected languages.
- #dimensions ⇒ OCI::AiDocument::Models::Dimensions
-
#document_fields ⇒ Array<OCI::AiDocument::Models::DocumentField>
The form fields detected on the page.
-
#lines ⇒ Array<OCI::AiDocument::Models::Line>
The lines of text detected on the page.
-
#page_number ⇒ Integer
[Required] The document page number.
-
#tables ⇒ Array<OCI::AiDocument::Models::Table>
The tables detected on the page.
-
#words ⇒ Array<OCI::AiDocument::Models::Word>
The words detected on the page.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Page
constructor
Initializes the object.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ Page
Initializes the object
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 |
# File 'lib/oci/ai_document/models/page.rb', line 88 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'] end |
Instance Attribute Details
#detected_document_types ⇒ Array<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_languages ⇒ Array<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 |
#dimensions ⇒ OCI::AiDocument::Models::Dimensions
16 17 18 |
# File 'lib/oci/ai_document/models/page.rb', line 16 def dimensions @dimensions end |
#document_fields ⇒ Array<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 |
#lines ⇒ Array<OCI::AiDocument::Models::Line>
The lines of text detected on the page.
32 33 34 |
# File 'lib/oci/ai_document/models/page.rb', line 32 def lines @lines end |
#page_number ⇒ Integer
[Required] The document page number.
13 14 15 |
# File 'lib/oci/ai_document/models/page.rb', line 13 def page_number @page_number end |
#tables ⇒ Array<OCI::AiDocument::Models::Table>
The tables detected on the page.
36 37 38 |
# File 'lib/oci/ai_document/models/page.rb', line 36 def tables @tables end |
#words ⇒ Array<OCI::AiDocument::Models::Word>
The words detected on the page.
28 29 30 |
# File 'lib/oci/ai_document/models/page.rb', line 28 def words @words end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/oci/ai_document/models/page.rb', line 43 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' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/oci/ai_document/models/page.rb', line 59 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>' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/oci/ai_document/models/page.rb', line 134 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 end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
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/page.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
151 152 153 |
# File 'lib/oci/ai_document/models/page.rb', line 151 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
160 161 162 |
# File 'lib/oci/ai_document/models/page.rb', line 160 def hash [page_number, dimensions, detected_document_types, detected_languages, words, lines, tables, document_fields].hash end |
#to_hash ⇒ 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/page.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_s ⇒ String
Returns the string representation of the object
198 199 200 |
# File 'lib/oci/ai_document/models/page.rb', line 198 def to_s to_hash.to_s end |