Class: Aimastering::Mastering

Inherits:
Object
  • Object
show all
Defined in:
lib/aimastering/models/mastering.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Mastering

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
277
278
279
280
281
282
283
284
# File 'lib/aimastering/models/mastering.rb', line 166

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}

  if attributes.has_key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.has_key?(:'user_id')
    self.user_id = attributes[:'user_id']
  end

  if attributes.has_key?(:'input_audio_id')
    self.input_audio_id = attributes[:'input_audio_id']
  end

  if attributes.has_key?(:'output_audio_id')
    self.output_audio_id = attributes[:'output_audio_id']
  end

  if attributes.has_key?(:'output_video_id')
    self.output_video_id = attributes[:'output_video_id']
  end

  if attributes.has_key?(:'reference_audio_id')
    self.reference_audio_id = attributes[:'reference_audio_id']
  end

  if attributes.has_key?(:'mode')
    self.mode = attributes[:'mode']
  end

  if attributes.has_key?(:'status')
    self.status = attributes[:'status']
  end

  if attributes.has_key?(:'failure_reason')
    self.failure_reason = attributes[:'failure_reason']
  end

  if attributes.has_key?(:'target_loudness')
    self.target_loudness = attributes[:'target_loudness']
  end

  if attributes.has_key?(:'output_format')
    self.output_format = attributes[:'output_format']
  end

  if attributes.has_key?(:'preset')
    self.preset = attributes[:'preset']
  end

  if attributes.has_key?(:'bit_depth')
    self.bit_depth = attributes[:'bit_depth']
  end

  if attributes.has_key?(:'sample_rate')
    self.sample_rate = attributes[:'sample_rate']
  end

  if attributes.has_key?(:'review_comment')
    self.review_comment = attributes[:'review_comment']
  end

  if attributes.has_key?(:'review_score')
    self.review_score = attributes[:'review_score']
  end

  if attributes.has_key?(:'mastering_matching_level')
    self.mastering_matching_level = attributes[:'mastering_matching_level']
  end

  if attributes.has_key?(:'progression')
    self.progression = attributes[:'progression']
  end

  if attributes.has_key?(:'bass_preservation')
    self.bass_preservation = attributes[:'bass_preservation']
  end

  if attributes.has_key?(:'mastering')
    self.mastering = attributes[:'mastering']
  end

  if attributes.has_key?(:'retry_count')
    self.retry_count = attributes[:'retry_count']
  end

  if attributes.has_key?(:'mastering_reverb')
    self.mastering_reverb = attributes[:'mastering_reverb']
  end

  if attributes.has_key?(:'mastering_reverb_gain')
    self.mastering_reverb_gain = attributes[:'mastering_reverb_gain']
  end

  if attributes.has_key?(:'low_cut_freq')
    self.low_cut_freq = attributes[:'low_cut_freq']
  end

  if attributes.has_key?(:'high_cut_freq')
    self.high_cut_freq = attributes[:'high_cut_freq']
  end

  if attributes.has_key?(:'expire_at')
    self.expire_at = attributes[:'expire_at']
  end

  if attributes.has_key?(:'created_at')
    self.created_at = attributes[:'created_at']
  end

  if attributes.has_key?(:'updated_at')
    self.updated_at = attributes[:'updated_at']
  end

end

Instance Attribute Details

#bass_preservationObject

Returns the value of attribute bass_preservation.



54
55
56
# File 'lib/aimastering/models/mastering.rb', line 54

def bass_preservation
  @bass_preservation
end

#bit_depthObject

Returns the value of attribute bit_depth.



42
43
44
# File 'lib/aimastering/models/mastering.rb', line 42

def bit_depth
  @bit_depth
end

#created_atObject

Returns the value of attribute created_at.



70
71
72
# File 'lib/aimastering/models/mastering.rb', line 70

def created_at
  @created_at
end

#expire_atObject

Returns the value of attribute expire_at.



