use registered services

This commit is contained in:
Sven Fuchs 2012-11-17 21:05:38 +01:00
parent 79022c7a9c
commit 353b5fa502
17 changed files with 47 additions and 47 deletions

View File

@ -6,10 +6,10 @@ GIT
GIT GIT
remote: git://github.com/getsentry/raven-ruby.git remote: git://github.com/getsentry/raven-ruby.git
revision: 97bbe7211308d1eb1502df4545592c11e56908ae revision: 3cd6f4746e7f111d1e835c7f4c8142aee9d7df03
specs: specs:
sentry-raven (0.3.1) sentry-raven (0.3.1)
faraday (~> 0.8.0.rc2) faraday (>= 0.7.6)
hashie hashie
multi_json (~> 1.0) multi_json (~> 1.0)
uuidtools uuidtools
@ -63,7 +63,7 @@ GIT
GIT GIT
remote: git://github.com/travis-ci/travis-sidekiqs.git remote: git://github.com/travis-ci/travis-sidekiqs.git
revision: 33cf6b1ed576231c1cc5368f734171b4edd4768b revision: 4959bd0c3454b98cbf18a5f506f8f33a9a63689d
specs: specs:
travis-sidekiqs (0.0.1) travis-sidekiqs (0.0.1)
sentry-raven sentry-raven
@ -71,7 +71,7 @@ GIT
GIT GIT
remote: git://github.com/travis-ci/travis-support.git remote: git://github.com/travis-ci/travis-support.git
revision: ce25da5b53d2dbb67798084a87e91b84f5626061 revision: f78d9161369f574f12b9c0c0dbfe13b997766bdd
specs: specs:
travis-support (0.0.1) travis-support (0.0.1)
@ -132,7 +132,7 @@ GEM
coderay (1.0.8) coderay (1.0.8)
connection_pool (0.9.2) connection_pool (0.9.2)
daemons (1.1.9) daemons (1.1.9)
dalli (2.3.0) dalli (2.5.0)
data_migrations (0.0.1) data_migrations (0.0.1)
activerecord activerecord
rake rake
@ -169,7 +169,7 @@ GEM
avl_tree (~> 1.1.2) avl_tree (~> 1.1.2)
hitimes (~> 1.1) hitimes (~> 1.1)
mime-types (1.19) mime-types (1.19)
mocha (0.12.7) mocha (0.13.0)
metaclass (~> 0.0.1) metaclass (~> 0.0.1)
multi_json (1.3.7) multi_json (1.3.7)
multipart-post (1.1.5) multipart-post (1.1.5)
@ -219,21 +219,21 @@ GEM
rerun (0.7.1) rerun (0.7.1)
listen listen
rollout (1.1.0) rollout (1.1.0)
rspec (2.11.0) rspec (2.12.0)
rspec-core (~> 2.11.0) rspec-core (~> 2.12.0)
rspec-expectations (~> 2.11.0) rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.11.0) rspec-mocks (~> 2.12.0)
rspec-core (2.11.1) rspec-core (2.12.0)
rspec-expectations (2.11.3) rspec-expectations (2.12.0)
diff-lcs (~> 1.1.3) diff-lcs (~> 1.1.3)
rspec-mocks (2.11.3) rspec-mocks (2.12.0)
sidekiq (2.5.2) sidekiq (2.5.3)
celluloid (~> 0.12.0) celluloid (~> 0.12.0)
connection_pool (~> 0.9.2) connection_pool (~> 0.9.2)
multi_json (~> 1) multi_json (~> 1)
redis (~> 3) redis (~> 3)
redis-namespace redis-namespace
signature (0.1.6) signature (0.1.4)
simple_states (0.1.1) simple_states (0.1.1)
activesupport activesupport
hashr (~> 0.0.10) hashr (~> 0.0.10)

View File

@ -4,7 +4,7 @@ class Travis::Api::App
class Endpoint class Endpoint
class Accounts < Endpoint class Accounts < Endpoint
get '/', scope: :private do get '/', scope: :private do
respond_with service(:users, :find_accounts, params), type: :accounts respond_with service(:find_user_accounts, params), type: :accounts
end end
end end
end end

View File

@ -7,7 +7,7 @@ class Travis::Api::App
class Artifacts < Endpoint class Artifacts < Endpoint
# Fetches an artifact by it's *id*. # Fetches an artifact by it's *id*.
get '/:id' do |id| get '/:id' do |id|
respond_with service(:artifacts, :find_one, params) respond_with service(:find_artifact, params)
end end
end end
end end

View File

@ -4,7 +4,7 @@ class Travis::Api::App
class Endpoint class Endpoint
class Branches < Endpoint class Branches < Endpoint
get '/' do get '/' do
respond_with service(:branches, :find_all, params), type: :branches respond_with service(:find_branches, params), type: :branches
end end
# get '/:owner_name/:name/branches' do # v1 # get '/:owner_name/:name/branches' do # v1

View File

@ -4,7 +4,7 @@ class Travis::Api::App
class Endpoint class Endpoint
class Broadcasts < Endpoint class Broadcasts < Endpoint
get '/', scope: :private do get '/', scope: :private do
respond_with service(:users, :find_broadcasts, params), type: :broadcasts respond_with service(:find_user_broadcasts, params), type: :broadcasts
end end
end end
end end

View File

@ -4,11 +4,11 @@ class Travis::Api::App
class Endpoint class Endpoint
class Builds < Endpoint class Builds < Endpoint
get '/' do get '/' do
respond_with service(:builds, :find_all, params) respond_with service(:find_builds, params)
end end
get '/:id' do get '/:id' do
respond_with service(:builds, :find_one, params) respond_with service(:find_build, params)
end end
end end
end end

