Class: Spree::Api::V1::ReturnAuthorizationsController
- Inherits:
-
BaseController
- Object
- ActionController::Metal
- BaseController
- Spree::Api::V1::ReturnAuthorizationsController
show all
- Defined in:
- app/controllers/spree/api/v1/return_authorizations_controller.rb
Instance Attribute Summary
#current_api_user
Instance Method Summary
collapse
#map_nested_attributes_keys
included
Instance Method Details
#create ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'app/controllers/spree/api/v1/return_authorizations_controller.rb', line 17
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
|
#destroy ⇒ Object
35
36
37
38
39
|
# File 'app/controllers/spree/api/v1/return_authorizations_controller.rb', line 35
def destroy
@return_authorization = order.return_authorizations.find(params[:id])
@return_authorization.destroy
render :text => nil, :status => 204
end
|
#index ⇒ Object
7
8
9
10
11
|
# File 'app/controllers/spree/api/v1/return_authorizations_controller.rb', line 7
def index
@return_authorizations = order.return_authorizations.
ransack(params[:q]).result.
page(params[:page]).per(params[:per_page])
end
|
#show ⇒ Object
13
14
15
|
# File 'app/controllers/spree/api/v1/return_authorizations_controller.rb', line 13
def show
@return_authorization = order.return_authorizations.find(params[:id])
end
|
#update ⇒ Object
26
27
28
29
30
31
32
33
|
# File 'app/controllers/spree/api/v1/return_authorizations_controller.rb', line 26
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
|