diff --git a/lib/travis/api/app/responders/xml.rb b/lib/travis/api/app/responders/xml.rb index bc80f254..10c743a5 100644 --- a/lib/travis/api/app/responders/xml.rb +++ b/lib/travis/api/app/responders/xml.rb @@ -6,14 +6,14 @@ module Travis::Api::App::Responders class Xml < Base TEMPLATE_ERB = ERB.new <<-EOF -<% @resource.each do |r| %> - <% next if r.last_completed_build(branch).nil? -%> +<% @resource.each do |repository| %> + <% next if build(repository).nil? -%> <% end %> @@ -44,7 +44,15 @@ module Travis::Api::App::Responders end def branch - params[:branch].present? ? params[:branch] : 'master' + params[:branch] + end + + def build(repository) + if branch.present? + repository.last_complete_build(branch) + else + repository.last_build + end end private