Class: FlatApi::OmrJob

Inherits:
ApiModelBase show all
Defined in:
lib/flat_api/models/omr_job.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ OmrJob

Initializes the object

Parameters:

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

    Model attributes in the form of hash



147
148
149
150
151
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
# File 'lib/flat_api/models/omr_job.rb', line 147

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?(:'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.error_message = 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

#creation_dateObject

When the job was created.



56
57
58
# File 'lib/flat_api/models/omr_job.rb', line 56

def creation_date
  @creation_date
end

#current_stepObject

The pending step when status is awaitingInput. Omitted otherwise.



32
33
34
# File 'lib/flat_api/models/omr_job.rb', line 32

def current_step
  @current_step
end

#error_codeObject

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.



50
51
52
# File 'lib/flat_api/models/omr_job.rb', line 50

def error_code
  @error_code
end

#error_messageObject

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.



53
54
55
# File 'lib/flat_api/models/omr_job.rb', line 53

def error_message
  @error_message
end

#estimated_creditsObject

Credits that will be or were charged at start (page-based), so a client can show a confirmation before charging.



37
38
39
# File 'lib/flat_api/models/omr_job.rb', line 37

def estimated_credits
  @estimated_credits
end

#idObject

Unique identifier of the OMR job.



19
20
21
# File 'lib/flat_api/models/omr_job.rb', line 19

def id
  @id
end

#imported_metadataObject

Returns the value of attribute imported_metadata.



43
44
45
# File 'lib/flat_api/models/omr_job.rb', line 43

def 
  @imported_metadata
end

#interactive_stepsObject

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

#localesObject

Locale hints (BCP 47) the job was created with, used for OCR and as the default main language at the details step.



29
30
31
# File 'lib/flat_api/models/omr_job.rb', line 29

def locales
  @locales
end

#modification_dateObject

When the job was last updated.



59
60
61
# File 'lib/flat_api/models/omr_job.rb', line 59

def modification_date
  @modification_date
end

#original_file_metadataObject

Returns the value of attribute original_file_metadata.



41
42
43
# File 'lib/flat_api/models/omr_job.rb', line 41

def 
  @original_file_metadata
end

#outputObject

Returns the value of attribute output.



23
24
25
# File 'lib/flat_api/models/omr_job.rb', line 23

def output
  @output
end

#pending_stepObject

Returns the value of attribute pending_step.



34
35
36
# File 'lib/flat_api/models/omr_job.rb', line 34

def pending_step
  @pending_step
end

#progressObject

Returns the value of attribute progress.



39
40
41
# File 'lib/flat_api/models/omr_job.rb', line 39

def progress
  @progress
end

#resultObject

Returns the value of attribute result.



45
46
47
# File 'lib/flat_api/models/omr_job.rb', line 45

def result
  @result
end

#retentionObject

Returns the value of attribute retention.



47
48
49
# File 'lib/flat_api/models/omr_job.rb', line 47

def retention
  @retention
end

#statusObject

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_mapObject

Returns attribute mapping this model knows about



107
108
109
# File 'lib/flat_api/models/omr_job.rb', line 107

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



112
113
114
# File 'lib/flat_api/models/omr_job.rb', line 112

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/flat_api/models/omr_job.rb', line 84

def self.attribute_map
  {
    :'id' => :'id',
    :'status' => :'status',
    :'output' => :'output',
    :'interactive_steps' => :'interactiveSteps',
    :'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

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# File 'lib/flat_api/models/omr_job.rb', line 356

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_nullableObject

List of attributes with nullable: true



140
141
142
143
# File 'lib/flat_api/models/omr_job.rb', line 140

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/flat_api/models/omr_job.rb', line 117

def self.openapi_types
  {
    :'id' => :'String',
    :'status' => :'OmrJobStatus',
    :'output' => :'OmrJobOutput',
    :'interactive_steps' => :'Array<OmrStepName>',
    :'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.

Parameters:

  • Object (Object)

    to be compared



319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/flat_api/models/omr_job.rb', line 319

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 &&
      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 &&
      error_message == o.error_message &&
      creation_date == o.creation_date &&
      modification_date == o.modification_date
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


343
344
345
# File 'lib/flat_api/models/omr_job.rb', line 343

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



349
350
351
# File 'lib/flat_api/models/omr_job.rb', line 349

def hash
  [id, status, output, interactive_steps, locales, current_step, pending_step, estimated_credits, progress, , , result, retention, error_code, error_message, creation_date, modification_date].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/flat_api/models/omr_job.rb', line 244

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_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



378
379
380
381
382
383
384
385
386
387
388
389
390
# File 'lib/flat_api/models/omr_job.rb', line 378

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

Returns:

  • (Boolean)

    true if the model is valid



268
269
270
271
272
273
274
275
# File 'lib/flat_api/models/omr_job.rb', line 268

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