Class: Spree::Api::LegacyReturnAuthorizationsController
- Inherits:
-
BaseController
- Object
- BaseController
- Spree::Api::LegacyReturnAuthorizationsController
- Defined in:
- app/controllers/spree/api/legacy_return_authorizations_controller.rb
Instance Method Summary collapse
- #add ⇒ Object
- #cancel ⇒ Object
- #destroy ⇒ Object
- #index ⇒ Object
- #receive ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#add ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/spree/api/legacy_return_authorizations_controller.rb', line 34 def add @legacy_return_authorization = order..accessible_by(current_ability, :update).find(params[:id]) @legacy_return_authorization.add_variant params[:variant_id].to_i, params[:quantity].to_i if @legacy_return_authorization.valid? respond_with @legacy_return_authorization, default_template: :show else invalid_resource!(@legacy_return_authorization) end end |
#cancel ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'app/controllers/spree/api/legacy_return_authorizations_controller.rb', line 53 def cancel @legacy_return_authorization = order..accessible_by(current_ability, :update).find(params[:id]) if @legacy_return_authorization.cancel respond_with @legacy_return_authorization, default_template: :show else invalid_resource!(@legacy_return_authorization) end end |
#destroy ⇒ Object
5 6 7 8 9 |
# File 'app/controllers/spree/api/legacy_return_authorizations_controller.rb', line 5 def destroy @legacy_return_authorization = order..accessible_by(current_ability, :destroy).find(params[:id]) @legacy_return_authorization.destroy respond_with(@legacy_return_authorization, status: 204) end |
#index ⇒ Object
11 12 13 14 15 16 17 |
# File 'app/controllers/spree/api/legacy_return_authorizations_controller.rb', line 11 def index :admin, LegacyReturnAuthorization @legacy_return_authorizations = order..accessible_by(current_ability, :read). ransack(params[:q]).result. page(params[:page]).per(params[:per_page]) respond_with(@legacy_return_authorizations) end |
#receive ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'app/controllers/spree/api/legacy_return_authorizations_controller.rb', line 44 def receive @legacy_return_authorization = order..accessible_by(current_ability, :update).find(params[:id]) if @legacy_return_authorization.receive respond_with @legacy_return_authorization, default_template: :show else invalid_resource!(@legacy_return_authorization) end end |
#show ⇒ Object
19 20 21 22 23 |
# File 'app/controllers/spree/api/legacy_return_authorizations_controller.rb', line 19 def show :admin, LegacyReturnAuthorization @legacy_return_authorization = order..accessible_by(current_ability, :read).find(params[:id]) respond_with(@legacy_return_authorization) end |
#update ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'app/controllers/spree/api/legacy_return_authorizations_controller.rb', line 25 def update @legacy_return_authorization = order..accessible_by(current_ability, :update).find(params[:id]) if @legacy_return_authorization.update_attributes() respond_with(@legacy_return_authorization, default_template: :show) else invalid_resource!(@legacy_return_authorization) end end |