diff --git a/lib/travis/api/v3/queries/crons.rb b/lib/travis/api/v3/queries/crons.rb new file mode 100644 index 00000000..b642ba3b --- /dev/null +++ b/lib/travis/api/v3/queries/crons.rb @@ -0,0 +1,8 @@ +module Travis::API::V3 + class Queries::Crons < Query + + def find(repository) + repository.crons + end + end +end diff --git a/lib/travis/api/v3/renderer/crons.rb b/lib/travis/api/v3/renderer/crons.rb new file mode 100644 index 00000000..89215f16 --- /dev/null +++ b/lib/travis/api/v3/renderer/crons.rb @@ -0,0 +1,6 @@ +module Travis::API::V3 + class Renderer::Crons < Renderer::CollectionRenderer + type :crons + collection_key :crons + end +end diff --git a/lib/travis/api/v3/routes.rb b/lib/travis/api/v3/routes.rb index afb6b910..8340a0d9 100644 --- a/lib/travis/api/v3/routes.rb +++ b/lib/travis/api/v3/routes.rb @@ -95,6 +95,11 @@ module Travis::API::V3 get :find end + resource :crons do + route '/crons' + get :find + end + resource :requests do route '/requests' get :find diff --git a/lib/travis/api/v3/services.rb b/lib/travis/api/v3/services.rb index be4eb721..9fb812b6 100644 --- a/lib/travis/api/v3/services.rb +++ b/lib/travis/api/v3/services.rb @@ -10,6 +10,7 @@ module Travis::API::V3 Build = Module.new { extend Services } Builds = Module.new { extend Services } Cron = Module.new { extend Services } + Crons = Module.new { extend Services } Job = Module.new { extend Services } Jobs = Module.new { extend Services } Organization = Module.new { extend Services } diff --git a/lib/travis/api/v3/services/crons/find.rb b/lib/travis/api/v3/services/crons/find.rb new file mode 100644 index 00000000..22099794 --- /dev/null +++ b/lib/travis/api/v3/services/crons/find.rb @@ -0,0 +1,9 @@ +module Travis::API::V3 + class Services::Crons::Find < Service + paginate + + def run! + query.find(find(:repository)) + end + end +end