registration
require 'rubygems'
require 'sinatra'
require 'json'
require 'sequel'
require 'pg'
require 'haml'
require 'shotgun'
get '/' do
haml :index
end
post '/sources' do
process_params(params)
end
def process_params(params)
@identifier = params[:identifier]
@rooturl = params[:rootUrl]
if missing_parameters?(params)
halt 400, "Bad Request! missing required parameters\n\n"
# elsif already_exists?(identifier: @identifier, rootUrl: @rooturl)
# out = halt 403, 'Identifier Already Exists!'
else
"#{{identifier: @id}.to_json}\n\n"
end
end
post '/sources/jumpstartlab/data' do
payload = JSON.parse(params[:payload])
payload2 = JSON.parse(payload)
"#{payload2}"
end
def missing_parameters?(params)
identifier = params[:identifier]
root = params[:rootUrl]
if identifier == nil || identifier == ""
true
elsif root == nil || root == ""
true
else
false
end
end
def already_exists?(params)
false
end