Class: BuildEval::Server::TeamCity

Inherits:
Object
  • Object
show all
Defined in:
lib/build_eval/server/team_city.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ TeamCity

Returns a new instance of TeamCity.


6
7
8
9
# File 'lib/build_eval/server/team_city.rb', line 6

def initialize(args)
  @http     = BuildEval::Http.new(args)
  @base_uri = args[:uri]
end

Instance Method Details

#build_result(build_name, _branch_name) ⇒ Object


11
12
13
14
15
16
17
# File 'lib/build_eval/server/team_city.rb', line 11

def build_result(build_name, _branch_name)
  response = @http.get("#{@base_uri}/httpAuth/app/rest/buildTypes/id:#{build_name}/builds")
  build_element = Nokogiri::XML(response.body).xpath("//build").first
  raise "Unexpected build response: #{response.message}" unless build_element
  BuildEval::Result::BuildResult.create(build_name:  build_name,
                                        status_name: build_element.attribute("status").value)
end

#to_sObject


19
20
21
# File 'lib/build_eval/server/team_city.rb', line 19

def to_s
  "TeamCity server #{@base_uri}"
end