class Aimastering::AnonymizedMastering

Attributes

bit_depth[RW]
created_at[RW]
failure_reason[RW]
high_cut_freq[RW]
low_cut_freq[RW]
mastering[RW]
mastering_matching_level[RW]
mastering_reverb[RW]
mastering_reverb_gain[RW]
mode[RW]
output_format[RW]
paid[RW]
payment_service[RW]
preset[RW]
retry_count[RW]
review_score[RW]
sample_rate[RW]
status[RW]
target_loudness[RW]
updated_at[RW]
user_auth_provider[RW]
user_id[RW]

Public Class Methods

attribute_map() click to toggle source

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

# 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
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# 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
swagger_types() click to toggle source

Attribute type mapping.

# 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

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# 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) click to toggle source

Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data

# 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) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# 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) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# 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) click to toggle source

@see the `==` method @param [Object] Object to be compared

# File lib/aimastering/models/anonymized_mastering.rb, line 404
def eql?(o)
  self == o
end
failure_reason=(failure_reason) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] failure_reason Object to be assigned

# File lib/aimastering/models/anonymized_mastering.rb, line 305
def failure_reason=(failure_reason)
  validator = EnumAttributeValidator.new('String', ["unknown", "expired", "failed_to_prepare"])
  unless validator.valid?(failure_reason)
    fail ArgumentError, "invalid value for 'failure_reason', must be one of #{validator.allowable_values}."
  end
  @failure_reason = failure_reason
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Fixnum] Hash code

# 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_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons

# 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
mastering_matching_level=(mastering_matching_level) click to toggle source

Custom attribute writer method with validation @param [Object] mastering_matching_level Value to be assigned

# File lib/aimastering/models/anonymized_mastering.rb, line 350
def mastering_matching_level=(mastering_matching_level)

  if !mastering_matching_level.nil? && mastering_matching_level > 1
    fail ArgumentError, "invalid value for 'mastering_matching_level', must be smaller than or equal to 1."
  end

  if !mastering_matching_level.nil? && mastering_matching_level < 0
    fail ArgumentError, "invalid value for 'mastering_matching_level', must be greater than or equal to 0."
  end

  @mastering_matching_level = mastering_matching_level
end
mode=(mode) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] mode Object to be assigned

# File lib/aimastering/models/anonymized_mastering.rb, line 285
def mode=(mode)
  validator = EnumAttributeValidator.new('String', ["default", "custom"])
  unless validator.valid?(mode)
    fail ArgumentError, "invalid value for 'mode', must be one of #{validator.allowable_values}."
  end
  @mode = mode
end
output_format=(output_format) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] output_format Object to be assigned

# File lib/aimastering/models/anonymized_mastering.rb, line 315
def output_format=(output_format)
  validator = EnumAttributeValidator.new('String', ["wav", "mp3"])
  unless validator.valid?(output_format)
    fail ArgumentError, "invalid value for 'output_format', must be one of #{validator.allowable_values}."
  end
  @output_format = output_format
end
payment_service=(payment_service) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] payment_service Object to be assigned

# File lib/aimastering/models/anonymized_mastering.rb, line 365
def payment_service=(payment_service)
  validator = EnumAttributeValidator.new('String', ["paypal", "stripe"])
  unless validator.valid?(payment_service)
    fail ArgumentError, "invalid value for 'payment_service', must be one of #{validator.allowable_values}."
  end
  @payment_service = payment_service
end
preset=(preset) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] preset Object to be assigned

# File lib/aimastering/models/anonymized_mastering.rb, line 325
def preset=(preset)
  validator = EnumAttributeValidator.new('String', ["general", "pop", "jazz", "classical"])
  unless validator.valid?(preset)
    fail ArgumentError, "invalid value for 'preset', must be one of #{validator.allowable_values}."
  end
  @preset = preset
end
review_score=(review_score) click to toggle source

Custom attribute writer method with validation @param [Object] review_score Value to be assigned

# File lib/aimastering/models/anonymized_mastering.rb, line 335
def review_score=(review_score)

  if !review_score.nil? && review_score > 1
    fail ArgumentError, "invalid value for 'review_score', must be smaller than or equal to 1."
  end

  if !review_score.nil? && review_score < 0
    fail ArgumentError, "invalid value for 'review_score', must be greater than or equal to 0."
  end

  @review_score = review_score
end
status=(status) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] status Object to be assigned

# File lib/aimastering/models/anonymized_mastering.rb, line 295
def status=(status)
  validator = EnumAttributeValidator.new('String', ["waiting", "processing", "canceled", "failed", "succeeded"])
  unless validator.valid?(status)
    fail ArgumentError, "invalid value for 'status', must be one of #{validator.allowable_values}."
  end
  @status = status
end
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/aimastering/models/anonymized_mastering.rb, line 484
def to_body
  to_hash
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# 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_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/aimastering/models/anonymized_mastering.rb, line 478
def to_s
  to_hash.to_s
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# File lib/aimastering/models/anonymized_mastering.rb, line 263
def valid?
  mode_validator = EnumAttributeValidator.new('String', ["default", "custom"])
  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"])
  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