Class: GoApiClient::Parsers::Material

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

Class Method Summary collapse

Class Method Details

.parse(root) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/go_api_client/parsers/material_parser.rb', line 8

def parse(root)
  url = root.attributes['url'].value if root.attributes['url']
  branch = root.attributes['url'].value if root.attributes['branch']
  pipeline_name = root.attributes['pipelineName'].value if root.attributes['pipelineName']
  stage_name = root.attributes['stageName'].value if root.attributes['stageName']
  GoApiClient::Domain::Material.new(
      {
          :uri => root.attributes['materialUri'].value,
          :type => root.attributes['type'].value,
          :url => url,
          :branch => branch,
          :pipeline_name => pipeline_name,
          :stage_name => stage_name,
          :parsed_changesets => root.xpath('./modifications/changeset').collect do |element|
            GoApiClient::Parsers::Changeset.parse(element)
          end
      })
end