Sha256: cc09f1b88c7694f9e402ba5d68b20a6f157b1ae7fd58ca8761be079407d06987

Contents?: true

Size: 786 Bytes

Versions: 12

Compression:

Stored size: 786 Bytes

Contents

# frozen_string_literal: true

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.safe_load(tempfile.read)
      puts xx
    end
    JSON.pretty_generate(JSON.parse(xx.to_json))
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
mkit-0.9.0 lib/mkit/app/controllers/mkitjobs_controller.rb
mkit-0.8.0 lib/mkit/app/controllers/mkitjobs_controller.rb
mkit-0.7.2 lib/mkit/app/controllers/mkitjobs_controller.rb
mkit-0.7.1 lib/mkit/app/controllers/mkitjobs_controller.rb
mkit-0.7.0 lib/mkit/app/controllers/mkitjobs_controller.rb
mkit-0.6.3 lib/mkit/app/controllers/mkitjobs_controller.rb
mkit-0.6.2 lib/mkit/app/controllers/mkitjobs_controller.rb
mkit-0.6.1 lib/mkit/app/controllers/mkitjobs_controller.rb
mkit-0.6.0 lib/mkit/app/controllers/mkitjobs_controller.rb
mkit-0.5.0 lib/mkit/app/controllers/mkitjobs_controller.rb
mkit-0.4.3 lib/mkit/app/controllers/mkitjobs_controller.rb
mkit-0.4.2 lib/mkit/app/controllers/mkitjobs_controller.rb