Sha256: 950c4e394cf244fdc3c5204bafec38d5a48e7420813cff037256a86c30b83f7f

Contents?: true

Size: 906 Bytes

Versions: 4

Compression:

Stored size: 906 Bytes

Contents

module RestFtpDaemon
  module API
    class Debug < Grape::API

      desc "Show app routes, params encodings"
      get "/" do
        # Encodings
        encodings = {}
        jobs = $queue.jobs

        jobs.each do |job|
          # here = out[job.id] = {}
          me = encodings[job.id] = {}

          me[:error] = job.error.encoding.to_s unless job.error.nil?
          me[:status] = job.status.encoding.to_s unless job.status.nil?

          Job::FIELDS.each do |name|
            value = job.send(name)
            me[name] = value.encoding.to_s if value.is_a? String
          end

          job.infos.each do |name, value|
            me["infos_#{name}"] = value.encoding.to_s if value.is_a? String
          end
        end

       # Build response
       return  {
          routes: RestFtpDaemon::API::Root.routes,
          encodings: encodings,
          }
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rest-ftp-daemon-0.250.5 lib/rest-ftp-daemon/api/debug.rb
rest-ftp-daemon-0.250.4 lib/rest-ftp-daemon/api/debug.rb
rest-ftp-daemon-0.250.3 lib/rest-ftp-daemon/api/debug.rb
rest-ftp-daemon-0.250.0 lib/rest-ftp-daemon/api/debug.rb