68
69
70
# File 'lib/aimastering/models/mastering.rb', line 68

def expire_at
  @expire_at
end

#failure_reasonObject

Returns the value of attribute failure_reason.



34
35
36
# File 'lib/aimastering/models/mastering.rb', line 34

def failure_reason
  @failure_reason
end

#high_cut_freqObject

Returns the value of attribute high_cut_freq.



66
67
68
# File 'lib/aimastering/models/mastering.rb', line 66

def high_cut_freq
  @high_cut_freq
end

#idObject

Returns the value of attribute id.



18
19
20
# File 'lib/aimastering/models/mastering.rb', line 18

def id
  @id
end

#input_audio_idObject

Returns the value of attribute input_audio_id.



22
23
24
# File 'lib/aimastering/models/mastering.rb', line 22

def input_audio_id
  @input_audio_id
end

#low_cut_freqObject

Returns the value of attribute low_cut_freq.



64
65
66
# File 'lib/aimastering/models/mastering.rb', line 64

def low_cut_freq
  @low_cut_freq
end

#masteringObject

Returns the value of attribute mastering.



56
57
58
# File 'lib/aimastering/models/mastering.rb', line 56

def mastering
  @mastering
end

#mastering_matching_levelObject

Returns the value of attribute mastering_matching_level.



50
51
52
# File 'lib/aimastering/models/mastering.rb', line 50

def mastering_matching_level
  @mastering_matching_level
end

#mastering_reverbObject

Returns the value of attribute mastering_reverb.



60
61
62
# File 'lib/aimastering/models/mastering.rb', line 60

def mastering_reverb
  @mastering_reverb
end

#mastering_reverb_gainObject

Returns the value of attribute mastering_reverb_gain.



62
63
64
# File 'lib/aimastering/models/mastering.rb', line 62

def mastering_reverb_gain
  @mastering_reverb_gain
end

#modeObject

Returns the value of attribute mode.



30
31
32
# File 'lib/aimastering/models/mastering.rb', line 30

def mode
  @mode
end

#output_audio_idObject

Returns the value of attribute output_audio_id.



24
25
26
# File 'lib/aimastering/models/mastering.rb', line 24

def output_audio_id
  @output_audio_id
end

#output_formatObject

Returns the value of attribute output_format.



38
39
40
# File 'lib/aimastering/models/mastering.rb', line 38

def output_format
  @output_format
end

#output_video_idObject

Returns the value of attribute output_video_id.



26
27
28
# File 'lib/aimastering/models/mastering.rb', line 26

def output_video_id
  @output_video_id
end

#presetObject

Returns the value of attribute preset.



40
41
42
# File 'lib/aimastering/models/mastering.rb', line 40

def preset
  @preset
end

#progressionObject

Returns the value of attribute progression.



52
53
54
# File 'lib/aimastering/models/mastering.rb', line 52

def progression
  @progression
end

#reference_audio_idObject

Returns the value of attribute reference_audio_id.



28
29
30
# File 'lib/aimastering/models/mastering.rb', line 28

def reference_audio_id
  @reference_audio_id
end

#retry_countObject

Returns the value of attribute retry_count.



58
59
60
# File 'lib/aimastering/models/mastering.rb', line 58

def retry_count
  @retry_count
end

#review_commentObject

Returns the value of attribute review_comment.



46
47
48
# File 'lib/aimastering/models/mastering.rb', line 46

def review_comment
  @review_comment
end

#review_scoreObject

Returns the value of attribute review_score.



48
49
50
# File 'lib/aimastering/models/mastering.rb', line 48

def review_score
  @review_score
end

#sample_rateObject

Returns the value of attribute sample_rate.



44
45
46
# File 'lib/aimastering/models/mastering.rb', line 44

def sample_rate
  @sample_rate
end

#statusObject

Returns the value of attribute status.



32
33
34
# File 'lib/aimastering/models/mastering.rb', line 32

def status
  @status
end

#target_loudnessObject

Returns the value of attribute target_loudness.



