Class: Katello::Api::V2::HostModuleStreamsController
- Inherits:
-
ApiController
- Object
- Api::V2::BaseController
- ApiController
- Katello::Api::V2::HostModuleStreamsController
- Includes:
- Concerns::FilteredAutoCompleteSearch
- Defined in:
- app/controllers/katello/api/v2/host_module_streams_controller.rb
Constant Summary
Constants included from Concerns::FilteredAutoCompleteSearch
Concerns::FilteredAutoCompleteSearch::PAGE_SIZE
Instance Method Summary collapse
Methods included from Concerns::FilteredAutoCompleteSearch
Methods inherited from ApiController
#empty_search_query?, #full_result_response, #scoped_search, #skip_session
Methods included from Rendering
#respond_for_async, #respond_for_bulk_async, #respond_for_create, #respond_for_destroy, #respond_for_index, #respond_for_show, #respond_for_status, #respond_for_update, #respond_with_template, #respond_with_template_collection, #respond_with_template_resource, #try_specific_collection_template, #try_specific_resource_template
Methods included from Katello::Api::Version2
Instance Method Details
#index ⇒ Object
17 18 19 20 |
# File 'app/controllers/katello/api/v2/host_module_streams_controller.rb', line 17 def index collection = scoped_search(index_relation, :name, :asc, :resource_class => ::Katello::HostAvailableModuleStream) respond_for_index(:collection => collection) end |
#index_relation ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/katello/api/v2/host_module_streams_controller.rb', line 22 def index_relation return HostAvailableModuleStream.upgradable([@host]) if params[:status] == HostAvailableModuleStream::UPGRADABLE rel = @host.host_available_module_streams.where(available_module_stream_id: find_available_module_stream_ids) if params[:sort_by] == 'installed_profiles' rel = rel.order([:installed_profiles, :status]) end return rel if (params[:status].blank? && params[:install_status].blank?) rel = rel.send(::Katello::HostAvailableModuleStream::API_STATES[params[:status]]) unless params[:status].blank? rel = rel.installed_status(params[:install_status], @host) unless params[:install_status].blank? rel end |
#resource_class ⇒ Object
35 36 37 |
# File 'app/controllers/katello/api/v2/host_module_streams_controller.rb', line 35 def resource_class Katello::HostAvailableModuleStream end |