v3: add api endpoints for enabling/disabling a repo

This commit is contained in:
Konstantin Haase 2015-02-23 11:19:25 +01:00
parent 68c6b9239d
commit 2cf685c450
4 changed files with 20 additions and 1 deletions

View File

@ -7,6 +7,9 @@ module Travis::API::V3
route '/repo/{repository.id}'
get :find
post :enable, '/enable'
post :disable, '/disable'
resource :requests do
route '/requests'
get :find

View File

@ -0,0 +1,7 @@
module Travis::API::V3
class Services::Repository::Disable < Service
def run!(activate = false)
not_implemented
end
end
end

View File

@ -0,0 +1,7 @@
module Travis::API::V3
class Services::Repository::Enable < Services::Repository::Disable
def run!
super(true)
end
end
end

View File

@ -9,7 +9,9 @@ describe Travis::API::V3::ServiceIndex do
describe "custom json entry point" do
let(:expected_resources) {{
"repository" => {
"find" => [{"request-method"=>"GET", "uri-template"=>"#{path}repo/{repository.id}"}] },
"find" => [{"request-method"=>"GET", "uri-template"=>"#{path}repo/{repository.id}"}],
"enable" => [{"request-method"=>"POST", "uri-template"=>"#{path}repo/{repository.id}/enable"}],
"disable" => [{"request-method"=>"POST", "uri-template"=>"#{path}repo/{repository.id}/disable"}] },
"repositories" => {
"for_current_user" => [{"request-method"=>"GET", "uri-template"=>"#{path}repos"}] },
"build" => {