class Aimastering::Mastering
Attributes
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/aimastering/models/mastering.rb, line 115 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_mode' => :'target_loudness_mode', :'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', :'mastering_algorithm' => :'mastering_algorithm', :'preserved' => :'preserved', :'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', :'ceiling' => :'ceiling', :'ceiling_mode' => :'ceiling_mode', :'oversample' => :'oversample', :'limiting_error' => :'limiting_error', :'video_title' => :'video_title', :'video_status' => :'video_status', :'expire_at' => :'expire_at', :'created_at' => :'created_at', :'updated_at' => :'updated_at' } end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/aimastering/models/mastering.rb, line 202 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_mode') self.target_loudness_mode = attributes[:'target_loudness_mode'] 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?(:'mastering_algorithm') self.mastering_algorithm = attributes[:'mastering_algorithm'] end if attributes.has_key?(:'preserved') self.preserved = attributes[:'preserved'] 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?(:'ceiling') self.ceiling = attributes[:'ceiling'] end if attributes.has_key?(:'ceiling_mode') self.ceiling_mode = attributes[:'ceiling_mode'] end if attributes.has_key?(:'oversample') self.oversample = attributes[:'oversample'] end if attributes.has_key?(:'limiting_error') self.limiting_error = attributes[:'limiting_error'] end if attributes.has_key?(:'video_title') self.video_title = attributes[:'video_title'] end if attributes.has_key?(:'video_status') self.video_status = attributes[:'video_status'] 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
Attribute type mapping.
# File lib/aimastering/models/mastering.rb, line 158 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_mode' => :'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', :'mastering_algorithm' => :'String', :'preserved' => :'BOOLEAN', :'retry_count' => :'Integer', :'mastering_reverb' => :'BOOLEAN', :'mastering_reverb_gain' => :'Float', :'low_cut_freq' => :'Float', :'high_cut_freq' => :'Float', :'ceiling' => :'Float', :'ceiling_mode' => :'String', :'oversample' => :'Integer', :'limiting_error' => :'Float', :'video_title' => :'String', :'video_status' => :'String', :'expire_at' => :'DateTime', :'created_at' => :'DateTime', :'updated_at' => :'DateTime' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/aimastering/models/mastering.rb, line 544 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_mode == o.target_loudness_mode && 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 && mastering_algorithm == o.mastering_algorithm && preserved == o.preserved && 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 && ceiling == o.ceiling && ceiling_mode == o.ceiling_mode && oversample == o.oversample && limiting_error == o.limiting_error && video_title == o.video_title && video_status == o.video_status && expire_at == o.expire_at && created_at == o.created_at && updated_at == o.updated_at end
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/mastering.rb, line 622 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
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/mastering.rb, line 688 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
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/mastering.rb, line 601 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
@see the `==` method @param [Object] Object to be compared
# File lib/aimastering/models/mastering.rb, line 588 def eql?(o) self == o end
Custom attribute writer method checking allowed values (enum). @param [Object] failure_reason
Object to be assigned
# File lib/aimastering/models/mastering.rb, line 439 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
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/aimastering/models/mastering.rb, line 594 def hash [id, user_id, input_audio_id, output_audio_id, output_video_id, reference_audio_id, mode, status, failure_reason, target_loudness_mode, target_loudness, output_format, preset, bit_depth, sample_rate, review_comment, review_score, mastering_matching_level, progression, bass_preservation, mastering, mastering_algorithm, preserved, retry_count, mastering_reverb, mastering_reverb_gain, low_cut_freq, high_cut_freq, ceiling, ceiling_mode, oversample, limiting_error, video_title, video_status, expire_at, created_at, updated_at].hash end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons
# File lib/aimastering/models/mastering.rb, line 360 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
Custom attribute writer method checking allowed values (enum). @param [Object] mastering_algorithm
Object to be assigned
# File lib/aimastering/models/mastering.rb, line 524 def mastering_algorithm=(mastering_algorithm) validator = EnumAttributeValidator.new('String', ["v1", "v2"]) unless validator.valid?(mastering_algorithm) fail ArgumentError, "invalid value for 'mastering_algorithm', must be one of #{validator.allowable_values}." end @mastering_algorithm = mastering_algorithm end
Custom attribute writer method with validation @param [Object] mastering_matching_level
Value to be assigned
# File lib/aimastering/models/mastering.rb, line 494 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
Custom attribute writer method checking allowed values (enum). @param [Object] mode Object to be assigned
# File lib/aimastering/models/mastering.rb, line 419 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
Custom attribute writer method checking allowed values (enum). @param [Object] output_format
Object to be assigned
# File lib/aimastering/models/mastering.rb, line 459 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
Custom attribute writer method checking allowed values (enum). @param [Object] preset Object to be assigned
# File lib/aimastering/models/mastering.rb, line 469 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
Custom attribute writer method with validation @param [Object] progression Value to be assigned
# File lib/aimastering/models/mastering.rb, line 509 def progression=(progression) if !progression.nil? && progression > 1 fail ArgumentError, "invalid value for 'progression', must be smaller than or equal to 1." end if !progression.nil? && progression < 0 fail ArgumentError, "invalid value for 'progression', must be greater than or equal to 0." end @progression = progression end
Custom attribute writer method with validation @param [Object] review_score
Value to be assigned
# File lib/aimastering/models/mastering.rb, line 479 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
Custom attribute writer method checking allowed values (enum). @param [Object] status Object to be assigned
# File lib/aimastering/models/mastering.rb, line 429 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
Custom attribute writer method checking allowed values (enum). @param [Object] target_loudness_mode
Object to be assigned
# File lib/aimastering/models/mastering.rb, line 449 def target_loudness_mode=(target_loudness_mode) validator = EnumAttributeValidator.new('String', ["loudness", "rms", "peak", "youtube_loudness"]) unless validator.valid?(target_loudness_mode) fail ArgumentError, "invalid value for 'target_loudness_mode', must be one of #{validator.allowable_values}." end @target_loudness_mode = target_loudness_mode end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/aimastering/models/mastering.rb, line 674 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
Returns the string representation of the object @return [String] String presentation of the object
# File lib/aimastering/models/mastering.rb, line 662 def to_s to_hash.to_s end
Check to see if the all the properties in the model are valid @return true if the model is valid
# File lib/aimastering/models/mastering.rb, line 391 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) target_loudness_mode_validator = EnumAttributeValidator.new('String', ["loudness", "rms", "peak", "youtube_loudness"]) return false unless target_loudness_mode_validator.valid?(@target_loudness_mode) 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 mastering_algorithm_validator = EnumAttributeValidator.new('String', ["v1", "v2"]) return false unless mastering_algorithm_validator.valid?(@mastering_algorithm) video_status_validator = EnumAttributeValidator.new('String', ["waiting", "failed", "succeeded"]) return false unless video_status_validator.valid?(@video_status) return true end
Custom attribute writer method checking allowed values (enum). @param [Object] video_status
Object to be assigned
# File lib/aimastering/models/mastering.rb, line 534 def video_status=(video_status) validator = EnumAttributeValidator.new('String', ["waiting", "failed", "succeeded"]) unless validator.valid?(video_status) fail ArgumentError, "invalid value for 'video_status', must be one of #{validator.allowable_values}." end @video_status = video_status end