Class: Aimastering::AnonymizedMastering

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AnonymizedMastering

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
225
226
227
228
229
230
231
232
233
234
235
236
# File 'lib/aimastering/models/anonymized_mastering.rb', line 142

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?(:'user_id')
    self.user_id = attributes[:'user_id']
  end

  if attributes.has_key?(:'user_auth_provider')
    self.user_auth_provider = attributes[:'user_auth_provider']
  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_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?(:'mastering')
    self.mastering = attributes[:'mastering']
  end

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

  if attributes.has_key?(:'payment_service')
    self.payment_service = attributes[:'payment_service']
  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?(:'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

#bit_depthObject

Returns the value of attribute bit_depth.



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

def bit_depth
  @bit_depth
end

#created_atObject

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#failure_reasonObject

Returns the value of attribute failure_reason.



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

def failure_reason
  @failure_reason
end

#high_cut_freqObject

Returns the value of attribute high_cut_freq.



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

def high_cut_freq
  @high_cut_freq
end

#low_cut_freqObject

Returns the value of attribute low_cut_freq.



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

def low_cut_freq
  @low_cut_freq
end

#masteringObject

Returns the value of attribute mastering.



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

def mastering
  @mastering
end

#mastering_matching_levelObject

Returns the value of attribute mastering_matching_level.



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

def mastering_matching_level
  @mastering_matching_level
end

#mastering_reverbObject

Returns the value of attribute mastering_reverb.



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

def mastering_reverb
  @mastering_reverb
end

#mastering_reverb_gainObject

Returns the value of attribute mastering_reverb_gain.



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

def mastering_reverb_gain
  @mastering_reverb_gain
end

#modeObject

Returns the value of attribute mode.



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

def mode
  @mode
end

#output_formatObject

Returns the value of attribute output_format.



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

def output_format
  @output_format
end

Returns the value of attribute paid.



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

def paid
  @paid
end

#payment_serviceObject

Returns the value of attribute payment_service.



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

def payment_service
  @payment_service
end

#presetObject

Returns the value of attribute preset.



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

def preset
  @preset
end

#retry_countObject

Returns the value of attribute retry_count.



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

def retry_count
  @retry_count
end

#review_scoreObject

Returns the value of attribute review_score.



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

def review_score
  @review_score
end

#sample_rateObject

Returns the value of attribute sample_rate.



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

def sample_rate
  @sample_rate
end

#statusObject

Returns the value of attribute status.



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

def status
  @status
end

#target_loudnessObject

Returns the value of attribute target_loudness.



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

def target_loudness
  @target_loudness
end

#updated_atObject

Returns the value of attribute updated_at.



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

def updated_at
  @updated_at
end

#user_auth_providerObject

Returns the value of attribute user_auth_provider.



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

def user_auth_provider
  @user_auth_provider
end

#user_idObject

Returns the value of attribute user_id.



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

def user_id
  @user_id
end

Class Method Details

.attribute_mapObject

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



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/aimastering/models/anonymized_mastering.rb', line 85

def self.attribute_map
  {
    :'user_id' => :'user_id',
    :'user_auth_provider' => :'user_auth_provider',
    :'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_score' => :'review_score',
    :'mastering_matching_level' => :'mastering_matching_level',
    :'mastering' => :'mastering',
    :'paid' => :'paid',
    :'payment_service' => :'payment_service',
    :'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',
    :'created_at' => :'created_at',
    :'updated_at' => :'updated_at'
  }
end

.swagger_typesObject

Attribute type mapping.



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/aimastering/models/anonymized_mastering.rb', line 113

def self.swagger_types
  {
    :'user_id' => :'String',
    :'user_auth_provider' => :'String',
    :'mode' => :'String',
    :'status' => :'String',
    :'failure_reason' => :'String',
    :'target_loudness' => :'Float',
    :'output_format' => :'String',
    :'preset' => :'String',
    :'bit_depth' => :'Integer',
    :'sample_rate' => :'Integer',
    :'review_score' => :'Float',
    :'mastering_matching_level' => :'Float',
    :'mastering' => :'BOOLEAN',
    :'paid' => :'BOOLEAN',
    :'payment_service' => :'String',
    :'retry_count' => :'Integer',
    :'mastering_reverb' => :'BOOLEAN',
    :'mastering_reverb_gain' => :'Float',
    :'low_cut_freq' => :'Float',
    :'high_cut_freq' => :'Float',
    :'created_at' => :'DateTime',
    :'updated_at' => :'DateTime'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
# File 'lib/aimastering/models/anonymized_mastering.rb', line 375

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      user_id == o.user_id &&
      user_auth_provider == o.user_auth_provider &&
      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_score == o.review_score &&
      mastering_matching_level == o.mastering_matching_level &&
      mastering == o.mastering &&
      paid == o.paid &&
      payment_service == o.payment_service &&
      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 &&
      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



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
468
469
470
471
472
473
474
# File 'lib/aimastering/models/anonymized_mastering.rb', line 438

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



504
505
506
507
508
509
510
511
512
513
514
515
516
# File 'lib/aimastering/models/anonymized_mastering.rb', line 504

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



417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'lib/aimastering/models/anonymized_mastering.rb', line 417

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


404
405
406
# File 'lib/aimastering/models/anonymized_mastering.rb', line 404

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



410
411
412
# File 'lib/aimastering/models/anonymized_mastering.rb', line 410

def hash
  [user_id, user_auth_provider, mode, status, failure_reason, target_loudness, output_format, preset, bit_depth, sample_rate, review_score, mastering_matching_level, mastering, paid, payment_service, retry_count, mastering_reverb, mastering_reverb_gain, low_cut_freq, high_cut_freq, 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



240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/aimastering/models/anonymized_mastering.rb', line 240

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

  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



484
485
486
# File 'lib/aimastering/models/anonymized_mastering.rb', line 484

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



490
491
492
493
494
495
496
497
498
# File 'lib/aimastering/models/anonymized_mastering.rb', line 490

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



478
479
480
# File 'lib/aimastering/models/anonymized_mastering.rb', line 478

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



263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/aimastering/models/anonymized_mastering.rb', line 263

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
  payment_service_validator = EnumAttributeValidator.new('String', ["paypal", "stripe"])
  return false unless payment_service_validator.valid?(@payment_service)
  return true
end