Sha256: eeec3ac869e3c486788c87e01433e3a6645465f3519dae3587e5587a3527adfa
Contents?: true
Size: 918 Bytes
Versions: 4
Compression:
Stored size: 918 Bytes
Contents
module Spree module Api module V1 class ShipmentsController < BaseController before_filter :find_order before_filter :find_and_update_shipment, :only => [:ship, :ready] def ready authorize! :read, Shipment unless @shipment.ready? @shipment.ready! end render :show end def ship authorize! :read, Shipment unless @shipment.shipped? @shipment.ship! end render :show end private def find_order @order = Spree::Order.find_by_number!(params[:order_id]) authorize! :read, @order end def find_and_update_shipment @shipment = @order.shipments.find_by_number!(params[:id]) @shipment.update_attributes(params[:shipment]) @shipment.reload end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems