Add blogroll
This commit is contained in:
9
app/views/blogroll/index.rb
Normal file
9
app/views/blogroll/index.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
module Adamantium
|
||||
module Views
|
||||
module Blogroll
|
||||
class Index < Adamantium::View
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
25
app/views/blogroll/list.rb
Normal file
25
app/views/blogroll/list.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
module Adamantium
|
||||
module Views
|
||||
module Blogroll
|
||||
class List < Adamantium::View
|
||||
include Deps[blogroll_list: "queries.blogroll.index"]
|
||||
|
||||
expose :blogroll do |blogroll_result|
|
||||
JSON.parse(blogroll_result)["subscriptions"].map do |feed|
|
||||
{
|
||||
title: feed["title"],
|
||||
url: feed["url"],
|
||||
html_url: feed["htmlUrl"],
|
||||
icon: feed["iconUrl"],
|
||||
categories: feed["categories"].map {|cat| cat["label"]}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
private_expose :blogroll_result do
|
||||
blogroll_list.call
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
25
app/views/blogroll/opml.rb
Normal file
25
app/views/blogroll/opml.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
module Adamantium
|
||||
module Views
|
||||
module Blogroll
|
||||
class Opml < Adamantium::View
|
||||
include Deps[blogroll_list: "queries.blogroll.index"]
|
||||
|
||||
expose :blogroll do |blogroll_result|
|
||||
JSON.parse(blogroll_result)["subscriptions"].map do |feed|
|
||||
{
|
||||
title: feed["title"],
|
||||
url: feed["url"],
|
||||
html_url: feed["htmlUrl"],
|
||||
icon: feed["iconUrl"],
|
||||
categories: feed["categories"].map {|cat| cat["label"]}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
private_expose :blogroll_result do
|
||||
blogroll_list.call
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user