View File

@ -4,7 +4,7 @@ class Travis::Api::App
class Endpoint class Endpoint
class Events < Endpoint class Events < Endpoint
get '/' do get '/' do
respond_with service(:events, :find_all, params), type: :events respond_with service(:find_events, params), type: :events
end end
end end
end end

View File

@ -4,11 +4,11 @@ class Travis::Api::App
class Endpoint class Endpoint
class Hooks < Endpoint class Hooks < Endpoint
get '/', scope: :private do get '/', scope: :private do
respond_with service(:hooks, :find_all, params), type: :hooks respond_with service(:find_hooks, params), type: :hooks
end end
put '/:id?', scope: :private do put '/:id?', scope: :private do
respond_with service(:hooks, :update, id: params[:id] || params[:hook][:id], active: params[:hook][:active]) respond_with service(:update_hook, id: params[:id] || params[:hook][:id], active: params[:hook][:active])
end end
end end
end end

View File

@ -4,11 +4,11 @@ class Travis::Api::App
class Endpoint class Endpoint
class Jobs < Endpoint class Jobs < Endpoint
get '/' do get '/' do
respond_with service(:jobs, :find_all, params) respond_with service(:find_jobs, params)
end end
get '/:id' do get '/:id' do
respond_with service(:jobs, :find_one, params) respond_with service(:find_job, params)
end end
end end
end end

View File

@ -9,31 +9,31 @@ class Travis::Api::App
# owned by johndoe by adding `owner_name=johndoe`, or all repositories that johndoe has access to by adding # owned by johndoe by adding `owner_name=johndoe`, or all repositories that johndoe has access to by adding
# `member=johndoe`. The parameter names correspond to the keys of the response hash. # `member=johndoe`. The parameter names correspond to the keys of the response hash.
get '/' do get '/' do
respond_with service(:repositories, :find_all, params) respond_with service(:find_repos, params)
end end
get '/:id' do get '/:id' do
respond_with service(:repositories, :find_one, params) respond_with service(:find_repo, params)
end end
get '/:id/cc' do get '/:id/cc' do
respond_with service(:repositories, :find_one, params.merge(schema: 'cc')) respond_with service(:find_repo, params.merge(schema: 'cc'))
end end
get '/:owner_name/:name' do get '/:owner_name/:name' do
respond_with service(:repositories, :find_one, params) respond_with service(:find_repo, params)
end end
get '/:owner_name/:name/builds' do get '/:owner_name/:name/builds' do
respond_with service(:builds, :find_all, params) respond_with service(:find_builds, params)
end end
get '/:owner_name/:name/builds/:id' do get '/:owner_name/:name/builds/:id' do
respond_with service(:builds, :find_one, params) respond_with service(:find_build, params)
end end
get '/:owner_name/:name/cc' do get '/:owner_name/:name/cc' do
respond_with service(:repositories, :find_one, params.merge(schema: 'cc')) respond_with service(:find_repo, params.merge(schema: 'cc'))
end end
end end
end end

View File

@ -4,7 +4,7 @@ class Travis::Api::App
class Endpoint class Endpoint
class Requests < Endpoint class Requests < Endpoint
post '/' do post '/' do
respond_with service(:requests, :requeue, params) respond_with service(:requeue_request, params)
end end
end end
end end

View File

@ -4,11 +4,11 @@ class Travis::Api::App
class Endpoint class Endpoint
class Stats < Endpoint class Stats < Endpoint
get '/repos' do get '/repos' do
{ :stats => service(:stats, :daily_repos) } { :stats => service(:find_daily_repos_stats) }
end end
get '/tests' do get '/tests' do
{ :stats => service(:stats, :daily_tests) } { :stats => service(:find_daily_tests_stats) }
end end
end end
end end

View File

@ -24,7 +24,7 @@ class Travis::Api::App
end end
get '/permissions', scope: :private do get '/permissions', scope: :private do
respond_with service(:users, :find_permissions), type: :permissions respond_with service(:find_user_permissions), type: :permissions
end end
# TODO fix url/key generation in ember-data # TODO fix url/key generation in ember-data
@ -38,11 +38,11 @@ class Travis::Api::App
# end # end
put '/:id?', scope: :private do put '/:id?', scope: :private do
respond_with service(:users, :update, params[:user]) respond_with service(:update_user, params[:user])
end end
post '/sync', scope: :private do post '/sync', scope: :private do
respond_with service(:users, :sync) respond_with service(:sync_user)
end end
end end
end end

View File

@ -4,11 +4,11 @@ class Travis::Api::App
class Endpoint class Endpoint
class Workers < Endpoint class Workers < Endpoint
get '/' do get '/' do
respond_with service(:workers, :find_all, params) respond_with service(:find_workers, params)
end end
get '/:id' do get '/:id' do
respond_with service(:workers, :find_one, params) respond_with service(:find_worker, params)
end end
end end
end end

View File

@ -24,7 +24,7 @@ describe 'Hooks' do
let :payload do let :payload do
{ {
:name => 'travis', :name => 'travis',
:events => Travis::Services::Github::SetHook::EVENTS, :events => Travis::Github::Services::SetHook::EVENTS,
:active => true, :active => true,
:config => { :user => user.login, :token => user.tokens.first.token, :domain => 'listener.travis-ci.org' } :config => { :user => user.login, :token => user.tokens.first.token, :domain => 'listener.travis-ci.org' }
} }

View File

@ -0,0 +1,5 @@
require 'spec_helper'
describe Travis::Api::App::Endpoint::Repos do
it 'has to be tested'
end

View File

@ -1,5 +0,0 @@
require 'spec_helper'
describe Travis::Api::App::Endpoint::Repositories do
it 'has to be tested'
end