summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Legler <alex@a3li.li>2015-03-15 11:56:57 +0100
committerAlex Legler <alex@a3li.li>2015-03-15 11:56:57 +0100
commitfc1303c200ba3621c6063fe3f9aa91d89c06b21a (patch)
tree72388f5151e2b6b802b36545d34e5b7c649d9312
parentAdd notice on RSS updates (diff)
downloadsecurity-fc1303c200ba3621c6063fe3f9aa91d89c06b21a.tar.gz
security-fc1303c200ba3621c6063fe3f9aa91d89c06b21a.tar.bz2
security-fc1303c200ba3621c6063fe3f9aa91d89c06b21a.zip
Implement yaml dump
-rw-r--r--anzen.rb3
-rw-r--r--lib/helpers.rb10
2 files changed, 13 insertions, 0 deletions
diff --git a/anzen.rb b/anzen.rb
index 86dca94..875eb58 100644
--- a/anzen.rb
+++ b/anzen.rb
@@ -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"