Class: Titi::Provider::TwitterRss::UserTimeline

Inherits:
Object
  • Object
show all
Defined in:
lib/titi/provider/twitter/rss_feed.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeUserTimeline

Returns a new instance of UserTimeline.



10
11
12
13
14
15
16
# File 'lib/titi/provider/twitter/rss_feed.rb', line 10

def initialize
  # hi darren
  # self.rss = Feedzirra::Feed.fetch_and_parse("http://twitter.com/statuses/user_timeline/dbounds.rss")
  rss_xml = RestClient.get("http://twitter.com/statuses/user_timeline/dbounds.rss")
  self.raw_feed = Crack::XML.parse(rss_xml.to_s)
  self.rss = raw_feed['rss'].to_mash
end

Instance Attribute Details

#rssObject

Returns the value of attribute rss.



9
10
11
# File 'lib/titi/provider/twitter/rss_feed.rb', line 9

def rss
  @rss
end

Instance Method Details

#entryObject



18
19
20
# File 'lib/titi/provider/twitter/rss_feed.rb', line 18

def entry
  rss[:channel][:item].first
end

#to_activity_stream_entryObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/titi/provider/twitter/rss_feed.rb', line 22

def to_activity_stream_entry
  ActivityStreams::Entry.adapt(
    :id        => entry[:guid],
    :published => entry[:pubDate],
    # :updated   => nil,            # implementor decision
    # :title     => text,
    # :content   => text,
    :verb      => :post
    ) do |entry|
    entry.has_link(:href, :title, :rel, 'text/xhtml')
    #   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