diff --git a/lib/travis/api/v3/queries/branches.rb b/lib/travis/api/v3/queries/branches.rb new file mode 100644 index 00000000..0491e0b2 --- /dev/null +++ b/lib/travis/api/v3/queries/branches.rb @@ -0,0 +1,7 @@ +module Travis::API::V3 + class Queries::Branches < Query + def find(repository) + repository.branches + end + end +end diff --git a/lib/travis/api/v3/renderer/branches.rb b/lib/travis/api/v3/renderer/branches.rb new file mode 100644 index 00000000..4a927c23 --- /dev/null +++ b/lib/travis/api/v3/renderer/branches.rb @@ -0,0 +1,6 @@ +module Travis::API::V3 + class Renderer::Branches < Renderer::CollectionRenderer + type :branches + collection_key :branches + end +end diff --git a/lib/travis/api/v3/routes.rb b/lib/travis/api/v3/routes.rb index 926d6776..c2337f56 100644 --- a/lib/travis/api/v3/routes.rb +++ b/lib/travis/api/v3/routes.rb @@ -12,6 +12,9 @@ module Travis::API::V3 capture id: :digit route '/build/{build.id}' get :find + + # post :cancel, '/cancel' + # post :restart, '/restart' end resource :job do diff --git a/lib/travis/api/v3/services.rb b/lib/travis/api/v3/services.rb index a25984f1..5098e10f 100644 --- a/lib/travis/api/v3/services.rb +++ b/lib/travis/api/v3/services.rb @@ -4,6 +4,7 @@ module Travis::API::V3 Accounts = Module.new { extend Services } Branch = Module.new { extend Services } + Branch = Module.new { extend Services } Build = Module.new { extend Services } Builds = Module.new { extend Services } Job = Module.new { extend Services } diff --git a/lib/travis/api/v3/services/branches/find.rb b/lib/travis/api/v3/services/branches/find.rb new file mode 100644 index 00000000..76e22c31 --- /dev/null +++ b/lib/travis/api/v3/services/branches/find.rb @@ -0,0 +1,9 @@ +module Travis::API::V3 + class Services::Branches::Find < Service + paginate + def run! + query.find(find(:repository)) + end + end + +end