The business logic in both web and api endpoints are combined in the helper class. Currently the combination is made simply adding a branch for each option and copying the business logic from each endpoint to their respective branches. Rubocop also moved some common lines out of the branches, but other than that the logic is exactly same. There is no change in any functionality. We did not try to converge to single logic and eliminate the branches in this commit. This is intentional as I wanted to keep this commit as boring and add a separate commit with the more interesting convergence stuff.
22 lines
604 B
Ruby
22 lines
604 B
Ruby
# frozen_string_literal: true
|
|
|
|
class CloverWeb
|
|
hash_branch(:project_prefix, "private-subnet") do |r|
|
|
ps_endpoint_helper = Routes::Common::PrivateSubnetHelper.new(app: self, request: r, user: @current_user, location: nil, resource: nil)
|
|
|
|
r.get true do
|
|
ps_endpoint_helper.list
|
|
end
|
|
|
|
r.post true do
|
|
ps_endpoint_helper.instance_variable_set(:@location, LocationNameConverter.to_internal_name(r.params["location"]))
|
|
ps_endpoint_helper.post(r.params["name"])
|
|
end
|
|
|
|
r.on "create" do
|
|
r.get true do
|
|
ps_endpoint_helper.get_create
|
|
end
|
|
end
|
|
end
|
|
end
|