module MicroServiceClient::Concerns::Controllers::Servers

Public Instance Methods

create() click to toggle source
# File lib/micro_service_client/concerns/controllers/servers.rb, line 7
def create
        MicroServiceServerInstallJob.perform_later(install_params)

        render :nothing => true, :status => 204
end
destroy() click to toggle source
# File lib/micro_service_client/concerns/controllers/servers.rb, line 13
def destroy
        status = 403

        @server = MicroService::Server.where(uninstall_params).first
        if @server && @server.update_attributes(:uninstalled => true)
                status = 204
        end

        render :nothing => true, :status => status
end

Private Instance Methods

install_params() click to toggle source
# File lib/micro_service_client/concerns/controllers/servers.rb, line 38
def install_params
        data = json_params

        data.permit(
                :client_id,
                :url,
                :secret,
        )
end
json_params() click to toggle source
# File lib/micro_service_client/concerns/controllers/servers.rb, line 25
def json_params
        ActionController::Parameters.new(JSON.parse(request.body.read))
end
uninstall_params() click to toggle source
# File lib/micro_service_client/concerns/controllers/servers.rb, line 29
def uninstall_params
        data = json_params

        data.permit(
                :id,
                :secret,
        )
end