diff options
author | 2015-03-15 11:56:57 +0100 | |
---|---|---|
committer | 2015-03-15 11:56:57 +0100 | |
commit | fc1303c200ba3621c6063fe3f9aa91d89c06b21a (patch) | |
tree | 72388f5151e2b6b802b36545d34e5b7c649d9312 | |
parent | Add notice on RSS updates (diff) | |
download | security-fc1303c200ba3621c6063fe3f9aa91d89c06b21a.tar.gz security-fc1303c200ba3621c6063fe3f9aa91d89c06b21a.tar.bz2 security-fc1303c200ba3621c6063fe3f9aa91d89c06b21a.zip |
Implement yaml dump
-rw-r--r-- | anzen.rb | 3 | ||||
-rw-r--r-- | lib/helpers.rb | 10 |
2 files changed, 13 insertions, 0 deletions
@@ -41,6 +41,9 @@ get '/glsa/feed.:format' do when 'rss', 'rss2' content_type :xml feed('2.0', items) + when 'yaml' + content_type :yaml + yaml_dump(items) else status 404 body 'Feed not available.' diff --git a/lib/helpers.rb b/lib/helpers.rb index 9a2f0f1..ab90435 100644 --- a/lib/helpers.rb +++ b/lib/helpers.rb @@ -44,6 +44,16 @@ helpers do COMP_MAP.invert[val] end + def yaml_dump(items) + items.map do |item| + { + 'id' => item.id, + 'title' => item.title, + 'severity' => item.severity + } + end.to_yaml + end + def feed(type, items) RSS::Maker.make(type) do |maker| maker.channel.author = "Gentoo Security Team" |