Back to Parent

get '/accio_userdetails'  do
  AccioUserdetail.all.to_json
end

get '/accio_userdetails/create'  do
  user = {}
  user['name'] = "Harshika Jain"
  user['location'] = "Pittsburgh"
  user['phone_number'] = "+7163308752"
  userOut = AccioUserdetail.new(user)

   if userOut.save
     userOut.to_json
   else
     halt 422, userOut.errors.full_messages.to_json
   end
end

get '/accio_purchases'  do
  AccioPurchase.all.to_json
end

get '/accio_purchases/create'  do
  purchase = {}
  purchase['amount_paid'] = 500
  purchase['paid_by_id'] = 4
  purchase['product_id'] = 71
  purchaseOut = AccioPurchase.new(purchase)

   if purchaseOut.save
     purchaseOut.to_json
   else
     halt 422, purchaseOut.errors.full_messages.to_json
   end
end
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0