Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

RSS 2.0 Enclosure tag #3

Merged
merged 5 commits into from

2 participants

@syntaxTerr0r

According to RSS2.0 specification, I added the 'enclosure' property to Urss::Feed::Entry
property is initialized to nil and filled up in Urss::Feed::Rss::Entry with the enclosure url attribute if any enclosure tag exist in the current entry.

Sébastien P... added some commits
@zedtux zedtux merged commit 9911870 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 1, 2012
  1. Adding RSS 2.0 enclosure tag support

    Sébastien Poudat authored
  2. Enclosure URL attribute fix

    Sébastien Poudat authored
  3. Updating Version

    Sébastien Poudat authored
  4. Updating Version

    Sébastien Poudat authored
  5. Fix Xpath synthax for enclosure

    Sébastien Poudat authored
This page is out of date. Refresh to see the latest.
View
3  lib/urss/feed/entry.rb
@@ -1,7 +1,7 @@
class Urss::Feed::Entry
# ~~~~ Attributes ~~~~
- attr_accessor :title, :url, :comments_url, :created_at, :author, :categories, :content, :medias
+ attr_accessor :title, :url, :comments_url, :created_at, :author, :categories, :content, :medias, :enclosure
# ~~~~ Class methods ~~~~
@@ -15,6 +15,7 @@ def initialize
self.categories = []
self.content = nil
self.medias = []
+ self.enclosure = nil
end
end
View
1  lib/urss/feed/rss_entry.rb
@@ -17,6 +17,7 @@ def self.build(nokogiri_instance, namespace=nil)
entry.author = nokogiri_instance.xpath("./dc:creator", nokogiri_instance.namespaces).text
entry.categories = nokogiri_instance.search("category").collect(&:text).join(", ")
entry.content = nokogiri_instance.xpath("./description").text
+ entry.enclosure = nokogiri_instance.xpath("./enclosure").attr('url').text if nokogiri_instance.xpath("./enclosure").size > 0
begin
# When having only one media:content then all media:* nodes are used to create one Urss::Media
View
2  lib/urss/version.rb
@@ -1,3 +1,3 @@
module Urss
- VERSION = "0.3.0"
+ VERSION = "0.3.1"
end
View
5 spec/urss/feed/entry_spec.rb
@@ -37,6 +37,11 @@
subject.should respond_to(:content)
subject.should respond_to(:content=)
end
+
+ it "should have an attribute :enclosure" do
+ subject.should respond_to(:enclosure)
+ subject.should respond_to(:enclosure=)
+ end
end
end
Something went wrong with that request. Please try again.