36
37
38
# File 'lib/aimastering/models/mastering.rb', line 36

def target_loudness
  @target_loudness
end

#updated_atObject

Returns the value of attribute updated_at.



72
73
74
# File 'lib/aimastering/models/mastering.rb', line 72

def updated_at
  @updated_at
end

#user_idObject

Returns the value of attribute user_id.



20
21
22
# File 'lib/aimastering/models/mastering.rb', line 20

def user_id
  @user_id
end

Class Method Details

.attribute_mapObject

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



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
125
126
127
128
# File 'lib/aimastering/models/mastering.rb', line 97

def self.attribute_map
  {
    :'id' => :'id',
    :'user_id' => :'user_id',
    :'input_audio_id' => :'input_audio_id',
    :'output_audio_id' => :'output_audio_id',
    :'output_video_id' => :'output_video_id',
    :'reference_audio_id' => :'reference_audio_id',
    :'mode' => :'mode',
    :'status' => :'status',
    :'failure_reason' => :'failure_reason',
    :'target_loudness' => :'target_loudness',
    :'output_format' => :'output_format',
    :'preset' => :'preset',
    :'bit_depth' => :'bit_depth',
    :'sample_rate' => :'sample_rate',
    :'review_comment' => :'review_comment',
    :'review_score' => :'review_score',
    :'mastering_matching_level' => :'mastering_matching_level',
    :'progression' => :'progression',
    :'bass_preservation' => :'bass_preservation',
    :'mastering' => :'mastering',
    :'retry_count' => :'retry_count',
    :'mastering_reverb' => :'mastering_reverb',
    :'mastering_reverb_gain' => :'mastering_reverb_gain',
    :'low_cut_freq' => :'low_cut_freq',
    :'high_cut_freq' => :'high_cut_freq',
    :'expire_at' => :'expire_at',
    :'created_at' => :'created_at',
    :'updated_at' => :'updated_at'
  }
end

.swagger_typesObject

Attribute type mapping.



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
# File 'lib/aimastering/models/mastering.rb', line 131

