Sha256: 1d1a12a6840603a29f41ece64e7b12465a0a033edb018042fa3cb2eb53787879

Contents?: true

Size: 592 Bytes

Versions: 4

Compression:

Stored size: 592 Bytes

Contents

module Coupler
  module Extensions
    module Jobs
      def self.registered(app)
        app.get "/jobs" do
          @jobs = Models::Job.order("id DESC")
          erb 'jobs/index'.to_sym
        end

        app.get "/jobs/count" do
          content_type :json
          [200, [Models::Job.filter(:completed_at => nil).count.to_json]]
        end

        app.get "/jobs/:id/progress" do
          content_type :text
          @job = Models::Job[:id => params[:id]]
          [200, [{ :completed => @job.completed, :total => @job.total }.to_json]]
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
coupler-0.0.9-java lib/coupler/extensions/jobs.rb
coupler-0.0.8-java lib/coupler/extensions/jobs.rb
coupler-0.0.7-java lib/coupler/extensions/jobs.rb
coupler-0.0.6-java lib/coupler/extensions/jobs.rb