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.15.0.rc1 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.14.1 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.14.0 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.14.0.rc3 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.14.0.rc2 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.14.0.rc1.1 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.14.0.rc1 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.13.1 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.13.0 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.12.1 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.13.0.rc1 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.12.0 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.12.0.rc3 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.12.0.rc2 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.12.0.rc1 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.11.1 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.11.0 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.11.0.rc2 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.11.0.rc1 app/controllers/katello/api/v2/generic_content_units_controller.rb
katello-4.10.0 app/controllers/katello/api/v2/generic_content_units_controller.rb