server side for getting items from cart

This commit is contained in:
Senad Uka
2015-02-12 06:51:52 +01:00
parent 9c461cc7c5
commit b0469d634e
5 changed files with 61 additions and 7 deletions

View File

@@ -17,6 +17,7 @@ get '/cart' do
Cart.find_or_create(anonymous_id, -1).to_json
end
# gets number of items in cart for every item
get '/cart/item' do
Cart.find_or_create(anonymous_id, -1).item_in_carts.to_json
end
@@ -29,5 +30,4 @@ update_cart_item = ->() {
ItemInCart.update_state(cart_id, item_id, count).to_json
}
put '/cart/item', &update_cart_item
post '/cart/item', &update_cart_item
post '/cart/item', &update_cart_item