Class: FlatApi::OmrJob
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- FlatApi::OmrJob
- Defined in:
- lib/flat_api/models/omr_job.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#auto_rotate ⇒ Object
Whether the job was created with
autoRotate, echoing the value set at creation. -
#creation_date ⇒ Object
When the job was created.
-
#current_step ⇒ Object
The pending step when
statusisawaitingInput. -
#error_code ⇒ Object
Stable, engine-agnostic failure code, present when
statusiserror. -
#error_message ⇒ Object
Localized, user-facing error message, present when
statusiserror. -
#estimated_credits ⇒ Object
Credits that will be or were charged at start (page-based), so a client can show a confirmation before charging.
-
#id ⇒ Object
Unique identifier of the OMR job.
-
#imported_metadata ⇒ Object
Returns the value of attribute imported_metadata.
-
#interactive_steps ⇒ Object
Steps this job pauses at for client input, echoing the value set at creation.
-
#locales ⇒ Object
Locale hints (BCP 47) the job was created with, used for OCR and as the default main language at the
detailsstep. -
#modification_date ⇒ Object
When the job was last updated.
-
#original_file_metadata ⇒ Object
Returns the value of attribute original_file_metadata.
-
#output ⇒ Object
Returns the value of attribute output.
-
#pending_step ⇒ Object
Returns the value of attribute pending_step.
-
#progress ⇒ Object
Returns the value of attribute progress.
-
#result ⇒ Object
Returns the value of attribute result.
-
#retention ⇒ Object
Returns the value of attribute retention.
-
#status ⇒ Object
Returns the value of attribute status.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ OmrJob
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ OmrJob
Initializes the object
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/flat_api/models/omr_job.rb', line 152 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `FlatApi::OmrJob` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `FlatApi::OmrJob`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] else self.id = nil end if attributes.key?(:'status') self.status = attributes[:'status'] else self.status = nil end if attributes.key?(:'output') self.output = attributes[:'output'] else self.output = 'library' end if attributes.key?(:'interactive_steps') if (value = attributes[:'interactive_steps']).is_a?(Array) self.interactive_steps = value end else self.interactive_steps = nil end if attributes.key?(:'auto_rotate') self.auto_rotate = attributes[:'auto_rotate'] end if attributes.key?(:'locales') if (value = attributes[:'locales']).is_a?(Array) self.locales = value end end if attributes.key?(:'current_step') self.current_step = attributes[:'current_step'] end if attributes.key?(:'pending_step') self.pending_step = attributes[:'pending_step'] end if attributes.key?(:'estimated_credits') self.estimated_credits = attributes[:'estimated_credits'] end if attributes.key?(:'progress') self.progress = attributes[:'progress'] end if attributes.key?(:'original_file_metadata') self. = attributes[:'original_file_metadata'] end if attributes.key?(:'imported_metadata') self. = attributes[:'imported_metadata'] end if attributes.key?(:'result') self.result = attributes[:'result'] end if attributes.key?(:'retention') self.retention = attributes[:'retention'] end if attributes.key?(:'error_code') self.error_code = attributes[:'error_code'] end if attributes.key?(:'error_message') self. = attributes[:'error_message'] end if attributes.key?(:'creation_date') self.creation_date = attributes[:'creation_date'] end if attributes.key?(:'modification_date') self.modification_date = attributes[:'modification_date'] end end |
Instance Attribute Details
#auto_rotate ⇒ Object
Whether the job was created with autoRotate, echoing the value set at creation.
29 30 31 |
# File 'lib/flat_api/models/omr_job.rb', line 29 def auto_rotate @auto_rotate end |
#creation_date ⇒ Object
When the job was created.
59 60 61 |
# File 'lib/flat_api/models/omr_job.rb', line 59 def creation_date @creation_date end |
#current_step ⇒ Object
The pending step when status is awaitingInput. Omitted otherwise.
35 36 37 |
# File 'lib/flat_api/models/omr_job.rb', line 35 def current_step @current_step end |
#error_code ⇒ Object
Stable, engine-agnostic failure code, present when status is error. Branch on this for custom handling, and render errorMessage for the user-facing text. This is an open string: new codes may be added over time, so keep a generic fallback and never hardcode an exhaustive switch. Current values: * NO_MUSIC_DETECTED: no musical content found (poor scan, rotated page, or tablature). * CORRUPTED_FILE: the input file is corrupted and could not be read. * UNSUPPORTED_FORMAT: the file format or notation is not supported yet. * UNSUPPORTED_TABLATURE: the file is guitar tablature, not supported yet. * ENCRYPTED_PDF: the PDF is password-protected. * TOO_LARGE: the document is too large or has an unusual shape to process. * ENGINE_TIMEOUT: recognition took longer than expected and was stopped. * GENERIC: unspecified failure.
53 54 55 |
# File 'lib/flat_api/models/omr_job.rb', line 53 def error_code @error_code end |
#error_message ⇒ Object
Localized, user-facing error message, present when status is error. Rendered in the caller's locale and safe to display as-is. Pair with errorCode for branching.
56 57 58 |
# File 'lib/flat_api/models/omr_job.rb', line 56 def end |
#estimated_credits ⇒ Object
Credits that will be or were charged at start (page-based), so a client can show a confirmation before charging.
40 41 42 |
# File 'lib/flat_api/models/omr_job.rb', line 40 def estimated_credits @estimated_credits end |
#id ⇒ Object
Unique identifier of the OMR job.
19 20 21 |
# File 'lib/flat_api/models/omr_job.rb', line 19 def id @id end |
#imported_metadata ⇒ Object
Returns the value of attribute imported_metadata.
46 47 48 |
# File 'lib/flat_api/models/omr_job.rb', line 46 def end |
#interactive_steps ⇒ Object
Steps this job pauses at for client input, echoing the value set at creation.
26 27 28 |
# File 'lib/flat_api/models/omr_job.rb', line 26 def interactive_steps @interactive_steps end |
#locales ⇒ Object
Locale hints (BCP 47) the job was created with, used for OCR and as the default main language at the details step.
32 33 34 |
# File 'lib/flat_api/models/omr_job.rb', line 32 def locales @locales end |
#modification_date ⇒ Object
When the job was last updated.
62 63 64 |
# File 'lib/flat_api/models/omr_job.rb', line 62 def modification_date @modification_date end |
#original_file_metadata ⇒ Object
Returns the value of attribute original_file_metadata.
44 45 46 |
# File 'lib/flat_api/models/omr_job.rb', line 44 def end |
#output ⇒ Object
Returns the value of attribute output.
23 24 25 |
# File 'lib/flat_api/models/omr_job.rb', line 23 def output @output end |
#pending_step ⇒ Object
Returns the value of attribute pending_step.
37 38 39 |
# File 'lib/flat_api/models/omr_job.rb', line 37 def pending_step @pending_step end |
#progress ⇒ Object
Returns the value of attribute progress.
42 43 44 |
# File 'lib/flat_api/models/omr_job.rb', line 42 def progress @progress end |
#result ⇒ Object
Returns the value of attribute result.
48 49 50 |
# File 'lib/flat_api/models/omr_job.rb', line 48 def result @result end |
#retention ⇒ Object
Returns the value of attribute retention.
50 51 52 |
# File 'lib/flat_api/models/omr_job.rb', line 50 def retention @retention end |
#status ⇒ Object
Returns the value of attribute status.
21 22 23 |
# File 'lib/flat_api/models/omr_job.rb', line 21 def status @status end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
111 112 113 |
# File 'lib/flat_api/models/omr_job.rb', line 111 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
116 117 118 |
# File 'lib/flat_api/models/omr_job.rb', line 116 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/flat_api/models/omr_job.rb', line 87 def self.attribute_map { :'id' => :'id', :'status' => :'status', :'output' => :'output', :'interactive_steps' => :'interactiveSteps', :'auto_rotate' => :'autoRotate', :'locales' => :'locales', :'current_step' => :'currentStep', :'pending_step' => :'pendingStep', :'estimated_credits' => :'estimatedCredits', :'progress' => :'progress', :'original_file_metadata' => :'originalFileMetadata', :'imported_metadata' => :'importedMetadata', :'result' => :'result', :'retention' => :'retention', :'error_code' => :'errorCode', :'error_message' => :'errorMessage', :'creation_date' => :'creationDate', :'modification_date' => :'modificationDate' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
# File 'lib/flat_api/models/omr_job.rb', line 366 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
145 146 147 148 |
# File 'lib/flat_api/models/omr_job.rb', line 145 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/flat_api/models/omr_job.rb', line 121 def self.openapi_types { :'id' => :'String', :'status' => :'OmrJobStatus', :'output' => :'OmrJobOutput', :'interactive_steps' => :'Array<OmrStepName>', :'auto_rotate' => :'Boolean', :'locales' => :'Array<String>', :'current_step' => :'OmrStepName', :'pending_step' => :'OmrPendingStep', :'estimated_credits' => :'Integer', :'progress' => :'OmrJobProgress', :'original_file_metadata' => :'OmrJobFileMetadata', :'imported_metadata' => :'OmrImportedMetadata', :'result' => :'OmrJobResult', :'retention' => :'OmrJobRetention', :'error_code' => :'String', :'error_message' => :'String', :'creation_date' => :'Time', :'modification_date' => :'Time' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
# File 'lib/flat_api/models/omr_job.rb', line 328 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && status == o.status && output == o.output && interactive_steps == o.interactive_steps && auto_rotate == o.auto_rotate && locales == o.locales && current_step == o.current_step && pending_step == o.pending_step && estimated_credits == o.estimated_credits && progress == o.progress && == o. && == o. && result == o.result && retention == o.retention && error_code == o.error_code && == o. && creation_date == o.creation_date && modification_date == o.modification_date end |
#eql?(o) ⇒ Boolean
353 354 355 |
# File 'lib/flat_api/models/omr_job.rb', line 353 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
359 360 361 |
# File 'lib/flat_api/models/omr_job.rb', line 359 def hash [id, status, output, interactive_steps, auto_rotate, locales, current_step, pending_step, estimated_credits, progress, , , result, retention, error_code, , creation_date, modification_date].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/flat_api/models/omr_job.rb', line 253 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status cannot be nil.') end if @output.nil? invalid_properties.push('invalid value for "output", output cannot be nil.') end if @interactive_steps.nil? invalid_properties.push('invalid value for "interactive_steps", interactive_steps cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
388 389 390 391 392 393 394 395 396 397 398 399 400 |
# File 'lib/flat_api/models/omr_job.rb', line 388 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
277 278 279 280 281 282 283 284 |
# File 'lib/flat_api/models/omr_job.rb', line 277 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @id.nil? return false if @status.nil? return false if @output.nil? return false if @interactive_steps.nil? true end |