Class: FlatApi::OmrCapabilities

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

Overview

What the account or app can do, for client feature-detection.

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 = {}) ⇒ OmrCapabilities

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
145
146
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
# File 'lib/flat_api/models/omr_capabilities.rb', line 119

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `FlatApi::OmrCapabilities` 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::OmrCapabilities`. 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?(:'steps')
    if (value = attributes[:'steps']).is_a?(Array)
      self.steps = value
    end
  else
    self.steps = nil
  end

  if attributes.key?(:'formats')
    if (value = attributes[:'formats']).is_a?(Array)
      self.formats = value
    end
  else
    self.formats = nil
  end

  if attributes.key?(:'outputs')
    if (value = attributes[:'outputs']).is_a?(Array)
      self.outputs = value
    end
  else
    self.outputs = nil
  end

  if attributes.key?(:'max_files')
    self.max_files = attributes[:'max_files']
  else
    self.max_files = nil
  end

  if attributes.key?(:'max_pages')
    self.max_pages = attributes[:'max_pages']
  else
    self.max_pages = nil
  end

  if attributes.key?(:'max_parallel_jobs')
    self.max_parallel_jobs = attributes[:'max_parallel_jobs']
  else
    self.max_parallel_jobs = nil
  end

  if attributes.key?(:'max_file_size')
    self.max_file_size = attributes[:'max_file_size']
  else
    self.max_file_size = nil
  end

  if attributes.key?(:'accepted_mime_types')
    if (value = attributes[:'accepted_mime_types']).is_a?(Array)
      self.accepted_mime_types = value
    end
  else
    self.accepted_mime_types = nil
  end

  if attributes.key?(:'accepted_extensions')
    if (value = attributes[:'accepted_extensions']).is_a?(Array)
      self.accepted_extensions = value
    end
  else
    self.accepted_extensions = nil
  end

  if attributes.key?(:'cost_per_page')
    self.cost_per_page = attributes[:'cost_per_page']
  end

  if attributes.key?(:'remaining_credits')
    self.remaining_credits = attributes[:'remaining_credits']
  end

  if attributes.key?(:'retention_days')
    self.retention_days = attributes[:'retention_days']
  end

  if attributes.key?(:'locales')
    if (value = attributes[:'locales']).is_a?(Array)
      self.locales = value
    end
  else
    self.locales = nil
  end

  if attributes.key?(:'locales_details')
    if (value = attributes[:'locales_details']).is_a?(Array)
      self.locales_details = value
    end
  else
    self.locales_details = nil
  end
end

Instance Attribute Details

#accepted_extensionsObject

Filename extensions the accepted types appear under, for building a file picker. Use these alongside acceptedMimeTypes in an accept attribute: browsers and native file dialogs filter unreliably on some of the image types, so a valid file can be greyed out when only its MIME type is offered. Longer than acceptedMimeTypes, because one type arrives under several extensions (.jpg and .jpeg, .tif and .tiff, .heic and .heif). Picker metadata only. A file is identified by its content, so its extension never decides whether an upload is accepted.



44
45
46
# File 'lib/flat_api/models/omr_capabilities.rb', line 44

def accepted_extensions
  @accepted_extensions
end

#accepted_mime_typesObject

MIME types accepted for input files: PDF, plus the raster image formats. Drive the file picker from this list rather than hardcoding it, so newly supported formats need no client release. A file is identified by its content, so its declared type and its extension do not have to match. A multi-page input counts as several pages against maxPages and is charged accordingly. That covers PDFs and, among the image formats, multi-page TIFF and animated GIF/WebP.



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

def accepted_mime_types
  @accepted_mime_types
end

#cost_per_pageObject

Credits charged per page.



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

def cost_per_page
  @cost_per_page
end

#formatsObject

Export formats available via getOmrJobExport.



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

def formats
  @formats
end

#localesObject

Locales selectable for OCR, as BCP 47 codes sorted alphabetically. These are the locales the recognition pipeline can actually read, which is neither the list of Flat interface locales nor a fixed set: new languages are added over time. Clients should default to the user's own locale when it appears here.



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

def locales
  @locales
end

#locales_detailsObject

The same locales as locales, each with its English display name, sorted alphabetically by name and ready to bind to a language picker. Prefer this over locales when rendering a selector: it saves clients from shipping their own code-to-label table.



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

def locales_details
  @locales_details
end

#max_file_sizeObject

Maximum size of a single file, in bytes.



38
39
40
# File 'lib/flat_api/models/omr_capabilities.rb', line 38

def max_file_size
  @max_file_size
end

#max_filesObject

Maximum number of input files that can be added to a single job.



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

def max_files
  @max_files
end

#max_pagesObject

Maximum number of pages allowed across all input files of a single job.



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

def max_pages
  @max_pages
end

#max_parallel_jobsObject

Maximum number of OMR jobs that can run in parallel for this account.



35
36
37
# File 'lib/flat_api/models/omr_capabilities.rb', line 35

def max_parallel_jobs
  @max_parallel_jobs
end

#outputsObject

Output destinations the account can use when creating a job.



26
27
28
# File 'lib/flat_api/models/omr_capabilities.rb', line 26

def outputs
  @outputs
end

#remaining_creditsObject

OMR credits remaining for the account.



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

def remaining_credits
  @remaining_credits
end

#retention_daysObject

How many days a musicxml job's uploaded files and results are kept before erasure. Reflects the account's own period when one has been set, otherwise the platform default. Read-only: contact support to change it. Jobs with output: library are not covered by the retention policy and are unaffected by this value.



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

def retention_days
  @retention_days
end

#stepsObject

Interactive steps this server supports.



20
21
22
# File 'lib/flat_api/models/omr_capabilities.rb', line 20

def steps
  @steps
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



82
83
84
# File 'lib/flat_api/models/omr_capabilities.rb', line 82

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



87
88
89
# File 'lib/flat_api/models/omr_capabilities.rb', line 87

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/flat_api/models/omr_capabilities.rb', line 62

def self.attribute_map
  {
    :'steps' => :'steps',
    :'formats' => :'formats',
    :'outputs' => :'outputs',
    :'max_files' => :'maxFiles',
    :'max_pages' => :'maxPages',
    :'max_parallel_jobs' => :'maxParallelJobs',
    :'max_file_size' => :'maxFileSize',
    :'accepted_mime_types' => :'acceptedMimeTypes',
    :'accepted_extensions' => :'acceptedExtensions',
    :'cost_per_page' => :'costPerPage',
    :'remaining_credits' => :'remainingCredits',
    :'retention_days' => :'retentionDays',
    :'locales' => :'locales',
    :'locales_details' => :'localesDetails'
  }
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



442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
# File 'lib/flat_api/models/omr_capabilities.rb', line 442

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



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

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

.openapi_typesObject

Attribute type mapping.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/flat_api/models/omr_capabilities.rb', line 92

def self.openapi_types
  {
    :'steps' => :'Array<OmrStepName>',
    :'formats' => :'Array<String>',
    :'outputs' => :'Array<OmrJobOutput>',
    :'max_files' => :'Integer',
    :'max_pages' => :'Integer',
    :'max_parallel_jobs' => :'Integer',
    :'max_file_size' => :'Integer',
    :'accepted_mime_types' => :'Array<String>',
    :'accepted_extensions' => :'Array<String>',
    :'cost_per_page' => :'Integer',
    :'remaining_credits' => :'Integer',
    :'retention_days' => :'Integer',
    :'locales' => :'Array<String>',
    :'locales_details' => :'Array<OmrLocaleDetails>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
# File 'lib/flat_api/models/omr_capabilities.rb', line 408

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      steps == o.steps &&
      formats == o.formats &&
      outputs == o.outputs &&
      max_files == o.max_files &&
      max_pages == o.max_pages &&
      max_parallel_jobs == o.max_parallel_jobs &&
      max_file_size == o.max_file_size &&
      accepted_mime_types == o.accepted_mime_types &&
      accepted_extensions == o.accepted_extensions &&
      cost_per_page == o.cost_per_page &&
      remaining_credits == o.remaining_credits &&
      retention_days == o.retention_days &&
      locales == o.locales &&
      locales_details == o.locales_details
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


429
430
431
# File 'lib/flat_api/models/omr_capabilities.rb', line 429

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



435
436
437
# File 'lib/flat_api/models/omr_capabilities.rb', line 435

def hash
  [steps, formats, outputs, max_files, max_pages, max_parallel_jobs, max_file_size, accepted_mime_types, accepted_extensions, cost_per_page, remaining_credits, retention_days, locales, locales_details].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'lib/flat_api/models/omr_capabilities.rb', line 228

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @steps.nil?
    invalid_properties.push('invalid value for "steps", steps cannot be nil.')
  end

  if @formats.nil?
    invalid_properties.push('invalid value for "formats", formats cannot be nil.')
  end

  if @outputs.nil?
    invalid_properties.push('invalid value for "outputs", outputs cannot be nil.')
  end

  if @max_files.nil?
    invalid_properties.push('invalid value for "max_files", max_files cannot be nil.')
  end

  if @max_pages.nil?
    invalid_properties.push('invalid value for "max_pages", max_pages cannot be nil.')
  end

  if @max_parallel_jobs.nil?
    invalid_properties.push('invalid value for "max_parallel_jobs", max_parallel_jobs cannot be nil.')
  end

  if @max_file_size.nil?
    invalid_properties.push('invalid value for "max_file_size", max_file_size cannot be nil.')
  end

  if @accepted_mime_types.nil?
    invalid_properties.push('invalid value for "accepted_mime_types", accepted_mime_types cannot be nil.')
  end

  if @accepted_extensions.nil?
    invalid_properties.push('invalid value for "accepted_extensions", accepted_extensions cannot be nil.')
  end

  if @locales.nil?
    invalid_properties.push('invalid value for "locales", locales cannot be nil.')
  end

  if @locales_details.nil?
    invalid_properties.push('invalid value for "locales_details", locales_details 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



464
465
466
467
468
469
470
471
472
473
474
475
476
# File 'lib/flat_api/models/omr_capabilities.rb', line 464

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



280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/flat_api/models/omr_capabilities.rb', line 280

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @steps.nil?
  return false if @formats.nil?
  return false if @outputs.nil?
  return false if @max_files.nil?
  return false if @max_pages.nil?
  return false if @max_parallel_jobs.nil?
  return false if @max_file_size.nil?
  return false if @accepted_mime_types.nil?
  return false if @accepted_extensions.nil?
  return false if @locales.nil?
  return false if @locales_details.nil?
  true
end