Class: Titi::Provider::GenericRss::Feed
- Inherits:
-
Object
- Object
- Titi::Provider::GenericRss::Feed
- Defined in:
- lib/titi/provider/generic_feed.rb
Instance Attribute Summary collapse
-
#rss ⇒ Object
Returns the value of attribute rss.
Class Method Summary collapse
Instance Method Summary collapse
- #entry ⇒ Object
- #get_via_feedzirra(url) ⇒ Object
- #get_via_restclient_crack(url) ⇒ Object
-
#initialize(rss) ⇒ Feed
constructor
A new instance of Feed.
- #to_activity_stream_entry ⇒ Object
Constructor Details
#initialize(rss) ⇒ Feed
Returns a new instance of Feed.
6 7 8 |
# File 'lib/titi/provider/generic_feed.rb', line 6 def initialize rss self.rss = rss end |
Instance Attribute Details
#rss ⇒ Object
Returns the value of attribute rss.
5 6 7 |
# File 'lib/titi/provider/generic_feed.rb', line 5 def rss @rss end |
Class Method Details
.get(url) ⇒ Object
19 20 21 |
# File 'lib/titi/provider/generic_feed.rb', line 19 def self.get url new Feedzirra::Feed.fetch_and_parse(url) end |
Instance Method Details
#entry ⇒ Object
23 24 25 |
# File 'lib/titi/provider/generic_feed.rb', line 23 def entry rss.entries.first end |
#get_via_feedzirra(url) ⇒ Object
10 11 12 |
# File 'lib/titi/provider/generic_feed.rb', line 10 def get_via_feedzirra url end |
#get_via_restclient_crack(url) ⇒ Object
14 15 16 17 |
# File 'lib/titi/provider/generic_feed.rb', line 14 def get_via_restclient_crack url rss_xml = RestClient.get(url) ; raw_feed = Crack::XML.parse(rss_xml.to_s) ; rss = raw_feed['rss'].to_mash end |
#to_activity_stream_entry ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/titi/provider/generic_feed.rb', line 27 def to_activity_stream_entry ActivityStreams::Entry.adapt({ :activity_verb => :post, :id => entry.entry_id, :title => entry.title, :content => entry.summary, :summary => entry.summary, :published => entry.published }) do |entry| # entry.has_author user.name, user.url # entry.has_obj do |activity_obj| # activity_obj.id = id # activity_obj.title = text # activity_obj.published = created_at # activity_obj.updated = created_at # activity_obj.author = entry.author # end end end |