Class: Bitmovin::Encoding::Encodings::InputStreams::Ingest

Inherits:
Resource
  • Object
show all
Defined in:
lib/bitmovin/encoding/encodings/input_streams/ingest.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#id

Instance Method Summary collapse

Methods inherited from Resource

#delete!, find, init, #init_instance, #inspect, list, #persisted?, #save!

Methods included from Helpers

#camelize_hash, #hash_to_struct, result, #result, #underscore_hash

Constructor Details

#initialize(encoding_id, hash = {}) ⇒ Ingest

Returns a new instance of Ingest.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/bitmovin/encoding/encodings/input_streams/ingest.rb', line 6

def initialize(encoding_id, hash = {})
  hsh = ActiveSupport::HashWithIndifferentAccess.new(underscore_hash(hash))
  @encoding_id = encoding_id

  init_instance(File.join("/v1/encoding/encodings/", encoding_id, "input-streams/ingest"))
  super(hash)

  @input_id = hash[:input_id]
  @input_path = hash[:input_path]
  @selection_mode = hash[:selection_mode]
  @position = hash[:position]

  @errors = []
end

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



3
4
5
# File 'lib/bitmovin/encoding/encodings/input_streams/ingest.rb', line 3

def created_at
  @created_at
end

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/bitmovin/encoding/encodings/input_streams/ingest.rb', line 3

def description
  @description
end

#encoding_idObject

Returns the value of attribute encoding_id.



3
4
5
# File 'lib/bitmovin/encoding/encodings/input_streams/ingest.rb', line 3

def encoding_id
  @encoding_id
end

#errorsObject

Returns the value of attribute errors.



3
4
5
# File 'lib/bitmovin/encoding/encodings/input_streams/ingest.rb', line 3

def errors
  @errors
end

#input_idObject

Returns the value of attribute input_id.



3
4
5
# File 'lib/bitmovin/encoding/encodings/input_streams/ingest.rb', line 3

def input_id
  @input_id
end

#input_pathObject

Returns the value of attribute input_path.



3
4
5
# File 'lib/bitmovin/encoding/encodings/input_streams/ingest.rb', line 3

def input_path
  @input_path
end

#modified_atObject

Returns the value of attribute modified_at.



3
4
5
# File 'lib/bitmovin/encoding/encodings/input_streams/ingest.rb', line 3

def modified_at
  @modified_at
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/bitmovin/encoding/encodings/input_streams/ingest.rb', line 3

def name
  @name
end

#positionObject

Returns the value of attribute position.



3
4
5
# File 'lib/bitmovin/encoding/encodings/input_streams/ingest.rb', line 3

def position
  @position
end

#selection_modeObject

Returns the value of attribute selection_mode.



3
4
5
# File 'lib/bitmovin/encoding/encodings/input_streams/ingest.rb', line 3

def selection_mode
  @selection_mode
end

Instance Method Details

#invalid?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/bitmovin/encoding/encodings/input_streams/ingest.rb', line 26

def invalid?
  !valid?
end

#valid?Boolean

Returns:

  • (Boolean)


21
22
23
24
# File 'lib/bitmovin/encoding/encodings/input_streams/ingest.rb', line 21

def valid?
  validate!
  @errors.empty?
end

#validate!Object



34
35
36
37
38
39
40
41
42
# File 'lib/bitmovin/encoding/encodings/input_streams/ingest.rb', line 34

def validate!
  @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?

  if @position.blank? && @selection_mode != "AUTO"
    @errors << "position cannot be blank if selection_mode is not AUTO"
  end
end