module PyBossa::App

Public Class Methods

create(opts = {}) click to toggle source

Creates an app.

@param [Hash] opts optional arguments @option opts [String] :name a name @option opts [String] :short_name a URL slug @option opts [String] :description a short description @option opts [String] :long_description a long HTML description @option opts [Integer] :long_tasks [not in use] @option opts [Boolean] :hidden whether to hide the app from the public @option opts [Integer] :time_estimate estimated time to complete [not in use] @option opts [Integer] :time_limit time limit to complete task [not in use] @option opts [Float] :calibration_frac [not in use] @option opts [Integer] :bolt_course_id [not in use] @option opts [Hash] :info all other task details @option opts [String] :api_key an API key @return [Hash] an app

@see github.com/PyBossa/pybossa/blob/master/pybossa/model.py#L133

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

Deletes an app.

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

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

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

# File lib/pybossa-api/app.rb, line 16
def get(id, opts = {})
  PyBossa::API.retrieve 'app', 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 apps

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

Updates an app.

@param [Integer] id an app ID

@see PyBossa::App#create

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