Sha256: 3676c211f7f99be00bc9c106bb260b48ff9de20e962bf4288eef2a6bdf5a6c73

Contents?: true

Size: 1.11 KB

Versions: 66

Compression:

Stored size: 1.11 KB

Contents

module Katello
  class Api::V2::GenericContentUnitsController < Api::V2::ApiController
    resource_description do
      name 'Content Units'
      param :content_type, String, desc: N_("Possible values: #{Katello::RepositoryTypeManager.generic_content_types.join(", ")}"), required: true
    end
    apipie_concern_subst(:a_resource => N_("a content unit"), :resource_id => "content_units")

    Katello::RepositoryTypeManager.generic_content_types(false).each do |type|
      api :GET, "/#{type.pluralize}", N_("List %s" % type.pluralize)
      api :GET, "/#{type.pluralize}/:id", N_("Show %s" % type.gsub(/_/, ' '))
      api :GET, "/repositories/:repository_id/#{type.pluralize}/:id", N_("Show %s" % type.gsub(/_/, ' '))
    end

    include Katello::Concerns::Api::V2::RepositoryContentController

    def default_sort
      %w(name asc)
    end

    def resource_class
      fail "Required param content_type is missing" unless params[:content_type]
      ::Katello::GenericContentUnit.where(content_type: params[:content_type].singularize)
    end

    private

    def repo_association
      :repository_id
    end
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
katello-4.9.2 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.10.0.rc2 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.10.0.rc1 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.8.4 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.9.1 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.8.3 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.9.0 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.7.6 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.8.2 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.9.0.rc2 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.9.0.rc1 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.8.1 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.7.5 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.8.0 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.8.0.rc2 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.7.4 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.8.0.rc1 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.7.3 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.7.2 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.7.1 app/controllers/katello/api/v2/generic_content_units_controller.rb