Sha256: 56ca43090021d9e23912e22cd3a234f3ed23e707e731f12b831a39d0474d3a53

Contents?: true

Size: 1.07 KB

Versions: 11

Compression:

Stored size: 1.07 KB

Contents

module Bitmovin::Encoding::Encodings
  class List
    include Bitmovin::Helpers

    class << self
      def init(path, klass)
        @resource_path = path
        @klass = klass
      end
      attr_reader :resource_path
      attr_reader :klass
    end

    attr_accessor :encoding_id
    def initialize(encoding_id)
      @encoding_id = encoding_id
    end

    def list(limit = 100, offset = 0)
      path = File.join("/v1/encoding/encodings/", @encoding_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

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

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

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

Version data entries

11 entries across 11 versions & 1 rubygems

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