Sha256: f3346a765a79e5f236bfe352dd7c061b2bb46dd3903573038addb9ba742bada7

Contents?: true

Size: 1.41 KB

Versions: 11

Compression:

Stored size: 1.41 KB

Contents

module Bitmovin::Encoding::Manifests
  class DashManifest < Bitmovin::Resource
    include Bitmovin::ChildCollection
    init("/v1/encoding/manifests/dash")

    def initialize(hash = {})
      hsh = ActiveSupport::HashWithIndifferentAccess.new(underscore_hash(hash))
      super(hash)
      @outputs = (hsh[:outputs] || []).map { |output| Bitmovin::Encoding::StreamOutput.new(output) }
      @periods = nil
    end

    child_collection(:periods, "/v1/encoding/manifests/dash/%s/periods", [:id], Bitmovin::Encoding::Manifests::Period)

    attr_accessor :outputs, :manifest_name

    def persisted?
      !@id.nil?
    end

    def reload!
      @periods = nil
    end

    def start!
      path = File.join("/v1/encoding/manifests/dash/", @id, "start")
      Bitmovin.client.post(path)
    end

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

    def status
      full_status.status
    end

    def progress
      full_status.progress
    end

    private

    def collect_attributes
      val = Hash.new
      [:name, :description, :manifest_name].each do |name|
        json_name = ActiveSupport::Inflector.camelize(name.to_s, false)
        val[json_name] = instance_variable_get("@#{name}")
      end
      val["outputs"] = @outputs.map { |o| o.send(:collect_attributes) }
      val
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
bitmovin-ruby-0.9.1 lib/bitmovin/encoding/manifests/dash_manifest.rb
bitmovin-ruby-0.9.0 lib/bitmovin/encoding/manifests/dash_manifest.rb
bitmovin-ruby-0.8.1 lib/bitmovin/encoding/manifests/dash_manifest.rb
bitmovin-ruby-0.8.0 lib/bitmovin/encoding/manifests/dash_manifest.rb
bitmovin-ruby-0.7.0 lib/bitmovin/encoding/manifests/dash_manifest.rb
bitmovin-ruby-0.5.0 lib/bitmovin/encoding/manifests/dash_manifest.rb
bitmovin-ruby-0.4.0 lib/bitmovin/encoding/manifests/dash_manifest.rb
bitmovin-ruby-0.3.0 lib/bitmovin/encoding/manifests/dash_manifest.rb
bitmovin-ruby-0.2.0 lib/bitmovin/encoding/manifests/dash_manifest.rb
bitmovin-ruby-0.1.1 lib/bitmovin/encoding/manifests/dash_manifest.rb
bitmovin-ruby-0.1.0 lib/bitmovin/encoding/manifests/dash_manifest.rb