Class: Api::ServicesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/api/services_controller.rb

Instance Method Summary collapse

Methods included from Response

#json_response

Instance Method Details

#copy_service_flow_dataObject

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_activityObject

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_dataObject

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_flowsObject

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_dataObject

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

#showObject

Show the given Service.



35
36
37
# File 'app/controllers/api/services_controller.rb', line 35

def show
  render json: @service
end