Class: Api::V1::PuppetclassesController

Inherits:
BaseController show all
Defined in:
app/controllers/api/v1/puppetclasses_controller.rb

Direct Known Subclasses

Api::V2::PuppetclassesController

Instance Method Summary collapse

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

#createObject


32
33
34
35
# File 'app/controllers/api/v1/puppetclasses_controller.rb', line 32

def create
  @puppetclass = Puppetclass.new(params[:puppetclass])
  process_response @puppetclass.save
end

#destroyObject


50
51
52
# File 'app/controllers/api/v1/puppetclasses_controller.rb', line 50

def destroy
  process_response @puppetclass.destroy
end

#indexObject


14
15
16
17
18
19
# File 'app/controllers/api/v1/puppetclasses_controller.rb', line 14

def index
  values = Puppetclass.search_for(*search_options).paginate(paginate_options).
    select([:name, :id]).
    includes(:lookup_keys)
  render :json => Puppetclass.classes2hash(values.all)
end

#showObject


24
25
# File 'app/controllers/api/v1/puppetclasses_controller.rb', line 24

def show
end

#updateObject


43
44
45
# File 'app/controllers/api/v1/puppetclasses_controller.rb', line 43

def update
  process_response @puppetclass.update_attributes(params[:puppetclass])
end