Class: Api::ServicesController
- Inherits:
-
ApplicationController
- Object
- ActionController::API
- ApplicationController
- Api::ServicesController
- Defined in:
- app/controllers/api/services_controller.rb
Instance Method Summary collapse
-
#copy_service_flow_data ⇒ Object
Copy the ServiceFlowData for the ServiceFlow into some ActiveModel::Model.
-
#delete_activity ⇒ Object
Delete the activity.
-
#fetch_service_flow_data ⇒ Object
Fetch the ServiceFlowData for the ServiceFlow.
-
#index_flows ⇒ Object
Show all flows for the given Service.
-
#load_service_flow_data ⇒ Object
Load the ServiceFlowData.data for the ServiceFlow.
-
#show ⇒ Object
Show the given Service.
Methods included from Response
Instance Method Details
#copy_service_flow_data ⇒ Object
Copy the ServiceFlowData for the ServiceFlow into some ActiveModel::Model.
28 29 30 31 32 |
# File 'app/controllers/api/services_controller.rb', line 28 def copy_service_flow_data render status: :bad_request and return if @service_flow.copy_data(params[:opts]).nil? render status: :created end |
#delete_activity ⇒ Object
Delete the activity.
45 46 47 48 49 50 51 52 53 |
# File 'app/controllers/api/services_controller.rb', line 45 def delete_activity params.require(:activity_id) activity = Activity.find([@service.id, params[:activity_id]]) render status: :not_found if activity.nil? activity.destroy end |
#fetch_service_flow_data ⇒ Object
Fetch the ServiceFlowData for the ServiceFlow.
12 13 14 15 16 |
# File 'app/controllers/api/services_controller.rb', line 12 def fetch_service_flow_data render status: :bad_request and return if @service_flow.fetch_data(params[:opts]).nil? render status: :created end |
#index_flows ⇒ Object
Show all flows for the given Service.
40 41 42 |
# File 'app/controllers/api/services_controller.rb', line 40 def index_flows render json: @service.flows end |
#load_service_flow_data ⇒ Object
Load the ServiceFlowData.data for the ServiceFlow.
19 20 21 22 23 24 25 |
# File 'app/controllers/api/services_controller.rb', line 19 def load_service_flow_data data = @service_flow.load_data render status: :not_found and return if data.nil? render json: data, status: :ok end |
#show ⇒ Object
Show the given Service.
35 36 37 |
# File 'app/controllers/api/services_controller.rb', line 35 def show render json: @service end |