v3 add /job/:id endpoint

This commit is contained in:
carlad 2015-08-27 11:00:09 +02:00
parent 5893241ca5
commit 8e6dbf9319
5 changed files with 28 additions and 0 deletions

View File

@ -55,6 +55,10 @@ module Travis::API::V3
visible? branch.repository visible? branch.repository
end end
def job_visible?(job)
visible? job.repository
end
def organization_visible?(organization) def organization_visible?(organization)
full_access? or public_api? full_access? or public_api?
end end

View File

@ -0,0 +1,10 @@
module Travis::API::V3
class Queries::Job < Query
params :id
def find
return Models::Job.find_by_id(id) if id
raise WrongParams, 'missing build.id'.freeze
end
end
end

View File

@ -50,6 +50,12 @@ module Travis::API::V3
get :find get :find
end end
resource :job do
capture id: :digit
route '/job/{job.id}'
get :find
end
resource :user do resource :user do
capture id: :digit capture id: :digit
route '/user' route '/user'

View File

@ -6,6 +6,7 @@ module Travis::API::V3
Branch = Module.new { extend Services } Branch = Module.new { extend Services }
Build = Module.new { extend Services } Build = Module.new { extend Services }
Builds = Module.new { extend Services } Builds = Module.new { extend Services }
Job = Module.new { extend Services }
Organization = Module.new { extend Services } Organization = Module.new { extend Services }
Organizations = Module.new { extend Services } Organizations = Module.new { extend Services }
Owner = Module.new { extend Services } Owner = Module.new { extend Services }

View File

@ -0,0 +1,7 @@
module Travis::API::V3
class Services::Job::Find < Service
def run!
find
end
end
end