Class: OCI::AiVision::Models::Page
- Inherits:
-
Object
- Object
- OCI::AiVision::Models::Page
- Defined in:
- lib/oci/ai_vision/models/page.rb
Overview
One page document analysis result.
Instance Attribute Summary collapse
-
#detected_document_types ⇒ Array<OCI::AiVision::Models::DetectedDocumentType>
An array of detected document types.
-
#detected_languages ⇒ Array<OCI::AiVision::Models::DetectedLanguage>
An array of detected languages.
- #dimensions ⇒ OCI::AiVision::Models::Dimensions
-
#document_fields ⇒ Array<OCI::AiVision::Models::DocumentField>
The form fields detected on the page.
-
#lines ⇒ Array<OCI::AiVision::Models::Line>
The lines of text detected on the page.
-
#page_number ⇒ Integer
**[Required]** The document page number.
-
#tables ⇒ Array<OCI::AiVision::Models::Table>
The tables detected on the page.
-
#words ⇒ Array<OCI::AiVision::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
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 |
# File 'lib/oci/ai_vision/models/page.rb', line 87 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::AiVision::Models::DetectedDocumentType>
An array of detected document types.
19 20 21 |
# File 'lib/oci/ai_vision/models/page.rb', line 19 def detected_document_types @detected_document_types end |
#detected_languages ⇒ Array<OCI::AiVision::Models::DetectedLanguage>
An array of detected languages.
23 24 25 |
# File 'lib/oci/ai_vision/models/page.rb', line 23 def detected_languages @detected_languages end |
#dimensions ⇒ OCI::AiVision::Models::Dimensions
15 16 17 |
# File 'lib/oci/ai_vision/models/page.rb', line 15 def dimensions @dimensions end |
#document_fields ⇒ Array<OCI::AiVision::Models::DocumentField>
The form fields detected on the page.
39 40 41 |
# File 'lib/oci/ai_vision/models/page.rb', line 39 def document_fields @document_fields end |
#lines ⇒ Array<OCI::AiVision::Models::Line>
The lines of text detected on the page.
31 32 33 |
# File 'lib/oci/ai_vision/models/page.rb', line 31 def lines @lines end |
#page_number ⇒ Integer
**[Required]** The document page number.
12 13 14 |
# File 'lib/oci/ai_vision/models/page.rb', line 12 def page_number @page_number end |
#tables ⇒ Array<OCI::AiVision::Models::Table>
The tables detected on the page.
35 36 37 |
# File 'lib/oci/ai_vision/models/page.rb', line 35 def tables @tables end |
#words ⇒ Array<OCI::AiVision::Models::Word>
The words detected on the page.
27 28 29 |
# File 'lib/oci/ai_vision/models/page.rb', line 27 def words @words end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/oci/ai_vision/models/page.rb', line 42 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.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/oci/ai_vision/models/page.rb', line 58 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'page_number': :'Integer', 'dimensions': :'OCI::AiVision::Models::Dimensions', 'detected_document_types': :'Array<OCI::AiVision::Models::DetectedDocumentType>', 'detected_languages': :'Array<OCI::AiVision::Models::DetectedLanguage>', 'words': :'Array<OCI::AiVision::Models::Word>', 'lines': :'Array<OCI::AiVision::Models::Line>', 'tables': :'Array<OCI::AiVision::Models::Table>', 'document_fields': :'Array<OCI::AiVision::Models::DocumentField>' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/oci/ai_vision/models/page.rb', line 133 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
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/oci/ai_vision/models/page.rb', line 170 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
150 151 152 |
# File 'lib/oci/ai_vision/models/page.rb', line 150 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
159 160 161 |
# File 'lib/oci/ai_vision/models/page.rb', line 159 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
203 204 205 206 207 208 209 210 211 212 |
# File 'lib/oci/ai_vision/models/page.rb', line 203 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
197 198 199 |
# File 'lib/oci/ai_vision/models/page.rb', line 197 def to_s to_hash.to_s end |