Class: Bitmovin::Encoding::Encodings::EncodingTask

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

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

Methods included from Helpers

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

Constructor Details

#initialize(hash = {}) ⇒ EncodingTask

Returns a new instance of EncodingTask.



5
6
7
8
9
# File 'lib/bitmovin/encoding/encodings/encoding_task.rb', line 5

def initialize(hash = {})
  super(hash)
  @stream_list = StreamList.new(@id)
  @muxing_list = MuxingList.new(@id)
end

Instance Attribute Details

#cloud_regionObject

Returns the value of attribute cloud_region.



13
14
15
# File 'lib/bitmovin/encoding/encodings/encoding_task.rb', line 13

def cloud_region
  @cloud_region
end

#created_atObject

Returns the value of attribute created_at.



12
13
14
# File 'lib/bitmovin/encoding/encodings/encoding_task.rb', line 12

def created_at
  @created_at
end

#descriptionObject

Returns the value of attribute description.



11
12
13
# File 'lib/bitmovin/encoding/encodings/encoding_task.rb', line 11

def description
  @description
end

#encoder_versionObject

Returns the value of attribute encoder_version.



13
14
15
# File 'lib/bitmovin/encoding/encodings/encoding_task.rb', line 13

def encoder_version
  @encoder_version
end

#idObject

Returns the value of attribute id.



11
12
13
# File 'lib/bitmovin/encoding/encodings/encoding_task.rb', line 11

def id
  @id
end

#infrastructure_idObject

Returns the value of attribute infrastructure_id.



13
14
15
# File 'lib/bitmovin/encoding/encodings/encoding_task.rb', line 13

def infrastructure_id
  @infrastructure_id
end

#modified_atObject

Returns the value of attribute modified_at.



12
13
14
# File 'lib/bitmovin/encoding/encodings/encoding_task.rb', line 12

def modified_at
  @modified_at
end

#nameObject

Returns the value of attribute name.



11
12
13
# File 'lib/bitmovin/encoding/encodings/encoding_task.rb', line 11

def name
  @name
end

#statusObject

Returns the value of attribute status.



13
14
15
# File 'lib/bitmovin/encoding/encodings/encoding_task.rb', line 13

def status
  @status
end

#typeObject

Returns the value of attribute type.



13
14
15
# File 'lib/bitmovin/encoding/encodings/encoding_task.rb', line 13

def type
  @type
end

Class Method Details

.list(limit = 100, offset = 0) ⇒ Object



60
61
62
63
64
65
# File 'lib/bitmovin/encoding/encodings/encoding_task.rb', line 60

def self.list(limit = 100, offset = 0)
  response = Bitmovin.client.get("/v1/encoding/encodings", { limit: limit, offset: offset })
  Bitmovin::Helpers.result(response)['items'].map do |item|
    EncodingTask.new(item)
  end
end

Instance Method Details

#full_statusObject



46
47
48
49
50
# File 'lib/bitmovin/encoding/encodings/encoding_task.rb', line 46

def full_status
  path = File.join("/v1/encoding/encodings/", @id, "status")
  response = Bitmovin.client.get(path)
  hash_to_struct(result(response))
end

#ignore_fieldsObject



31
32
33
# File 'lib/bitmovin/encoding/encodings/encoding_task.rb', line 31

def ignore_fields
  [:@stream_list, :@muxing_list]
end

#live?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/bitmovin/encoding/encodings/encoding_task.rb', line 15

def live?
  type == "LIVE"
end

#muxingsObject



27
28
29
# File 'lib/bitmovin/encoding/encodings/encoding_task.rb', line 27

def muxings
  @muxing_list
end

#progressObject



56
57
58
# File 'lib/bitmovin/encoding/encodings/encoding_task.rb', line 56

def progress
  full_status.progress
end

#save!Object



35
36
37
38
39
# File 'lib/bitmovin/encoding/encodings/encoding_task.rb', line 35

def save!
  super
  @stream_list = StreamList.new(@id)
  @muxing_list = MuxingList.new(@id)
end

#start!(hsh = {}) ⇒ Object



41
42
43
44
# File 'lib/bitmovin/encoding/encodings/encoding_task.rb', line 41

def start!(hsh = {})
  path = File.join("/v1/encoding/encodings/", @id, "start")
  Bitmovin.client.post(path, camelize_hash(hsh))
end

#streamsObject



23
24
25
# File 'lib/bitmovin/encoding/encodings/encoding_task.rb', line 23

def streams
  @stream_list
end

#vod?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/bitmovin/encoding/encodings/encoding_task.rb', line 19

def vod?
  type == "VOD"
end