Sha256: 06e1b2f81e468f4818d71fbfa364ad9352217edaee7f9e6c3fbc066e34bc3590

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 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 'missing_hosts'
            get 'hosts'
            get 'users'
            get 'usergroups'
          end
        end
      end
    end
  end
end
# rubocop: enable Metrics/BlockLength

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foreman_resource_quota-0.3.1 config/routes.rb
foreman_resource_quota-0.3.0 config/routes.rb
foreman_resource_quota-0.2.0 config/routes.rb