Sha256: cd115a88fc116da7d7da24292b3740c3909153c2231f6c4921090d6ed9f4a252

Contents?: true

Size: 752 Bytes

Versions: 4

Compression:

Stored size: 752 Bytes

Contents

require 'mkit/app/model/mkit_job'

class MkitJobsController < MKIt::Server

  # curl localhost:4567/mkitjobs
  get '/mkitjobs' do
    JSON.pretty_generate(JSON.parse(MkitJob.all.to_json))
  end

  get '/mkitjobs/:id' do
    JSON.pretty_generate(JSON.parse(MkitJob.find(params[:id]).to_json))
  end

  put '/mkitjobs/:id' do
    "Not impleemnted\n"
  end

  delete '/mkitjobs/:id' do
    JSON.pretty_generate(JSON.parse(MkitJob.destroy(params[:id]).to_json))
  end

  delete '/mkitjobs/clean/all' do
    MkitJob.destroy_all
  end

  post '/mkitjobs' do
    xx = "no file"
    if params[:file]
      tempfile = params[:file][:tempfile]
      xx= YAML.load(tempfile.read)
      puts xx
    end
    JSON.pretty_generate(JSON.parse(xx.to_json))
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mkit-0.4.1 lib/mkit/app/controllers/mkitjobs_controller.rb
mkit-0.4.0 lib/mkit/app/controllers/mkitjobs_controller.rb
mkit-0.3.0 lib/mkit/app/controllers/mkitjobs_controller.rb
mkit-0.2.0 lib/mkit/app/controllers/mkitjobs_controller.rb