lib/bitmovin/encoding/encodings/stream_input.rb in bitmovin-ruby-0.8.1 vs lib/bitmovin/encoding/encodings/stream_input.rb in bitmovin-ruby-0.9.0

- old
+ new

@@ -8,11 +8,11 @@ instance_variable_set("@#{ActiveSupport::Inflector.underscore(name)}", value) end end attr_accessor :encoding_id, :stream_id - attr_accessor :input_id, :input_path, :selection_mode, :position + attr_accessor :input_id, :input_path, :selection_mode, :position, :input_stream_id def valid? validate! @errors.empty? end @@ -27,22 +27,24 @@ def to_json(args) collect_attributes.to_json(args) end - private + private def collect_attributes val = Hash.new - [:input_id, :input_path, :selection_mode, :position].each do |name| + [:input_id, :input_path, :selection_mode, :position, :input_stream_id].each do |name| json_name = ActiveSupport::Inflector.camelize(name.to_s, false) value = instance_variable_get("@#{name}") if (!value.nil?) val[json_name] = instance_variable_get("@#{name}") end end val end def validate! + return unless @input_stream_id.blank? + @errors << "input_id cannot be blank" if @input_id.blank? @errors << "input_path cannot be blank" if @input_path.blank? @errors << "selection_mode cannot be blank" if @selection_mode.blank? @errors << "position cannot be blank if selection_mode is not AUTO" if @position.blank? && @selection_mode != "AUTO" end