39 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| module Devops
 | |
|   module API2_0
 | |
|     module Routes
 | |
|       module ReportRoutes
 | |
| 
 | |
|         def self.registered(app)
 | |
| 
 | |
|           app.get_with_headers "/report/all", headers: [:accept] do
 | |
|             json Devops::API2_0::Handler::Report.new(request).all.map{|r| r.to_hash}
 | |
|           end
 | |
| 
 | |
|           app.get_with_headers "/report/all/latest", headers: [:accept] do
 | |
|             json Devops::API2_0::Handler::Report.new(request).all_latest.map{|r| r.to_hash}
 | |
|           end
 | |
| 
 | |
|           app.get_with_headers "/report/all/attributes/:name", headers: [:accept] do |name|
 | |
|             json Devops::API2_0::Handler::Report.new(request).attributes(name)
 | |
|           end
 | |
| 
 | |
|           app.get "/report/:id" do |id|
 | |
|             @text, @done = Devops::API2_0::Handler::Report.new(request).report(id)
 | |
|             erb :report
 | |
|           end
 | |
| 
 | |
|           app.get "/status/:id" do |id|
 | |
|             r = Devops::API2_0::Handler::Report.new(request).status(id)
 | |
|             return [404, "Job with id '#{id}' not found"] if r.nil?
 | |
|             r
 | |
|           end
 | |
| 
 | |
|           puts "Report routes initialized"
 | |
|         end
 | |
| 
 | |
|       end
 | |
|     end
 | |
|   end
 | |
| end
 | |
| 
 |