add builds
This commit is contained in:
parent
69a4a0a735
commit
fe9a6536d7
13
lib/travis/api/v3/queries/builds.rb
Normal file
13
lib/travis/api/v3/queries/builds.rb
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
module Travis::API::V3
|
||||||
|
class Queries::Builds < Query
|
||||||
|
def find(repository)
|
||||||
|
repository.builds
|
||||||
|
end
|
||||||
|
|
||||||
|
def count(repository, time_frame)
|
||||||
|
find(repository).
|
||||||
|
where(event_type: 'api'.freeze, result: 'accepted'.freeze).
|
||||||
|
where('created_at > ?'.freeze, time_frame.ago).count
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
6
lib/travis/api/v3/renderer/builds.rb
Normal file
6
lib/travis/api/v3/renderer/builds.rb
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
module Travis::API::V3
|
||||||
|
class Renderer::Builds < Renderer::CollectionRenderer
|
||||||
|
type :builds
|
||||||
|
collection_key :builds
|
||||||
|
end
|
||||||
|
end
|
|
@ -39,6 +39,11 @@ module Travis::API::V3
|
||||||
get :for_current_user
|
get :for_current_user
|
||||||
end
|
end
|
||||||
|
|
||||||
|
resource :builds do
|
||||||
|
route '/builds'
|
||||||
|
get :find
|
||||||
|
end
|
||||||
|
|
||||||
resource :build do
|
resource :build do
|
||||||
capture id: :digit
|
capture id: :digit
|
||||||
route '/build/{build.id}'
|
route '/build/{build.id}'
|
||||||
|
|
|
@ -5,6 +5,7 @@ module Travis::API::V3
|
||||||
Accounts = Module.new { extend Services }
|
Accounts = Module.new { extend Services }
|
||||||
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 }
|
||||||
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/builds/find.rb
Normal file
7
lib/travis/api/v3/services/builds/find.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
module Travis::API::V3
|
||||||
|
class Services::Builds::Find < Service
|
||||||
|
def run!
|
||||||
|
find(:builds, find(:repository))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user