def self.swagger_types
  {
    :'id' => :'Integer',
    :'user_id' => :'Integer',
    :'input_audio_id' => :'Integer',
    :'output_audio_id' => :'Integer',
    :'output_video_id' => :'Integer',
    :'reference_audio_id' => :'Integer',
    :'mode' => :'String',
    :'status' => :'String',
    :'failure_reason' => :'String',
    :'target_loudness' => :'Float',
    :'output_format' => :'String',
    :'preset' => :'String',
    :'bit_depth' => :'Integer',
    :'sample_rate' => :'Integer',
    :'review_comment' => :'String',
    :'review_score' => :'Float',
    :'mastering_matching_level' => :'Float',
    :'progression' => :'Float',
    :'bass_preservation' => :'BOOLEAN',
    :'mastering' => :'BOOLEAN',
    :'retry_count' => :'Integer',
    :'mastering_reverb' => :'BOOLEAN',
    :'mastering_reverb_gain' => :'Float',
    :'low_cut_freq' => :'Float',
    :'high_cut_freq' => :'Float',
    :'expire_at' => :'DateTime',
    :'created_at' => :'DateTime',
    :'updated_at' => :'DateTime'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
# File 'lib/aimastering/models/mastering.rb', line 436

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      user_id == o.user_id &&
      input_audio_id == o.input_audio_id &&
      output_audio_id == o.output_audio_id &&
      output_video_id == o.output_video_id &&
      reference_audio_id == o.reference_audio_id &&
      mode == o.mode &&
      status == o.status &&
      failure_reason == o.failure_reason &&
      target_loudness == o.target_loudness &&
      output_format == o.output_format &&
      preset == o.preset &&
      bit_depth == o.bit_depth &&
      sample_rate == o.sample_rate &&
      review_comment == o.review_comment &&
      review_score == o.review_score &&
      mastering_matching_level == o.mastering_matching_level &&
      progression == o.progression &&
      bass_preservation == o.bass_preservation &&
      mastering == o.mastering &&
      retry_count == o.retry_count &&
      mastering_reverb == o.mastering_reverb &&
      mastering_reverb_gain == o.mastering_reverb_gain &&
      low_cut_freq == o.low_cut_freq &&
      high_cut_freq == o.high_cut_freq &&
      expire_at == o.expire_at &&
      created_at == o.created_at &&
      updated_at == o.updated_at
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
# File 'lib/aimastering/models/mastering.rb', line 505

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = Aimastering.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



571
572
573
574
575
576
577
578
579
580
581
582
583
# File 'lib/aimastering/models/mastering.rb', line 571

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map{ |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
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



484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
# File 'lib/aimastering/models/mastering.rb', line 484

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/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)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(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?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


471
472
473
# File 'lib/aimastering/models/mastering.rb', line 471

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



477
478
479
# File 'lib/aimastering/models/mastering.rb', line 477

def hash
  [id, user_id, input_audio_id, output_audio_id, output_video_id, reference_audio_id, mode, status, failure_reason, target_loudness, output_format, preset, bit_depth, sample_rate, review_comment, review_score, mastering_matching_level, progression, bass_preservation, mastering, retry_count, mastering_reverb, mastering_reverb_gain, low_cut_freq, high_cut_freq, expire_at, created_at, updated_at].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/aimastering/models/mastering.rb', line 288

def list_invalid_properties
  invalid_properties = Array.new
  if !@review_score.nil? && @review_score > 1
    invalid_properties.push("invalid value for 'review_score', must be smaller than or equal to 1.")
  end

  if !@review_score.nil? && @review_score < 0
    invalid_properties.push("invalid value for 'review_score', must be greater than or equal to 0.")
  end

  if !@mastering_matching_level.nil? && @mastering_matching_level > 1
    invalid_properties.push("invalid value for 'mastering_matching_level', must be smaller than or equal to 1.")
  end

  if !@mastering_matching_level.nil? && @mastering_matching_level < 0
    invalid_properties.push("invalid value for 'mastering_matching_level', must be greater than or equal to 0.")
  end

  if !@progression.nil? && @progression > 1
    invalid_properties.push("invalid value for 'progression', must be smaller than or equal to 1.")
  end

  if !@progression.nil? && @progression < 0
    invalid_properties.push("invalid value for 'progression', must be greater than or equal to 0.")
  end

  return invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



551
552
553
# File 'lib/aimastering/models/mastering.rb', line 551

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



557
558
559
560
561
562
563
564
565
# File 'lib/aimastering/models/mastering.rb', line 557

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



545
546
547
# File 'lib/aimastering/models/mastering.rb', line 545

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



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

def valid?
  mode_validator = EnumAttributeValidator.new('String', ["default", "custom", "preset"])
  return false unless mode_validator.valid?(@mode)
  status_validator = EnumAttributeValidator.new('String', ["waiting", "processing", "canceled", "failed", "succeeded"])
  return false unless status_validator.valid?(@status)
  failure_reason_validator = EnumAttributeValidator.new('String', ["unknown", "expired", "failed_to_prepare", "job_queue"])
  return false unless failure_reason_validator.valid?(@failure_reason)
  output_format_validator = EnumAttributeValidator.new('String', ["wav", "mp3"])
  return false unless output_format_validator.valid?(@output_format)
  preset_validator = EnumAttributeValidator.new('String', ["general", "pop", "jazz", "classical"])
  return false unless preset_validator.valid?(@preset)
  return false if !@review_score.nil? && @review_score > 1
  return false if !@review_score.nil? && @review_score < 0
  return false if !@mastering_matching_level.nil? && @mastering_matching_level > 1
  return false if !@mastering_matching_level.nil? && @mastering_matching_level < 0
  return false if !@progression.nil? && @progression > 1
  return false if !@progression.nil? && @progression < 0
  return true
end