Class: Shingoncoder::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/shingoncoder/job.rb

Class Method Summary collapse

Class Method Details

.cancelObject



12
13
14
# File 'lib/shingoncoder/job.rb', line 12

def cancel
  fail NotImplementedError
end

.create(options = {}) ⇒ Object

Parameters:

  • options (Hash) (defaults to: {})
  • [String] (Hash)

    a customizable set of options



6
7
8
9
10
# File 'lib/shingoncoder/job.rb', line 6

def create(options = {})
  id = Backend::Job.create(options)
  # TODO in the future the backend could be via a HTTP API
  Response.new('id' => id, 'code' => 201)
end

.detailsObject

should have [“job”][“url”] TODO should have [“job”] which is one of:

"pending", "waiting", "processing", "cancelled", "failed", "finished"


26
27
28
29
# File 'lib/shingoncoder/job.rb', line 26

def details
  job = Shingoncoder::Backend::JobRegistry::Job.find(id)
  Response.new('body' => { 'job' => { 'input_media_file' => { 'url' => job.input.fetch('input') } } }, 'code' => 200)
end

.progress(id) ⇒ Object

Each output should have current_event job itself should have ‘progress’



18
19
20
21
# File 'lib/shingoncoder/job.rb', line 18

def progress(id)
  job = Shingoncoder::Backend::JobRegistry::Job.find(id)
  Response.new('body' => id, 'code' => 200)
end