Sha256: 128d9ee0ffa4e2a95251984f5ae31f97499a937cfb6d945f59c48eff9ebde0ff

Contents?: true

Size: 835 Bytes

Versions: 3

Compression:

Stored size: 835 Bytes

Contents

module ActiveEncode
  module EngineAdapters
    class TestAdapter
      def initialize
        @encodes = {}
      end

      def create(input_url, options = {})
        new_encode = ActiveEncode::Base.new(input_url, options)
        new_encode.id = SecureRandom.uuid
        new_encode.state = :running
        new_encode.created_at = Time.now
        new_encode.updated_at = Time.now
        @encodes[new_encode.id] = new_encode
        new_encode
      end

      def find(id, _opts = {})
        new_encode = @encodes[id]
        # Update the updated_at time to simulate changes
        new_encode.updated_at = Time.now
        new_encode
      end

      def cancel(id)
        new_encode = @encodes[id]
        new_encode.state = :cancelled
        new_encode.updated_at = Time.now
        new_encode
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_encode-0.5.0 lib/active_encode/engine_adapters/test_adapter.rb
active_encode-0.4.1 lib/active_encode/engine_adapters/test_adapter.rb
active_encode-0.4 lib/active_encode/engine_adapters/test_adapter.rb