Class: Services::ThirdPartiesController
Constant Summary
ApplicationController::MAX_LIST_LENGTH
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#third_party ⇒ Object
Returns the value of attribute third_party.
4
5
6
|
# File 'app/controllers/services/third_parties_controller.rb', line 4
def third_party
@third_party
end
|
Instance Method Details
#create ⇒ Object
16
17
18
19
20
21
22
23
|
# File 'app/controllers/services/third_parties_controller.rb', line 16
def create
tp = CreateThirdPartyContext.call(safe_params)
if tp.errors.empty?
render json: { id: tp.id }
else
render json: { validation_error: tp.errors.full_messages }, status: 403
end
end
|
#index ⇒ Object
9
10
11
|
# File 'app/controllers/services/third_parties_controller.rb', line 9
def index
@third_parties = ThirdParty.limit(MAX_LIST_LENGTH)
end
|
#show ⇒ Object
13
14
|
# File 'app/controllers/services/third_parties_controller.rb', line 13
def show
end
|
#update ⇒ Object
25
26
27
28
29
30
31
32
|
# File 'app/controllers/services/third_parties_controller.rb', line 25
def update
UpdateThirdPartyContext.call(third_party, safe_params)
if third_party.errors.blank?
render json: { id: third_party.id }
else
render json: { validation_error: third_party.errors.full_messages }, status: 403
end
end
|