Class: Services::ServiceDefinitionsController
Constant Summary
ApplicationController::MAX_LIST_LENGTH
Instance Attribute Summary
#parent, #service_definition
Instance Method Summary
collapse
Instance Method Details
#create ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'app/controllers/services/service_definitions_controller.rb', line 18
def create
svc_def = CreateServiceDefinitionContext.call(parent, safe_sd_params, safe_cred_params)
if svc_def.errors.empty?
render json: { id: svc_def.id }
else
render json: { validation_error: svc_def.errors.full_messages }, status: 403
end
end
|
#destroy ⇒ Object
36
37
38
39
|
# File 'app/controllers/services/service_definitions_controller.rb', line 36
def destroy
service_definition.destroy
render json: { id: service_definition.id }
end
|
#index ⇒ Object
10
11
12
|
# File 'app/controllers/services/service_definitions_controller.rb', line 10
def index
@service_definitions = parent.service_definitions.includes(:credentials).limit(MAX_LIST_LENGTH)
end
|
#show ⇒ Object
14
15
16
|
# File 'app/controllers/services/service_definitions_controller.rb', line 14
def show
end
|
#update ⇒ Object
27
28
29
30
31
32
33
34
|
# File 'app/controllers/services/service_definitions_controller.rb', line 27
def update
UpdateServiceDefinitionContext.call(service_definition, safe_sd_params, safe_cred_params)
if service_definition.errors.empty?
render json: { id: service_definition.id }
else
render json: { validation_error: service_definition.errors.full_messages }, status: 403
end
end
|