Created
September 28, 2018 17:31
-
-
Save paul-hammant/cab07115e8d17b224e233ab2f1d0721a to your computer and use it in GitHub Desktop.
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
# You may have to do: | |
# sudo gem install sinatra | |
require 'sinatra' | |
require 'json' | |
makers = {} | |
makers["66463882"] = JSON.parse '{ | |
"name": "Elsie C", | |
"location_type": "Individual", | |
"earn_comissions": true, | |
"cash_handling_limit": 50, | |
"one_pizza_maker_fee_pct": 1, | |
"bitcoin_handling_limit": 100, | |
"one_plus_pizza_maker_fee_pct": 4, | |
"rating": 98.5, | |
"total_review": 110, | |
"transactions": { | |
"last_seven_days": 6, | |
"total": 10 | |
}, | |
"commissions_earned": { | |
"currency": "$", | |
"last_seven_days": 18.50, | |
"total": 120.50 | |
} | |
}' | |
put '/pizzaMaker/:id' do | |
data = JSON.parse request.body.read | |
makers[params[:id]] = data | |
puts "Pizza put" | |
"ok" | |
end | |
get '/pizzaMaker/:id' do | |
puts "Pizza got" | |
makers[params[:id]].to_json | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment