Created
February 27, 2013 21:46
-
-
Save blairanderson/5052053 to your computer and use it in GitHub Desktop.
registration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment