Commit 1d787b38 authored by Sean McGivern's avatar Sean McGivern

Only expose needed methods from API::Base

parent 2a9401dd
......@@ -4,24 +4,28 @@ module API
class Base < Grape::API::Instance # rubocop:disable API/Base
include ::Gitlab::WithFeatureCategory
def self.feature_category_for_app(app)
feature_category_for_action(path_for_app(app))
end
class << self
def feature_category_for_app(app)
feature_category_for_action(path_for_app(app))
end
def self.path_for_app(app)
normalize_path(app.namespace, app.options[:path].first)
end
def path_for_app(app)
normalize_path(app.namespace, app.options[:path].first)
end
def self.route(methods, paths = ['/'], route_options = {}, &block)
if category = route_options.delete(:feature_category)
feature_category(category, Array(paths).map { |path| normalize_path(namespace, path) })
def route(methods, paths = ['/'], route_options = {}, &block)
if category = route_options.delete(:feature_category)
feature_category(category, Array(paths).map { |path| normalize_path(namespace, path) })
end
super
end
super
end
private
def self.normalize_path(namespace, path)
[namespace.presence, path.to_s.chomp('/').presence].compact.join('/')
def normalize_path(namespace, path)
[namespace.presence, path.to_s.chomp('/').presence].compact.join('/')
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment