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
87 88 89 |
# File 'app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb', line 87 def apply_organization_filter(scope) scope.for_organization(Organization.current) end |
#create ⇒ Object
67 68 69 70 |
# File 'app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb', line 67 def create @config = Config.new(config_params) process_response @config.save end |
#deploy_script ⇒ Object
31 32 33 34 35 36 37 |
# File 'app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb', line 31 def deploy_script respond_to do |format| format.text { send_data @config.virt_who_bash_script, :filename => "deploy_virt_who_config_#{@config.id}.sh", :type => 'text/x-shellscript', :disposition => :attachment } format.sh { send_data @config.virt_who_bash_script, :filename => "deploy_virt_who_config_#{@config.id}.sh", :type => 'text/x-shellscript', :disposition => :attachment } format.json end end |
#destroy ⇒ Object
83 84 85 |
# File 'app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb', line 83 def destroy process_response @config.destroy end |
#index ⇒ Object
19 20 21 |
# File 'app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb', line 19 def index @configs = resource_scope_for_index end |
#resource_class ⇒ Object
95 96 97 |
# File 'app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb', line 95 def resource_class ForemanVirtWhoConfigure::Config end |
#resource_scope(*args) ⇒ Object
91 92 93 |
# File 'app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb', line 91 def resource_scope(*args) apply_organization_filter(super) end |
#show ⇒ Object
26 27 |
# File 'app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb', line 26 def show end |
#update ⇒ Object
76 77 78 |
# File 'app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb', line 76 def update process_response @config.update(config_params) end |