Class: ForemanPipeline::Api::JenkinsUsersController
- Inherits:
-
Katello::Api::V2::ApiController
- Object
- Katello::Api::V2::ApiController
- ForemanPipeline::Api::JenkinsUsersController
- Includes:
- Rendering, Concerns::ApiControllerExtensions
- Defined in:
- app/controllers/foreman_pipeline/api/jenkins_users_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #index ⇒ Object
- #index_relation ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods included from Concerns::ApiControllerExtensions
Methods included from Rendering
Instance Method Details
#create ⇒ Object
57 58 59 60 61 62 63 |
# File 'app/controllers/foreman_pipeline/api/jenkins_users_controller.rb', line 57 def create @jenkins_user = JenkinsUser.new(jenkins_user_params) @jenkins_user.organization = @organization @jenkins_user.save! respond_for_show(:resource => @jenkins_user) end |
#destroy ⇒ Object
67 68 69 70 |
# File 'app/controllers/foreman_pipeline/api/jenkins_users_controller.rb', line 67 def destroy @jenkins_user.destroy respond_for_show(:resource => @jenkins_user) end |
#index ⇒ Object
24 25 26 |
# File 'app/controllers/foreman_pipeline/api/jenkins_users_controller.rb', line 24 def index respond_for_index(:collection => scoped_search(index_relation.uniq, params[:sort_by], params[:sort_order])) end |
#index_relation ⇒ Object
28 29 30 31 32 |
# File 'app/controllers/foreman_pipeline/api/jenkins_users_controller.rb', line 28 def index_relation query = JenkinsUser.where(:organization_id => @organization.id) query = query.where(:name => params[:name]) if params[:name] query end |
#show ⇒ Object
36 37 38 |
# File 'app/controllers/foreman_pipeline/api/jenkins_users_controller.rb', line 36 def show respond_for_show(:resource => @jenkins_user) end |
#update ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'app/controllers/foreman_pipeline/api/jenkins_users_controller.rb', line 43 def update if jenkins_user_params[:token].empty? @jenkins_user.update_attributes!(jenkins_user_params.except(:token).except(:name)) else @jenkins_user.update_attributes!(jenkins_user_params.except(:name)) end @jenkins_user.save! respond_for_show(:resource => @jenkins_user) end |