Class: ActiveEncode::EngineAdapters::TestAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/active_encode/engine_adapters/test_adapter.rb

Instance Method Summary collapse

Constructor Details

#initializeTestAdapter

Returns a new instance of TestAdapter.


4
5
6
# File 'lib/active_encode/engine_adapters/test_adapter.rb', line 4

def initialize
  @encodes = {}
end

Instance Method Details

#cancel(encode) ⇒ Object


23
24
25
26
27
# File 'lib/active_encode/engine_adapters/test_adapter.rb', line 23

def cancel(encode)
  e = @encodes[encode.id]
  e.state = :cancelled
  e
end

#create(encode) ⇒ Object


8
9
10
11
12
13
# File 'lib/active_encode/engine_adapters/test_adapter.rb', line 8

def create(encode)
  encode.id = SecureRandom.uuid
  @encodes[encode.id] = encode
  encode.state = :running
  encode
end

#find(id, _opts = {}) ⇒ Object


15
16
17
# File 'lib/active_encode/engine_adapters/test_adapter.rb', line 15

def find(id, _opts = {})
  @encodes[id]
end

#list(*_filters) ⇒ Object

Raises:

  • (NotImplementedError)

19
20
21
# File 'lib/active_encode/engine_adapters/test_adapter.rb', line 19

def list(*_filters)
  raise NotImplementedError
end

#purge(encode) ⇒ Object


29
30
31
# File 'lib/active_encode/engine_adapters/test_adapter.rb', line 29

def purge(encode)
  @encodes.delete(encode.id)
end

#remove_output(_encode, _output_id) ⇒ Object

Raises:

  • (NotImplementedError)

33
34
35
# File 'lib/active_encode/engine_adapters/test_adapter.rb', line 33

def remove_output(_encode, _output_id)
  raise NotImplementedError
end