v3 add /job/:id endpoint
This commit is contained in:
parent
5893241ca5
commit
8e6dbf9319
|
@ -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
|
||||||
|
|
10
lib/travis/api/v3/queries/job.rb
Normal file
10
lib/travis/api/v3/queries/job.rb
Normal 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
|
|
@ -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'
|
||||||
|
|
|
@ -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 }
|
||||||
|
|
7
lib/travis/api/v3/services/job/find.rb
Normal file
7
lib/travis/api/v3/services/job/find.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
module Travis::API::V3
|
||||||
|
class Services::Job::Find < Service
|
||||||
|
def run!
|
||||||
|
find
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user