use Job::Test

This commit is contained in:
Sven Fuchs 2012-07-22 15:37:58 +02:00
parent 76324f00a1
commit cca12ce0c9
2 changed files with 7 additions and 7 deletions

View File

@ -46,11 +46,11 @@ module Travis
end end
get '/jobs' do get '/jobs' do
respond_with Service::Jobs.new(params).collection respond_with Service::Jobs.new(params).collection, :type => 'jobs'
end end
get '/jobs/:id' do get '/jobs/:id' do
respond_with Service::Jobs.new(params).item respond_with Service::Jobs.new(params).item, :type => 'job'
end end
get '/artifacts/:id' do get '/artifacts/:id' do
@ -88,8 +88,8 @@ module Travis
@user = User.find_by_login('svenfuchs') @user = User.find_by_login('svenfuchs')
end end
def respond_with(resource, params = {}) def respond_with(resource, options = {})
Travis::Api.data(resource, :params => self.params.merge(params), :version => version).to_json Travis::Api.data(resource, { :params => params, :version => version }.merge(options)).to_json
end end
def version def version

View File

@ -5,16 +5,16 @@ module Travis
class Jobs < Service class Jobs < Service
def collection def collection
if params[:ids] if params[:ids]
Job.where(:id => params[:ids]).includes(:commit, :log) Job::Test.where(:id => params[:ids]).includes(:commit, :log)
else else
jobs = Job.queued.includes(:commit, :log) jobs = Job::Test.queued.includes(:commit, :log)
jobs = jobs.where(:queue => params[:queue]) if params[:queue] jobs = jobs.where(:queue => params[:queue]) if params[:queue]
jobs jobs
end end
end end
def item def item
Job.find(params[:id]) Job::Test.find(params[:id])
end end
end end
end end