13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/lib/katello/api/mapper_extensions.rb', line 13
def api_attachable_resources(resource_plural_name, options = {})
resource_singular_name = options.try(:delete, :resource_name)
resource_singular_name ||= resource_plural_name.to_s.singularize
controller = options.delete(:controller)
api_resources resource_plural_name, :controller => controller, :only => [] do
params = { :on => :collection, :action => "add_" + resource_singular_name.to_s }
post :index, params.merge(options)
params = { :on => :member, :action => "remove_" + resource_singular_name.to_s }
delete :destroy, params.merge(options)
end
end
|