Sha256: dd4871451afb64aa75d356999e7c357986d0ababdfab923a7eb5f36b3a907ab7

Contents?: true

Size: 1.23 KB

Versions: 30

Compression:

Stored size: 1.23 KB

Contents

module MnoEnterprise
  class Jpi::V1::Admin::CloudAppsController < Jpi::V1::Admin::BaseResourceController

    # GET /mnoe/jpi/v1/admin/cloud_apps
    def index
      @cloud_apps = MnoEnterprise::App.cloud.all
    end

    # PUT /mnoe/jpi/v1/admin/cloud_apps/:id
    def update
      @cloud_app = MnoEnterprise::App.find params[:id]

      if @cloud_app.update(cloud_app_params)
        render :show, status: :ok
      else
        render json: @cloud_app.errors, status: :unprocessable_entity
      end
    end

    # PUT /mnoe/jpi/v1/admin/cloud_apps/:id/regenerate_api_key
    def regenerate_api_key
      @cloud_app = MnoEnterprise::App.find params[:id]
      @cloud_app.regenerate_api_key!
      render :show
    end

    # PUT /mnoe/jpi/v1/admin/cloud_apps/:id/refresh_metadata
    # params:
    # - metadata_url: the metadata URL
    def refresh_metadata
      @cloud_app = MnoEnterprise::App.find params[:id]
      result = @cloud_app.refresh_metadata! params[:metadata_url]
      if result && result[:errors].blank?
        render :show
      else
        render json: result, status: 400
      end
    end

    private

    def cloud_app_params
      params.require(:cloud_app).permit(:terms_url, :description, :tiny_description)
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
mno-enterprise-api-3.4.0 app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb
mno-enterprise-api-3.3.3 app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb
mno-enterprise-api-3.3.2 app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb
mno-enterprise-api-3.2.1 app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb
mno-enterprise-api-3.3.1 app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb
mno-enterprise-api-3.3.0 app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb
mno-enterprise-api-3.2.0 app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb
mno-enterprise-api-3.1.4 app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb
mno-enterprise-api-3.0.7 app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb
mno-enterprise-api-2.0.9 app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb
mno-enterprise-api-3.1.3 app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb
mno-enterprise-api-3.0.6 app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb
mno-enterprise-api-2.0.8 app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb
mno-enterprise-api-3.1.2 app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb
mno-enterprise-api-3.0.5 app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb
mno-enterprise-api-2.0.7 app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb
mno-enterprise-api-2.0.6 app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb
mno-enterprise-api-2.0.5 app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb
mno-enterprise-api-3.1.1 app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb
mno-enterprise-api-3.0.4 app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb