Class: Api::StateChangesController

Inherits:
ApiController show all
Defined in:
app/controllers/api/state_changes_controller.rb

Instance Method Summary collapse

Methods inherited from ApiController

#probe

Instance Method Details

#indexObject

Lists state changes for the specified job

A state changes gets created the first time a job enters this state. Along with the actual state and the timestamp of it happening, the message from the Transcoder instance will be stored if present.

Parameters

id

The id of the job

Example

The normal flow would be: scheduled, processing, success:

[
  {
    state_change: {
      job_id: 25
      id: 73
      created_at: "2011-05-09T13:53:31Z"
      message: "The transcoder accepted your job."
      updated_at: "2011-05-09T13:53:31Z"
      state: "scheduled"
    }
  },
  {
    state_change: {
      job_id: 25
      id: 74
      created_at: "2011-05-09T13:53:41Z"
      message: null
      updated_at: "2011-05-09T13:53:41Z"
      state: "processing"
    }
  },
  {
    state_change: {
      job_id: 25
      id: 75
      created_at: "2011-05-09T13:58:18Z"
      message: "ffmpeg finished succesfully."
      updated_at: "2011-05-09T13:58:18Z"
      state: "success"
    }
  }
]

51
52
53
# File 'app/controllers/api/state_changes_controller.rb', line 51

def index
  respond_with @job.state_changes
end