Class: TeamcityRestClient::Project
- Inherits:
-
Object
- Object
- TeamcityRestClient::Project
- Defined in:
- lib/teamcity-rest-client.rb
Instance Attribute Summary collapse
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#teamcity ⇒ Object
readonly
Returns the value of attribute teamcity.
Instance Method Summary collapse
- #build_types(filter = {}) ⇒ Object
- #builds(options = {}) ⇒ Object
-
#initialize(teamcity, name, id, href) ⇒ Project
constructor
A new instance of Project.
- #latest_builds(filter = {}) ⇒ Object
Constructor Details
#initialize(teamcity, name, id, href) ⇒ Project
Returns a new instance of Project.
60 61 62 |
# File 'lib/teamcity-rest-client.rb', line 60 def initialize teamcity, name, id, href @teamcity, @name, @id, @href = teamcity, name, id, href end |
Instance Attribute Details
#href ⇒ Object (readonly)
Returns the value of attribute href.
58 59 60 |
# File 'lib/teamcity-rest-client.rb', line 58 def href @href end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
58 59 60 |
# File 'lib/teamcity-rest-client.rb', line 58 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
58 59 60 |
# File 'lib/teamcity-rest-client.rb', line 58 def name @name end |
#teamcity ⇒ Object (readonly)
Returns the value of attribute teamcity.
58 59 60 |
# File 'lib/teamcity-rest-client.rb', line 58 def teamcity @teamcity end |
Instance Method Details
#build_types(filter = {}) ⇒ Object
64 65 66 67 68 69 70 71 72 73 |
# 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 = {}) ⇒ Object
79 80 81 82 |
# File 'lib/teamcity-rest-client.rb', line 79 def builds = {} bt_ids = Set.new(build_types.collect(&:id)) teamcity.builds().find_all { |b| bt_ids.include? b.build_type_id } end |
#latest_builds(filter = {}) ⇒ Object
75 76 77 |
# File 'lib/teamcity-rest-client.rb', line 75 def latest_builds filter = {} build_types(filter).collect(&:latest_build).reject(&:nil?) end |