Class: GoApiClient::Parsers::Project

Inherits:
Helper
  • Object
show all
Defined in:
lib/go_api_client/parsers/project_parser.rb

Class Method Summary collapse

Methods inherited from Helper

href_from

Class Method Details

.parse(root) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/go_api_client/parsers/project_parser.rb', line 7

def parse(root)
  messages = root.xpath('./messages/message').collect do |element|
    {:text => element.attributes['text'].value, :kind => element.attributes['kind'].value}
  end if root.xpath('./messages/message')
  GoApiClient::Domain::Project.new(
      {
          :name => root.attributes['name'].value,
          :activity => root.attributes['activity'].value,
          :last_build_status => root.attributes['lastBuildStatus'].value,
          :last_build_label => root.attributes['lastBuildLabel'].value,
          :last_build_time => Time.parse(root.attributes['lastBuildTime'].value).utc,
          :web_uri => root.attributes['webUrl'].value,
          :parsed_messages => messages
      })
end