Class: ForemanVirtWhoConfigure::Api::V2::ConfigsController
- Inherits:
-
Api::V2::BaseController
- Object
- Api::V2::BaseController
- ForemanVirtWhoConfigure::Api::V2::ConfigsController
- Includes:
- Api::Version2, Concerns::ConfigParameters
- Defined in:
- app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb
Instance Method Summary collapse
- #apply_organization_filter(scope) ⇒ Object
- #create ⇒ Object
- #deploy_script ⇒ Object
- #destroy ⇒ Object
- #index ⇒ Object
- #resource_class ⇒ Object
- #resource_scope(*args) ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#apply_organization_filter(scope) ⇒ Object
81 82 83 |
# File 'app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb', line 81 def apply_organization_filter(scope) scope.for_organization(Organization.current) end |
#create ⇒ Object
61 62 63 64 |
# File 'app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb', line 61 def create @config = Config.new(config_params) process_response @config.save end |
#deploy_script ⇒ Object
30 31 32 33 34 35 36 |
# File 'app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb', line 30 def deploy_script respond_to do |format| format.text { render :text => @config.virt_who_bash_script } format.sh { render :text => @config.virt_who_bash_script } format.json end end |
#destroy ⇒ Object
77 78 79 |
# File 'app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb', line 77 def destroy process_response @config.destroy end |
#index ⇒ Object
18 19 20 |
# File 'app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb', line 18 def index @configs = resource_scope_for_index end |
#resource_class ⇒ Object
89 90 91 |
# File 'app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb', line 89 def resource_class ForemanVirtWhoConfigure::Config end |
#resource_scope(*args) ⇒ Object
85 86 87 |
# File 'app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb', line 85 def resource_scope(*args) apply_organization_filter(super) end |
#show ⇒ Object
25 26 |
# File 'app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb', line 25 def show end |
#update ⇒ Object
70 71 72 |
# File 'app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb', line 70 def update process_response @config.update_attributes(config_params) end |