FEATURE: Replace SimpleRSS with Ruby RSS module (#5311)

* SPEC: PollFeedJob parsing atom feed

* add FeedItemAccessor

It is to provide a consistent interface to access a feed item's tag
content.

* add FeedElementInstaller

to install non-standard and non-namespaced feed elements

* FEATURE: replace SimpleRSS with Ruby RSS module

* get FinalDestination and download with Excon

* support namespaced element with FeedElementInstaller
This commit is contained in:
Kyle Zhao
2017-12-05 18:45:09 -05:00
committed by Sam
parent 410994b7f5
commit 5f318a5241
10 changed files with 286 additions and 81 deletions

30
spec/fixtures/feed/feed.atom vendored Normal file
View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<feed
xmlns="http://www.w3.org/2005/Atom"
xmlns:thr="http://purl.org/syndication/thread/1.0"
xmlns:discourse="http://discourse.org/rss/modules/discourse/"
xml:lang="en-US"
xml:base="https://blog.discourse.org/wp-atom.php"
>
<title type="text">Discourse</title>
<subtitle type="text">Official blog for the open source Discourse project</subtitle>
<updated>2017-10-23T23:45:37Z</updated>
<link rel="alternate" type="text/html" href="https://blog.discourse.org" />
<id>https://blog.discourse.org/feed/atom/</id>
<link rel="self" type="application/atom+xml" href="https://blog.discourse.org/feed/atom/" />
<generator uri="https://wordpress.org/" version="4.8.2">WordPress</generator>
<entry>
<discourse:username><![CDATA[xrav3nz]]></discourse:username>
<author>
<name>xrav3nz</name>
</author>
<title type="html"><![CDATA[Poll Feed Spec Fixture]]></title>
<link rel="alternate" type="text/html" href="https://blog.discourse.org/2017/09/poll-feed-spec-fixture/" />
<id>https://blog.discourse.org/?p=pollfeedspec</id>
<updated>2017-09-14T15:22:33Z</updated>
<published>2017-09-14T15:22:33Z</published>
<category scheme="https://blog.discourse.org" term="design" />
<summary type="html"><![CDATA[Here are some random descriptions... [&#8230;]]]></summary>
<content type="html" xml:base="https://blog.discourse.org/2017/09/poll-feed-spec-fixture/"><![CDATA[<p>This is the body &amp; content. </p>]]></content>
</entry>
</feed>

View File

@@ -5,6 +5,7 @@
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:discourse="http://discourse.org/rss/modules/discourse/"
>
<channel>
<title>Discourse</title>
@@ -21,6 +22,7 @@
<link>https://blog.discourse.org/2017/09/poll-feed-spec-fixture/</link>
<pubDate>Thu, 14 Sep 2017 15:22:33 +0000</pubDate>
<dc:creator><![CDATA[xrav3nz]]></dc:creator>
<discourse:username><![CDATA[xrav3nz]]></discourse:username>
<category><![CDATA[spec]]></category>
<guid isPermaLink="false">https://blog.discourse.org/?p=pollfeedspec</guid>
<description><![CDATA[Here are some random descriptions... [&#8230;]]]></description>