Class: Workarea::Api::Admin::ShippingServicesController
Instance Method Summary
collapse
#current_user, #sort_direction, #sort_field
Instance Method Details
#bulk ⇒ Object
277
278
279
280
281
282
283
284
|
# File 'app/controllers/workarea/api/admin/shipping_services_controller.rb', line 277
def bulk
@bulk = Api::Admin::BulkUpsert.create!(
klass: Shipping::Service,
data: params[:shipping_services].map(&:to_h)
)
head :no_content
end
|
#create ⇒ Object
106
107
108
109
110
111
112
113
|
# File 'app/controllers/workarea/api/admin/shipping_services_controller.rb', line 106
def create
@shipping_service = Shipping::Service.create!(params[:shipping_service])
respond_with(
{ shipping_service: @shipping_service },
{ status: :created,
location: shipping_service_path(@shipping_service) }
)
end
|
#destroy ⇒ Object
286
287
288
289
|
# File 'app/controllers/workarea/api/admin/shipping_services_controller.rb', line 286
def destroy
@shipping_service.destroy
head :no_content
end
|
#index ⇒ Object
97
98
99
100
101
102
103
104
|
# File 'app/controllers/workarea/api/admin/shipping_services_controller.rb', line 97
def index
@shipping_services = Shipping::Service
.all
.order_by(sort_field => sort_direction)
.page(params[:page])
respond_with shipping_services: @shipping_services
end
|
#show ⇒ Object
242
243
244
|
# File 'app/controllers/workarea/api/admin/shipping_services_controller.rb', line 242
def show
respond_with shipping_service: @shipping_service
end
|
#update ⇒ Object
246
247
248
249
|
# File 'app/controllers/workarea/api/admin/shipping_services_controller.rb', line 246
def update
@shipping_service.update_attributes!(params[:shipping_service])
respond_with shipping_service: @shipping_service
end
|