Class: OCI::AiVision::Models::AnalyzeDocumentDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/ai_vision/models/analyze_document_details.rb

Overview

The details of how to analyze a document.

Constant Summary collapse

LANGUAGE_ENUM =
[
  LANGUAGE_ENG = 'ENG'.freeze,
  LANGUAGE_CES = 'CES'.freeze,
  LANGUAGE_DAN = 'DAN'.freeze,
  LANGUAGE_NLD = 'NLD'.freeze,
  LANGUAGE_FIN = 'FIN'.freeze,
  LANGUAGE_FRA = 'FRA'.freeze,
  LANGUAGE_DEU = 'DEU'.freeze,
  LANGUAGE_ELL = 'ELL'.freeze,
  LANGUAGE_HUN = 'HUN'.freeze,
  LANGUAGE_ITA = 'ITA'.freeze,
  LANGUAGE_NOR = 'NOR'.freeze,
  LANGUAGE_POL = 'POL'.freeze,
  LANGUAGE_POR = 'POR'.freeze,
  LANGUAGE_RON = 'RON'.freeze,
  LANGUAGE_RUS = 'RUS'.freeze,
  LANGUAGE_SLK = 'SLK'.freeze,
  LANGUAGE_SPA = 'SPA'.freeze,
  LANGUAGE_SWE = 'SWE'.freeze,
  LANGUAGE_TUR = 'TUR'.freeze,
  LANGUAGE_ARA = 'ARA'.freeze,
  LANGUAGE_CHI_SIM = 'CHI_SIM'.freeze,
  LANGUAGE_HIN = 'HIN'.freeze,
  LANGUAGE_JPN = 'JPN'.freeze,
  LANGUAGE_KOR = 'KOR'.freeze,
  LANGUAGE_OTHERS = 'OTHERS'.freeze
].freeze
DOCUMENT_TYPE_ENUM =
[
  DOCUMENT_TYPE_INVOICE = 'INVOICE'.freeze,
  DOCUMENT_TYPE_RECEIPT = 'RECEIPT'.freeze,
  DOCUMENT_TYPE_RESUME = 'RESUME'.freeze,
  DOCUMENT_TYPE_TAX_FORM = 'TAX_FORM'.freeze,
  DOCUMENT_TYPE_DRIVER_LICENSE = 'DRIVER_LICENSE'.freeze,
  DOCUMENT_TYPE_PASSPORT = 'PASSPORT'.freeze,
  DOCUMENT_TYPE_BANK_STATEMENT = 'BANK_STATEMENT'.freeze,
  DOCUMENT_TYPE_CHECK = 'CHECK'.freeze,
  DOCUMENT_TYPE_PAYSLIP = 'PAYSLIP'.freeze,
  DOCUMENT_TYPE_OTHERS = 'OTHERS'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AnalyzeDocumentDetails

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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
# File 'lib/oci/ai_vision/models/analyze_document_details.rb', line 115

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

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

  self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']

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

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

  self.output_location = attributes[:'outputLocation'] if attributes[:'outputLocation']

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

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

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

  self.document_type = attributes[:'documentType'] if attributes[:'documentType']

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

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

Instance Attribute Details

#compartment_idString

The OCID of the compartment that calls the API.

Returns:

  • (String)


62
63
64
# File 'lib/oci/ai_vision/models/analyze_document_details.rb', line 62

def compartment_id
  @compartment_id
end

#documentOCI::AiVision::Models::DocumentDetails

This attribute is required.



58
59
60
# File 'lib/oci/ai_vision/models/analyze_document_details.rb', line 58

def document
  @document
end

#document_typeString

The document type.

Returns:

  • (String)


73
74
75
# File 'lib/oci/ai_vision/models/analyze_document_details.rb', line 73

def document_type
  @document_type
end

#featuresArray<OCI::AiVision::Models::DocumentFeature>

[Required] The types of document analysis requested.



54
55
56
# File 'lib/oci/ai_vision/models/analyze_document_details.rb', line 54

def features
  @features
end

#languageString

The document language, abbreviated according to ISO 639-2.

Returns:

  • (String)


69
70
71
# File 'lib/oci/ai_vision/models/analyze_document_details.rb', line 69

def language
  @language
end

#output_locationOCI::AiVision::Models::OutputLocation



65
66
67
# File 'lib/oci/ai_vision/models/analyze_document_details.rb', line 65

def output_location
  @output_location
end

Class Method Details

.attribute_mapObject

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



76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/oci/ai_vision/models/analyze_document_details.rb', line 76

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'features': :'features',
    'document': :'document',
    'compartment_id': :'compartmentId',
    'output_location': :'outputLocation',
    'language': :'language',
    'document_type': :'documentType'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/oci/ai_vision/models/analyze_document_details.rb', line 90

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'features': :'Array<OCI::AiVision::Models::DocumentFeature>',
    'document': :'OCI::AiVision::Models::DocumentDetails',
    'compartment_id': :'String',
    'output_location': :'OCI::AiVision::Models::OutputLocation',
    'language': :'String',
    'document_type': :'String'
    # 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
# File 'lib/oci/ai_vision/models/analyze_document_details.rb', line 169

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

  self.class == other.class &&
    features == other.features &&
    document == other.document &&
    compartment_id == other.compartment_id &&
    output_location == other.output_location &&
    language == other.language &&
    document_type == other.document_type
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



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/oci/ai_vision/models/analyze_document_details.rb', line 204

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


184
185
186
# File 'lib/oci/ai_vision/models/analyze_document_details.rb', line 184

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



193
194
195
# File 'lib/oci/ai_vision/models/analyze_document_details.rb', line 193

def hash
  [features, document, compartment_id, output_location, language, document_type].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



237
238
239
240
241
242
243
244
245
246
# File 'lib/oci/ai_vision/models/analyze_document_details.rb', line 237

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



231
232
233
# File 'lib/oci/ai_vision/models/analyze_document_details.rb', line 231

def to_s
  to_hash.to_s
end