Sha256: 1c3c6dbc0e352dd112012ac1c53d6ce5bf1ad00a3f44340bd37ac792d07231e3
Contents?: true
Size: 1.51 KB
Versions: 4
Compression:
Stored size: 1.51 KB
Contents
module Spree module Api module V1 class ReturnAuthorizationsController < Spree::Api::V1::BaseController before_filter :authorize_admin! def index @return_authorizations = order.return_authorizations. ransack(params[:q]).result. page(params[:page]).per(params[:per_page]) end def show @return_authorization = order.return_authorizations.find(params[:id]) end def create @return_authorization = order.return_authorizations.build(params[:return_authorization], :as => :api) if @return_authorization.save render :show, :status => 201 else invalid_resource!(@return_authorization) end end def update @return_authorization = order.return_authorizations.find(params[:id]) if @return_authorization.update_attributes(params[:return_authorization]) render :show else invalid_resource!(@return_authorization) end end def destroy @return_authorization = order.return_authorizations.find(params[:id]) @return_authorization.destroy render :text => nil, :status => 204 end private def order @order ||= Order.find_by_number!(params[:order_id]) end def authorize_admin! authorize! :manage, Spree::ReturnAuthorization end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems