Class: Spree::Api::V1::InventoryUnitsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/api/v1/inventory_units_controller.rb

Instance Attribute Summary

Attributes inherited from BaseController

#current_api_user

Instance Method Summary collapse

Methods inherited from BaseController

#content_type, #permitted_line_item_attributes

Methods included from ControllerSetup

included

Instance Method Details

#showObject



7
8
9
10
# File 'app/controllers/spree/api/v1/inventory_units_controller.rb', line 7

def show
  @inventory_unit = inventory_unit
  respond_with(@inventory_unit)
end

#updateObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/spree/api/v1/inventory_units_controller.rb', line 12

def update
  authorize! :update, inventory_unit.order

  inventory_unit.transaction do
    if inventory_unit.update_attributes(inventory_unit_params)
      fire
      render :show, status: 200
    else
      invalid_resource!(inventory_unit)
    end
  end
end