Sha256: 924b59882a67a5d1ebde056f2be0205cf50391d42a10740856fcaa0c5dca10c6

Contents?: true

Size: 799 Bytes

Versions: 2

Compression:

Stored size: 799 Bytes

Contents

module MotherBrain::API
  class V1
    class ServerControlEndpoint < MB::API::Endpoint
      helpers MB::Mixin::Services

      desc "resume the server, preventing new requests from being processed"
      put 'resume' do
        MB::Application.resume
        server_status
      end

      desc "pause the server, preventing new requests from being processed"
      put 'pause' do
        MB::Application.pause
        server_status
      end

      desc "stop the server"
      put 'stop' do
        MB::Application.stop
        status(202)
        server_status
      end

      desc "get the server status"
      get 'status' do
        server_status
      end

      helpers do
        def server_status
          {server_status: MB::Application.status}
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
motherbrain-1.5.0 lib/mb/api/v1/server_control_endpoint.rb
motherbrain-1.4.0 lib/mb/api/v1/server_control_endpoint.rb