Project

General

Profile

Download (1.24 KB) Statistics
| Branch: | Tag: | Revision:

foreman_pipeline / app / controllers / foreman_pipeline / api / jenkins_projects_controller.rb @ be52ca64

1
module ForemanPipeline
2
  class Api::JenkinsProjectsController < Katello::Api::V2::ApiController
3
    respond_to :json
4

    
5
    include Api::Rendering
6

    
7
    before_filter :find_organization, :only => [:create]
8
    before_filter :find_jenkins_project, :only => [:show, :update, :destroy]
9

    
10
    def show
11
      respond_for_show(:resource => @jenkins_project)
12
    end
13

    
14
    # def destroy
15
    #   @jenkins_project.destroy
16
    #   respond_for_show(:resource => @jenkins_project)
17
    # end
18

    
19
    # def update
20
    #   @jenkins_project.update_attributes!(jenkins_project_params)
21
    #   @jenkins_project.save!
22
    #   respond_for_show(:resource => @jenkins_project)
23
    # end
24

    
25
    # def create
26
    #   @jenkins_project = JenkinsProject.new(jenkins_project_params)
27
    #   @jenkins_project.organization = @organization
28
    #   @jenkins_project.save!
29
    #   respond_for_show(:resource => @jenkins_project)
30
    # end
31

    
32
    private
33

    
34
    def find_jenkins_project
35
      @jenkins_project = JenkinsProject.find_by_id(params[:id])
36
      fail ::Katello::HttpErrors::NotFound, "Could not find Jenkins Project with id: #{params[:id]}" if @jenkins_project.nil?
37
      @jenkins_project
38
    end
39

    
40
    def jenkins_project_params
41
      params.require(:jenkins_project).permit(:name)
42
    end
43

    
44

    
45
    
46
  end
47
end