class TeamcityRestClient::Project

Attributes

href[R]
id[R]
name[R]
teamcity[R]

Public Class Methods

new(teamcity, name, id, href) click to toggle source
# File lib/teamcity-rest-client.rb, line 60
def initialize teamcity, name, id, href
  @teamcity, @name, @id, @href = teamcity, name, id, href
end

Public Instance Methods

build_types(filter = {}) click to toggle source
# File lib/teamcity-rest-client.rb, line 64
def build_types filter = {}
  including = filter.has_key?(:include) ? IncludeFilter.new(filter.delete(:include)) : IncludeAllFilter.new
  excluding = filter.has_key?(:exclude) ? ExcludeFilter.new(filter.delete(:exclude)) : ExcludeNoneFilter.new
  raise "Unsupported filter options #{filter}" unless filter.empty?
  build_types_for_project = teamcity.build_types.find_all { |bt| bt.project_id == id }
  filtered_build_types = build_types_for_project.find_all { |bt| including.retain?(bt) && excluding.retain?(bt) }
  raise "Failed to find a match for build type(s) #{including.misses}" if not including.misses.empty?
  raise "Failed to find a match for build type(s) #{excluding.misses}" if not excluding.misses.empty?
  filtered_build_types
end
builds(options = {}) click to toggle source
# File lib/teamcity-rest-client.rb, line 79
def builds options = {}
  bt_ids = Set.new(build_types.collect(&:id))
  teamcity.builds(options).find_all { |b| bt_ids.include? b.build_type_id }
end
latest_builds(filter = {}) click to toggle source
# File lib/teamcity-rest-client.rb, line 75
def latest_builds filter = {}
  build_types(filter).collect(&:latest_build).reject(&:nil?)
end