Class: Spree::Api::ShipmentsController

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

Instance Attribute Summary

Attributes inherited from BaseController

#current_api_user

Instance Method Summary collapse

Methods inherited from BaseController

#map_nested_attributes_keys, #set_jsonp_format

Methods included from ControllerSetup

included

Instance Method Details

#readyObject



9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/spree/api/shipments_controller.rb', line 9

def ready
  authorize! :read, Shipment
  unless @shipment.ready?
    if @shipment.can_ready?
      @shipment.ready!
    else
      render "spree/api/shipments/cannot_ready_shipment", :status => 422 and return
    end
  end
  respond_with(@shipment, :default_template => :show)
end

#shipObject



21
22
23
24
25
26
27
# File 'app/controllers/spree/api/shipments_controller.rb', line 21

def ship
  authorize! :read, Shipment
  unless @shipment.shipped?
    @shipment.ship!
  end
  respond_with(@shipment, :default_template => :show)
end