Class: BuildEval::Server::CruiseControlResponse

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

Instance Method Summary collapse

Constructor Details

#initialize(raw_response) ⇒ CruiseControlResponse

Returns a new instance of CruiseControlResponse.


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

def initialize(raw_response)
  @raw_response = raw_response
end

Instance Method Details

#parse_result(project_selector) ⇒ Object


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

def parse_result(project_selector)
  build_element = Nokogiri::XML(@raw_response.body).xpath(project_selector).first
  raise BuildEval::Server::InvalidSelectorError.new(@raw_response, project_selector) unless build_element
  BuildEval::Result::BuildResult.create(
    build_name:  build_element.attribute("name").value.match(%r{[^\/]+$})[0],
    status_name: build_element.attribute("lastBuildStatus").value
  )
end