Class: Api::V2::PuppetclassesController

Inherits:
Api::V1::PuppetclassesController show all
Includes:
TaxonomyScope, Api::Version2
Defined in:
app/controllers/api/v2/puppetclasses_controller.rb

Instance Method Summary collapse

Methods included from TaxonomyScope

#set_taxonomy_scope

Methods included from Api::Version2

#api_version

Methods inherited from Api::V1::PuppetclassesController

#create, #destroy, #update

Methods included from Api::Version1

#api_version

Methods inherited from BaseController

#get_resource, #resource_class, #resource_name, #resource_scope

Methods included from Foreman::ThreadSession::Cleaner

#clear_thread, included

Instance Method Details

#indexObject


18
19
20
21
22
23
24
25
26
# File 'app/controllers/api/v2/puppetclasses_controller.rb', line 18

def index
  return super unless @nested_obj
  if @nested_obj.kind_of?(Environment)
    values = @nested_obj.puppetclasses
  else
    values = @nested_obj.all_puppetclasses
  end
  render :json => Puppetclass.classes2hash(values)
end

#showObject


37
38
39
40
41
# File 'app/controllers/api/v2/puppetclasses_controller.rb', line 37

def show
  if @nested_obj
    @puppetclass = @nested_obj.puppetclasses.find(params[:id])
  end
end