Sha256: 04f148b6c5e1f5a11b0b8166529418eec32c7a13c6a514f3af6374ccca1fe6c7
Contents?: true
Size: 1.44 KB
Versions: 2
Compression:
Stored size: 1.44 KB
Contents
module Bitmovin::Encoding::Encodings class StreamInput def initialize(encoding_id, stream_id, hash) @errors = [] @encoding_id = encoding_id @stream_id = stream_id hash.each do |name, value| 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, :input_stream_id def valid? validate! @errors.empty? end def invalid? !valid? end def errors @errors end def to_json(args) collect_attributes.to_json(args) end private def collect_attributes val = Hash.new [: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 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bitmovin-ruby-0.9.1 | lib/bitmovin/encoding/encodings/stream_input.rb |
bitmovin-ruby-0.9.0 | lib/bitmovin/encoding/encodings/stream_input.rb |