Sha256: 32d0a5730487f2bcefca3eace2d16e7f8f175412af7a8012cb4cb729d1f97ec4
Contents?: true
Size: 1.54 KB
Versions: 3
Compression:
Stored size: 1.54 KB
Contents
module RestFtpDaemon module API class Root < Grape::API ### LOGGING & HELPERS helpers do def log_prefix ['API', nil, nil] end def logger Root.logger end def log_request if env.nil? puts "HTTP_ENV_IS_NIL: #{env.inspect}" return end request_method = env['REQUEST_METHOD'] request_path = env['REQUEST_PATH'] request_uri = env['REQUEST_URI'] log_info "HTTP #{request_method} #{request_uri}", params end end before do log_request end ### CLASS CONFIG helpers Shared::LoggerHelper logger RestFtpDaemon::LoggerPool.instance.get :api do_not_route_head! do_not_route_options! # version 'v1' format :json content_type :json, 'application/json; charset=utf-8' ### MOUNTPOINTS mount RestFtpDaemon::API::Status => MOUNT_STATUS mount RestFtpDaemon::API::Jobs => MOUNT_JOBS mount RestFtpDaemon::API::Dashbaord => MOUNT_BOARD mount RestFtpDaemon::API::Config => MOUNT_CONFIG mount RestFtpDaemon::API::Debug => MOUNT_DEBUG ### INITIALIZATION def initialize super # Check that Queue and Pool are available raise RestFtpDaemon::MissingQueue unless defined? $queue raise RestFtpDaemon::MissingPool unless defined? $pool end ### ENDPOINTS get "/" do redirect Helpers.dashboard_filter_url() end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rest-ftp-daemon-0.300.3 | lib/rest-ftp-daemon/api/root.rb |
rest-ftp-daemon-0.300.2 | lib/rest-ftp-daemon/api/root.rb |
rest-ftp-daemon-0.300.1 | lib/rest-ftp-daemon/api/root.rb |