Class: Services::ConfiguredAccountsController

Inherits:
ServiceDefinitionBaseController show all
Defined in:
app/controllers/services/configured_accounts_controller.rb

Constant Summary

Constants inherited from ApplicationController

ApplicationController::MAX_LIST_LENGTH

Instance Attribute Summary collapse

Attributes inherited from ServiceDefinitionBaseController

#parent, #service_definition

Instance Method Summary collapse

Instance Attribute Details

#configured_accountObject (readonly)

Returns the value of attribute configured_account.



4
5
6
# File 'app/controllers/services/configured_accounts_controller.rb', line 4

def 
  @configured_account
end

Instance Method Details

#createObject



18
19
20
21
22
23
24
25
# File 'app/controllers/services/configured_accounts_controller.rb', line 18

def create
  ca = CreateConfiguredAccountContext.call(service_definition, safe_ca_params, safe_cred_params)
  if ca.errors.empty?
    render json: { id: ca.id }
  else
    render json: { validation_error: ca.errors.full_messages }, status: 403
  end
end

#destroyObject



36
37
38
39
# File 'app/controllers/services/configured_accounts_controller.rb', line 36

def destroy
  .destroy
  render json: { id: .id }
end

#indexObject



10
11
12
# File 'app/controllers/services/configured_accounts_controller.rb', line 10

def index
  @configured_accounts = service_definition.configured_accounts.includes(:credentials)
end

#showObject



14
15
16
# File 'app/controllers/services/configured_accounts_controller.rb', line 14

def show
  # nothing to do
end

#updateObject



27
28
29
30
31
32
33
34
# File 'app/controllers/services/configured_accounts_controller.rb', line 27

def update
  UpdateConfiguredAccountContext.call(, safe_ca_params, safe_cred_params)
  if .errors.empty?
    render json: { id: .id }
  else
    render json: { validation_error: .errors.full_messages }, status: 403
  end
end