Class: Katello::Api::V2::ContentViewFiltersController

Inherits:
ApiController
  • Object
show all
Includes:
Concerns::FilteredAutoCompleteSearch
Defined in:
app/controllers/katello/api/v2/content_view_filters_controller.rb

Constant Summary

Constants included from Concerns::FilteredAutoCompleteSearch

Concerns::FilteredAutoCompleteSearch::PAGE_SIZE

Instance Method Summary collapse

Methods included from Concerns::FilteredAutoCompleteSearch

#auto_complete_search

Methods inherited from ApiController

#full_result_response, #resource_class, #scoped_search

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

#api_version

Instance Method Details

#createObject



35
36
37
38
# File 'app/controllers/katello/api/v2/content_view_filters_controller.rb', line 35

def create
  filter = ContentViewFilter.create_for(params[:type], filter_params.merge(:content_view => @view))
  respond :resource => filter
end

#destroyObject



66
67
68
69
# File 'app/controllers/katello/api/v2/content_view_filters_controller.rb', line 66

def destroy
  @filter.destroy
  respond_for_show :resource => @filter
end

#indexObject



15
16
17
# File 'app/controllers/katello/api/v2/content_view_filters_controller.rb', line 15

def index
  respond(:collection => scoped_search(index_relation.uniq, :name, :asc))
end

#index_relationObject



19
20
21
22
23
# File 'app/controllers/katello/api/v2/content_view_filters_controller.rb', line 19

def index_relation
  query = ContentViewFilter.where(:content_view_id => (@view || ContentView.readable))
  query = query.where(:name => params[:name]) if params[:name]
  query
end

#showObject



44
45
46
# File 'app/controllers/katello/api/v2/content_view_filters_controller.rb', line 44

def show
  respond :resource => @filter
end

#updateObject



57
58
59
60
# File 'app/controllers/katello/api/v2/content_view_filters_controller.rb', line 57

def update
  @filter.update_attributes!(filter_params)
  respond :resource => @filter
end