Sha256: a34db2a31c77c9875e4cb161536b24c1233fe617d4740e2b1fdb81db03820e55

Contents?: true

Size: 809 Bytes

Versions: 6

Compression:

Stored size: 809 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
          unless @shipment.ready?
            @shipment.ready!
          end
          render :show
        end

        def ship
          unless @shipment.shipped?
            @shipment.ship!
          end
          render :show
        end

        private

        def find_order
          @order = Spree::Order.find_by_number!(params[:order_id])
        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

6 entries across 6 versions & 1 rubygems

Version Path
spree_api-1.2.0 app/controllers/spree/api/v1/shipments_controller.rb
spree_api-1.2.0.rc2 app/controllers/spree/api/v1/shipments_controller.rb
spree_api-1.2.0.rc1 app/controllers/spree/api/v1/shipments_controller.rb
spree_api-1.1.3 app/controllers/spree/api/v1/shipments_controller.rb
spree_api-1.1.2 app/controllers/spree/api/v1/shipments_controller.rb
spree_api-1.1.2.rc1 app/controllers/spree/api/v1/shipments_controller.rb