7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/go_api_client/parsers/entry_parser.rb', line 7
def parse(root)
GoApiClient::Domain::Entry.new(
{
:title => root.xpath('xmlns:title').first.content,
:id => root.xpath('xmlns:id').first.content,
:updated => Time.parse(root.xpath('xmlns:updated').first.content).utc,
:stage_uri => href_from(root.xpath("xmlns:link[@type='application/vnd.go+xml' and @rel='alternate']")),
:pipeline_uri => href_from(root.xpath("xmlns:link[@type='application/vnd.go+xml' and @rel='http://www.thoughtworks-studios.com/ns/relations/go/pipeline']")),
:parsed_authors => root.xpath('xmlns:author').collect do |element|
GoApiClient::Parsers::Author.parse(element)
end,
:parsed_categories => root.xpath('xmlns:category').collect do |element|
{:term => element.attributes['term'].value, :label => element.attributes['label'].value}
end,
})
end
|