Class: Bitmovin::Encoding::Manifests::List

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/bitmovin/encoding/manifests/list.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers

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

Constructor Details

#initialize(manifest_id) ⇒ List

Returns a new instance of List.



15
16
17
# File 'lib/bitmovin/encoding/manifests/list.rb', line 15

def initialize(manifest_id)
  @manifest_id = manifest_id
end

Class Attribute Details

.klassObject (readonly)

Returns the value of attribute klass.



11
12
13
# File 'lib/bitmovin/encoding/manifests/list.rb', line 11

def klass
  @klass
end

.resource_pathObject (readonly)

Returns the value of attribute resource_path.



10
11
12
# File 'lib/bitmovin/encoding/manifests/list.rb', line 10

def resource_path
  @resource_path
end

Instance Attribute Details

#manifest_idObject

Returns the value of attribute manifest_id.



14
15
16
# File 'lib/bitmovin/encoding/manifests/list.rb', line 14

def manifest_id
  @manifest_id
end

Class Method Details

.init(path, klass) ⇒ Object



6
7
8
9
# File 'lib/bitmovin/encoding/manifests/list.rb', line 6

def init(path, klass)
  @resource_path = path
  @klass = klass
end

Instance Method Details

#add(stream) ⇒ Object



25
26
27
# File 'lib/bitmovin/encoding/manifests/list.rb', line 25

def add(stream)
  raise "Not implemented yet. Please use #build and Stream#save! for the time being"
end

#build(hash = {}) ⇒ Object



29
30
31
# File 'lib/bitmovin/encoding/manifests/list.rb', line 29

def build(hash = {})
  self.class.klass.new(@manifest_id, hash)
end

#find(id) ⇒ Object



33
34
35
36
37
# File 'lib/bitmovin/encoding/manifests/list.rb', line 33

def find(id)
  path = File.join("/v1/encoding/manifests/", @manifest_id, self.class.resource_path, id)
  response = Bitmovin.client.get(path)
  self.class.klass.new(@manifest_id, result(response))
end

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



19
20
21
22
23
# File 'lib/bitmovin/encoding/manifests/list.rb', line 19

def list(limit = 100, offset = 0)
  path = File.join("/v1/encoding/manifest/", @manifest_id, self.class.resource_path)
  response = Bitmovin.client.get(path, { limit: limit, offset: offset })
  result(response)['items'].map { |item| self.class.klass.new(@encoding_id, item) }
end