Class: Mks::Rate::ServiceBundlesController
- Inherits:
-
ApplicationController
- Object
- Auth::ApplicationController
- ApplicationController
- Mks::Rate::ServiceBundlesController
- Defined in:
- app/controllers/mks/rate/service_bundles_controller.rb
Instance Method Summary collapse
- #add_services ⇒ Object
- #create ⇒ Object
- #filter ⇒ Object
- #index ⇒ Object
- #sdu_bundles ⇒ Object
- #services ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#add_services ⇒ Object
47 48 49 50 |
# File 'app/controllers/mks/rate/service_bundles_controller.rb', line 47 def add_services result = @service.add_services(@service_bundle, add_services_params[:ids]) render json: { success: result } end |
#create ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'app/controllers/mks/rate/service_bundles_controller.rb', line 20 def create @service_bundle = ServiceBundle.new(service_bundle_params) if @service_bundle.save render json: @service_bundle, status: :created, location: @service_bundle else render json: @service_bundle.errors, status: :unprocessable_entity end end |
#filter ⇒ Object
37 38 39 40 41 |
# File 'app/controllers/mks/rate/service_bundles_controller.rb', line 37 def filter search = "%#{params[:search].downcase}%" bundles = ServiceBundle.where('lower(mks_rate_service_bundles.name) LIKE ?', search) render json: bundles end |
#index ⇒ Object
6 7 8 9 |
# File 'app/controllers/mks/rate/service_bundles_controller.rb', line 6 def index @service_bundles = ServiceBundle.all render json: @service_bundles end |
#sdu_bundles ⇒ Object
11 12 13 14 |
# File 'app/controllers/mks/rate/service_bundles_controller.rb', line 11 def sdu_bundles result = ServiceBundle.where(service_delivery_unit_id: params[:id]) render json: result end |
#services ⇒ Object
43 44 45 |
# File 'app/controllers/mks/rate/service_bundles_controller.rb', line 43 def services render json: @service_bundle.chargeable_services end |
#show ⇒ Object
16 17 18 |
# File 'app/controllers/mks/rate/service_bundles_controller.rb', line 16 def show render json: @service_bundle end |
#update ⇒ Object
29 30 31 32 33 34 35 |
# File 'app/controllers/mks/rate/service_bundles_controller.rb', line 29 def update if @service_bundle.update(service_bundle_params) render json: @service_bundle else render json: @service_bundle.errors, status: :unprocessable_entity end end |