module PyBossa::TaskRun

Public Class Methods

create(opts = {}) click to toggle source

Creates a task run.

@param [Hash] opts optional arguments @option opts [Integer] :app_id the app ID to which this object belongs @option opts [Integer] :task_id the task ID to which this object belongs @option opts [Boolean] :timeout timeout for completing a task [not in use] @option opts [Boolean] :calibration whether this is a calibration task [not in use] @option opts [Hash] :info all other task run details @option opts [String] :api_key an API key @return [Hash] a task run

@see github.com/PyBossa/pybossa/blob/master/pybossa/model.py#L261 @see github.com/PyBossa/pybossa/blob/master/pybossa/api.py#L169

# File lib/pybossa-api/task_run.rb, line 33
def create(opts = {})
  if opts.has_key? :calibration
    opts[:calibration] = opts[:calibration] ? 1 : 0
  end
  PyBossa::API.create 'taskrun', opts
end
delete(id, opts = {}) click to toggle source

Deletes a task run.

@param [Integer] id a task run ID @param [Hash] opts optional arguments @option opts [String] :api_key an API key

# File lib/pybossa-api/task_run.rb, line 57
def delete(id, opts = {})
  PyBossa::API.destroy 'taskrun', id, opts
end
get(id, opts = {}) click to toggle source

@param [Integer] id a task run ID @param [Hash] opts optional arguments @option opts [String] :api_key an API key @return [Hash] a task run

# File lib/pybossa-api/task_run.rb, line 16
def get(id, opts = {})
  PyBossa::API.retrieve 'taskrun', id, opts
end
list(opts = {}) click to toggle source

@param [Hash] opts optional arguments @option opts [Integer] :limit number of results to return [default 20] @option opts [String] :api_key an API key @return [Array] a list of task runs

# File lib/pybossa-api/task_run.rb, line 8
def list(opts = {})
  PyBossa::API.many 'taskrun', opts
end
update(id, opts = {}) click to toggle source

Updates a task run.

@param [Integer] id a task run ID

@see PyBossa::TaskRun#create

# File lib/pybossa-api/task_run.rb, line 45
def update(id, opts = {})
  if opts.has_key? :calibration
    opts[:calibration] = opts[:calibration] ? 1 : 0
  end
  PyBossa::API.update 'taskrun', id, opts
end