Class: SolidusSubscriptions::Api::V1::LineItemsController
- Inherits:
-
Spree::Api::BaseController
- Object
- Spree::Api::BaseController
- SolidusSubscriptions::Api::V1::LineItemsController
- Defined in:
- app/controllers/solidus_subscriptions/api/v1/line_items_controller.rb
Instance Method Summary collapse
Instance Method Details
#destroy ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/solidus_subscriptions/api/v1/line_items_controller.rb', line 14 def destroy :crud, @line_item, @order return render json: {}, status: 400 if @line_item.order.complete? @line_item.destroy! @line_item.order.update! render json: @line_item.to_json end |
#update ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'app/controllers/solidus_subscriptions/api/v1/line_items_controller.rb', line 5 def update :crud, @line_item, @order if @line_item.update(line_item_params) render json: @line_item.to_json else render json: @line_item.errors.to_json, status: 422 end end |