travis-api/lib/travis/api/app/endpoint/requests.rb
Piotr Sarnacki 093831c1a2 Add requests API
Requests API allows to get the requests from the DB and thus enable
users to have more insight into what's going on in their repositories.
2014-03-06 19:36:55 +01:00

24 lines
548 B
Ruby

require 'travis/api/app'
class Travis::Api::App
class Endpoint
class Requests < Endpoint
# DEPRECATED: this will be removed by 1st of December
post '/' do
Metriks.meter("api.request.restart").mark
respond_with service(:reset_model, params)
end
get '/' do
begin
respond_with(service(:find_requests, params).run)
rescue Travis::RepositoryNotFoundError => e
status 404
{ "error" => "Repository could not be found" }
end
end
end
end
end