diff options
Diffstat (limited to 'lib/api/base.rb')
-rw-r--r-- | lib/api/base.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/api/base.rb b/lib/api/base.rb index 33e47c18fcd..c245a65b30b 100644 --- a/lib/api/base.rb +++ b/lib/api/base.rb @@ -2,20 +2,33 @@ module API class Base < Grape::API::Instance # rubocop:disable API/Base - include ::Gitlab::WithFeatureCategory + include ::Gitlab::EndpointAttributes class << self def feature_category_for_app(app) feature_category_for_action(path_for_app(app)) end + def urgency_for_app(app) + urgency_for_action(path_for_app(app)) + end + def path_for_app(app) normalize_path(app.namespace, app.options[:path].first) end + def endpoint_id_for_route(route) + "#{route.request_method} #{route.origin}" + end + def route(methods, paths = ['/'], route_options = {}, &block) + actions = Array(paths).map { |path| normalize_path(namespace, path) } if category = route_options.delete(:feature_category) - feature_category(category, Array(paths).map { |path| normalize_path(namespace, path) }) + feature_category(category, actions) + end + + if target = route_options.delete(:urgency) + urgency(target, actions) end super |