Sha256: 763051a21239d5c9d4f45020ef29ab24532f6fd9f128ba8346036c96c91a2649
Contents?: true
Size: 1.04 KB
Versions: 28
Compression:
Stored size: 1.04 KB
Contents
class StockItem constructor: (options = {}) -> @id = options.id @variantId = options.variantId @backorderable = options.backorderable @countOnHand = options.countOnHand @stockLocationId = options.stockLocationId save: (successHandler, errorHandler) -> Spree.ajax url: Spree.routes.stock_items_api(@stockLocationId) type: "POST" data: stock_item: variant_id: @variantId backorderable: @backorderable count_on_hand: @countOnHand success: (stockItem) -> successHandler(stockItem) error: (errorData) -> errorHandler(errorData) update: (successHandler, errorHandler) -> Spree.ajax url: "#{Spree.routes.stock_items_api(@stockLocationId)}/#{@id}" type: "PUT" data: stock_item: backorderable: @backorderable count_on_hand: @countOnHand force: true success: (stockItem) -> successHandler(stockItem) error: (errorData) -> errorHandler(errorData) Spree.StockItem = StockItem
Version data entries
28 entries across 28 versions & 1 rubygems