Sha256: d7e00945a59d5226a7372f77ae094fb4d3ed7a3977b411d01ace6672e704c9d3

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

# rubocop: disable Metrics/BlockLength
Rails.application.routes.draw do
  scope :foreman_resource_quota, path: 'foreman_resource_quota' do
    resources :resource_quotas, except: %i[show], controller: 'foreman_resource_quota/resource_quotas' do
      collection do
        get 'auto_complete_search'
      end
    end
  end

  namespace :foreman_resource_quota do
    resources :resource_quotas, except: %i[show] do
      collection do
        get 'help', action: :welcome
        get 'auto_complete_search'
      end
    end

    # API routes
    namespace :api, defaults: { format: 'json' } do
      scope '(:apiv)',
        module: :v2,
        defaults: { apiv: 'v2' },
        apiv: /v1|v2/,
        constraints: ApiConstraints.new(version: 2, default: true) do
        resources :resource_quotas, except: %i[new edit] do
          collection do
            get 'auto_complete_search'
          end
          constraints(id: %r{[^/]+}) do
            get 'utilization'
            get 'hosts'
            get 'users'
            get 'usergroups'
          end
        end
      end
    end
  end
end
# rubocop: enable Metrics/BlockLength

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
foreman_resource_quota-0.1.0 config/routes.rb