Class: Bitmovin::Encoding::Encodings::InputStreams::Trimming::TimeBased
- Inherits:
-
Resource
- Object
- Resource
- Bitmovin::Encoding::Encodings::InputStreams::Trimming::TimeBased
- Defined in:
- lib/bitmovin/encoding/encodings/input_streams/trimming/time_based.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#description ⇒ Object
Returns the value of attribute description.
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#encoding_id ⇒ Object
Returns the value of attribute encoding_id.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#input_stream_id ⇒ Object
Returns the value of attribute input_stream_id.
-
#modified_at ⇒ Object
Returns the value of attribute modified_at.
-
#name ⇒ Object
Returns the value of attribute name.
-
#offset ⇒ Object
Returns the value of attribute offset.
Attributes inherited from Resource
Instance Method Summary collapse
-
#initialize(encoding_id, hash = {}) ⇒ TimeBased
constructor
A new instance of TimeBased.
- #invalid? ⇒ Boolean
- #save! ⇒ Object
- #valid? ⇒ Boolean
- #validate! ⇒ Object
Methods inherited from Resource
#delete!, find, init, #init_instance, #inspect, list, #persisted?
Methods included from Helpers
#camelize_hash, #hash_to_struct, result, #result, #underscore_hash
Constructor Details
#initialize(encoding_id, hash = {}) ⇒ TimeBased
Returns a new instance of TimeBased.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/bitmovin/encoding/encodings/input_streams/trimming/time_based.rb', line 8 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/trimming/time-based")) super(hash) @offset = hash[:offset] @duration = hash[:duration] @input_stream_id = hash[:input_stream_id] @errors = [] end |
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
5 6 7 |
# File 'lib/bitmovin/encoding/encodings/input_streams/trimming/time_based.rb', line 5 def created_at @created_at end |
#description ⇒ Object
Returns the value of attribute description.
5 6 7 |
# File 'lib/bitmovin/encoding/encodings/input_streams/trimming/time_based.rb', line 5 def description @description end |
#duration ⇒ Object
Returns the value of attribute duration.
5 6 7 |
# File 'lib/bitmovin/encoding/encodings/input_streams/trimming/time_based.rb', line 5 def duration @duration end |
#encoding_id ⇒ Object
Returns the value of attribute encoding_id.
5 6 7 |
# File 'lib/bitmovin/encoding/encodings/input_streams/trimming/time_based.rb', line 5 def encoding_id @encoding_id end |
#errors ⇒ Object
Returns the value of attribute errors.
5 6 7 |
# File 'lib/bitmovin/encoding/encodings/input_streams/trimming/time_based.rb', line 5 def errors @errors end |
#input_stream_id ⇒ Object
Returns the value of attribute input_stream_id.
5 6 7 |
# File 'lib/bitmovin/encoding/encodings/input_streams/trimming/time_based.rb', line 5 def input_stream_id @input_stream_id end |
#modified_at ⇒ Object
Returns the value of attribute modified_at.
5 6 7 |
# File 'lib/bitmovin/encoding/encodings/input_streams/trimming/time_based.rb', line 5 def modified_at @modified_at end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/bitmovin/encoding/encodings/input_streams/trimming/time_based.rb', line 5 def name @name end |
#offset ⇒ Object
Returns the value of attribute offset.
5 6 7 |
# File 'lib/bitmovin/encoding/encodings/input_streams/trimming/time_based.rb', line 5 def offset @offset end |
Instance Method Details
#invalid? ⇒ Boolean
26 27 28 |
# File 'lib/bitmovin/encoding/encodings/input_streams/trimming/time_based.rb', line 26 def invalid? !valid? end |
#save! ⇒ Object
22 23 24 |
# File 'lib/bitmovin/encoding/encodings/input_streams/trimming/time_based.rb', line 22 def save! super if valid? end |
#valid? ⇒ Boolean
30 31 32 33 |
# File 'lib/bitmovin/encoding/encodings/input_streams/trimming/time_based.rb', line 30 def valid? validate! @errors.empty? end |
#validate! ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/bitmovin/encoding/encodings/input_streams/trimming/time_based.rb', line 35 def validate! @errors = [] @errors << "Input Stream Id must be set" unless @input_stream_id @errors << "Offset must be set" unless @offset @errors << "Duration must be set" unless @duration @errors << "Duration must be greater than zero" if @duration.to_i <= 0 @errors.flatten! end |