titi 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. data/README.textile +23 -4
  2. data/VERSION +1 -1
  3. data/examples/twitter.rb +4 -12
  4. data/lib/titi.rb +6 -0
  5. data/lib/titi/fetcher.rb +5 -0
  6. data/lib/titi/fetcher/json.rb +32 -0
  7. data/lib/titi/provider.rb +0 -23
  8. data/lib/titi/provider/activity_streams.rb +10 -139
  9. data/lib/titi/provider/activity_streams/activity_streams_struct.rb +46 -0
  10. data/lib/titi/provider/activity_streams/actor.rb +11 -0
  11. data/lib/titi/provider/activity_streams/address.rb +11 -0
  12. data/lib/titi/provider/activity_streams/entry.rb +38 -0
  13. data/lib/titi/provider/activity_streams/feed.rb +25 -0
  14. data/lib/titi/provider/activity_streams/feed.xml.erb +13 -11
  15. data/lib/titi/provider/activity_streams/link.rb +15 -0
  16. data/lib/titi/provider/activity_streams/obj.rb +19 -0
  17. data/lib/titi/provider/ameba/.gitignore +0 -0
  18. data/lib/titi/provider/avatars_united/.gitignore +0 -0
  19. data/lib/titi/provider/baidu/.gitignore +0 -0
  20. data/lib/titi/provider/bebo/.gitignore +0 -0
  21. data/lib/titi/provider/blipfm/.gitignore +0 -0
  22. data/lib/titi/provider/blippr/.gitignore +0 -0
  23. data/lib/titi/provider/bliptv/.gitignore +0 -0
  24. data/lib/titi/provider/blogger/.gitignore +0 -0
  25. data/lib/titi/provider/brightkite/.gitignore +0 -0
  26. data/lib/titi/provider/buzznet/.gitignore +0 -0
  27. data/lib/titi/provider/cinchcast/.gitignore +0 -0
  28. data/lib/titi/provider/corkd/.gitignore +0 -0
  29. data/lib/titi/provider/daily_motion/.gitignore +0 -0
  30. data/lib/titi/provider/delicious/.gitignore +0 -0
  31. data/lib/titi/provider/deviant_art/.gitignore +0 -0
  32. data/lib/titi/provider/digg/.gitignore +0 -0
  33. data/lib/titi/provider/diigo/.gitignore +0 -0
  34. data/lib/titi/provider/douban/.gitignore +0 -0
  35. data/lib/titi/provider/flickr/.gitignore +0 -0
  36. data/lib/titi/provider/flixster/.gitignore +0 -0
  37. data/lib/titi/provider/fotolog/.gitignore +0 -0
  38. data/lib/titi/provider/friendfeed/.gitignore +0 -0
  39. data/lib/titi/provider/friendster/.gitignore +0 -0
  40. data/lib/titi/provider/funny_or_die/.gitignore +0 -0
  41. data/lib/titi/provider/gamer_dna/.gitignore +0 -0
  42. data/lib/titi/provider/gather/.gitignore +0 -0
  43. data/lib/titi/provider/generic_feed.rb +49 -0
  44. data/lib/titi/provider/generic_feed/.gitignore +0 -0
  45. data/lib/titi/provider/goodreads/.gitignore +0 -0
  46. data/lib/titi/provider/google_reader/.gitignore +0 -0
  47. data/lib/titi/provider/hatena/.gitignore +0 -0
  48. data/lib/titi/provider/hi5/.gitignore +0 -0
  49. data/lib/titi/provider/hulu/.gitignore +0 -0
  50. data/lib/titi/provider/hyves/.gitignore +0 -0
  51. data/lib/titi/provider/identica/.gitignore +0 -0
  52. data/lib/titi/provider/ilike/.gitignore +0 -0
  53. data/lib/titi/provider/jaiku/.gitignore +0 -0
  54. data/lib/titi/provider/joost/.gitignore +0 -0
  55. data/lib/titi/provider/lastfm/.gitignore +0 -0
  56. data/lib/titi/provider/librarything/.gitignore +0 -0
  57. data/lib/titi/provider/list_of_providers.rb +142 -0
  58. data/lib/titi/provider/livejournal/.gitignore +0 -0
  59. data/lib/titi/provider/meneame/.gitignore +0 -0
  60. data/lib/titi/provider/metacafe/.gitignore +0 -0
  61. data/lib/titi/provider/mixx/.gitignore +0 -0
  62. data/lib/titi/provider/moby_picture/.gitignore +0 -0
  63. data/lib/titi/provider/multiply/.gitignore +0 -0
  64. data/lib/titi/provider/netlog/.gitignore +0 -0
  65. data/lib/titi/provider/newsvine/.gitignore +0 -0
  66. data/lib/titi/provider/pandora/.gitignore +0 -0
  67. data/lib/titi/provider/photobucket/.gitignore +0 -0
  68. data/lib/titi/provider/photocase/.gitignore +0 -0
  69. data/lib/titi/provider/picasa/.gitignore +0 -0
  70. data/lib/titi/provider/plurk/.gitignore +0 -0
  71. data/lib/titi/provider/posterous/.gitignore +0 -0
  72. data/lib/titi/provider/propeller/.gitignore +0 -0
  73. data/lib/titi/provider/qik/.gitignore +0 -0
  74. data/lib/titi/provider/qype/.gitignore +0 -0
  75. data/lib/titi/provider/raptr/.gitignore +0 -0
  76. data/lib/titi/provider/readernaut/.gitignore +0 -0
  77. data/lib/titi/provider/reddit/.gitignore +0 -0
  78. data/lib/titi/provider/revver/.gitignore +0 -0
  79. data/lib/titi/provider/skyrock/.gitignore +0 -0
  80. data/lib/titi/provider/slideshare/.gitignore +0 -0
  81. data/lib/titi/provider/smotri/.gitignore +0 -0
  82. data/lib/titi/provider/smugmug/.gitignore +0 -0
  83. data/lib/titi/provider/stumbleupon/.gitignore +0 -0
  84. data/lib/titi/provider/tumblr/.gitignore +0 -0
  85. data/lib/titi/provider/twelve_seconds/.gitignore +0 -0
  86. data/lib/titi/provider/twine/.gitignore +0 -0
  87. data/lib/titi/provider/twitter.rb +18 -15
  88. data/lib/titi/provider/twitter/.gitignore +0 -0
  89. data/lib/titi/provider/{twitter_rss → twitter}/README.textile +0 -0
  90. data/lib/titi/provider/twitter/models.rb +9 -11
  91. data/lib/titi/provider/{twitter_rss/models.rb → twitter/rss_feed.rb} +9 -10
  92. data/lib/titi/provider/vimeo/.gitignore +0 -0
  93. data/lib/titi/provider/visualizeus/.gitignore +0 -0
  94. data/lib/titi/provider/wordpress/.gitignore +0 -0
  95. data/lib/titi/provider/xanga/.gitignore +0 -0
  96. data/lib/titi/provider/yelp/.gitignore +0 -0
  97. data/lib/titi/provider/zooomr/.gitignore +0 -0
  98. data/spec/data/provider/ameba/.gitignore +0 -0
  99. data/spec/data/provider/avatars_united/.gitignore +0 -0
  100. data/spec/data/provider/baidu/.gitignore +0 -0
  101. data/spec/data/provider/bebo/.gitignore +0 -0
  102. data/spec/data/provider/blipfm/.gitignore +0 -0
  103. data/spec/data/provider/blippr/.gitignore +0 -0
  104. data/spec/data/provider/bliptv/.gitignore +0 -0
  105. data/spec/data/provider/blogger/.gitignore +0 -0
  106. data/spec/data/provider/brightkite/.gitignore +0 -0
  107. data/spec/data/provider/buzznet/.gitignore +0 -0
  108. data/spec/data/provider/cinchcast/.gitignore +0 -0
  109. data/spec/data/provider/corkd/.gitignore +0 -0
  110. data/spec/data/provider/daily_motion/.gitignore +0 -0
  111. data/spec/data/provider/delicious/.gitignore +0 -0
  112. data/spec/data/provider/delicious/delicious_bookmarks-activity_streams.xml +440 -0
  113. data/spec/data/provider/delicious/delicious_bookmarks-raw_feed.xml +239 -0
  114. data/spec/data/provider/deviant_art/.gitignore +0 -0
  115. data/spec/data/provider/digg/.gitignore +0 -0
  116. data/spec/data/provider/diigo/.gitignore +0 -0
  117. data/spec/data/provider/douban/.gitignore +0 -0
  118. data/spec/data/provider/flickr/.gitignore +0 -0
  119. data/spec/data/provider/flickr/flickr_favorites-activity_streams.xml +1040 -0
  120. data/spec/data/provider/flickr/flickr_favorites-raw_rss.xml +557 -0
  121. data/spec/data/provider/flixster/.gitignore +0 -0
  122. data/spec/data/provider/fotolog/.gitignore +0 -0
  123. data/spec/data/provider/friendfeed/.gitignore +0 -0
  124. data/spec/data/provider/friendster/.gitignore +0 -0
  125. data/spec/data/provider/funny_or_die/.gitignore +0 -0
  126. data/spec/data/provider/gamer_dna/.gitignore +0 -0
  127. data/spec/data/provider/gather/.gitignore +0 -0
  128. data/spec/data/provider/generic_feed/.gitignore +0 -0
  129. data/spec/data/provider/goodreads/.gitignore +0 -0
  130. data/spec/data/provider/google_reader/.gitignore +0 -0
  131. data/spec/data/provider/hatena/.gitignore +0 -0
  132. data/spec/data/provider/hi5/.gitignore +0 -0
  133. data/spec/data/provider/hulu/.gitignore +0 -0
  134. data/spec/data/provider/hyves/.gitignore +0 -0
  135. data/spec/data/provider/identica/.gitignore +0 -0
  136. data/spec/data/provider/identica/identica_statuses-raw_feed.xml +465 -0
  137. data/spec/data/provider/ilike/.gitignore +0 -0
  138. data/spec/data/provider/jaiku/.gitignore +0 -0
  139. data/spec/data/provider/joost/.gitignore +0 -0
  140. data/spec/data/provider/lastfm/.gitignore +0 -0
  141. data/spec/data/provider/librarything/.gitignore +0 -0
  142. data/spec/data/provider/livejournal/.gitignore +0 -0
  143. data/spec/data/provider/meneame/.gitignore +0 -0
  144. data/spec/data/provider/metacafe/.gitignore +0 -0
  145. data/spec/data/provider/mixx/.gitignore +0 -0
  146. data/spec/data/provider/moby_picture/.gitignore +0 -0
  147. data/spec/data/provider/multiply/.gitignore +0 -0
  148. data/spec/data/provider/netlog/.gitignore +0 -0
  149. data/spec/data/provider/newsvine/.gitignore +0 -0
  150. data/spec/data/provider/pandora/.gitignore +0 -0
  151. data/spec/data/provider/photobucket/.gitignore +0 -0
  152. data/spec/data/provider/photocase/.gitignore +0 -0
  153. data/spec/data/provider/picasa/.gitignore +0 -0
  154. data/spec/data/provider/plurk/.gitignore +0 -0
  155. data/spec/data/provider/posterous/.gitignore +0 -0
  156. data/spec/data/provider/propeller/.gitignore +0 -0
  157. data/spec/data/provider/qik/.gitignore +0 -0
  158. data/spec/data/provider/qype/.gitignore +0 -0
  159. data/spec/data/provider/raptr/.gitignore +0 -0
  160. data/spec/data/provider/readernaut/.gitignore +0 -0
  161. data/spec/data/provider/reddit/.gitignore +0 -0
  162. data/spec/data/provider/revver/.gitignore +0 -0
  163. data/spec/data/provider/skyrock/.gitignore +0 -0
  164. data/spec/data/provider/slideshare/.gitignore +0 -0
  165. data/spec/data/provider/smotri/.gitignore +0 -0
  166. data/spec/data/provider/smugmug/.gitignore +0 -0
  167. data/spec/data/provider/stumbleupon/.gitignore +0 -0
  168. data/spec/data/provider/tumblr/.gitignore +0 -0
  169. data/spec/data/provider/tumblr/tumblr_posts-raw_feed.xml +150 -0
  170. data/spec/data/provider/twelve_seconds/.gitignore +0 -0
  171. data/spec/data/provider/twine/.gitignore +0 -0
  172. data/spec/data/provider/twitter/.gitignore +0 -0
  173. data/spec/data/provider/twitter/twitter-api_user_timeline-activity_streams.xml +27 -0
  174. data/spec/data/provider/twitter/twitter-api_user_timeline-raw_json.json +1 -0
  175. data/spec/data/provider/twitter/twitter_rss_user_timeline-activity_streams.xml +46 -0
  176. data/spec/data/provider/twitter/twitter_rss_user_timeline-raw_feed.xml +83 -0
  177. data/spec/data/provider/vimeo/.gitignore +0 -0
  178. data/spec/data/provider/visualizeus/.gitignore +0 -0
  179. data/spec/data/provider/wordpress/.gitignore +0 -0
  180. data/spec/data/provider/xanga/.gitignore +0 -0
  181. data/spec/data/provider/yelp/.gitignore +0 -0
  182. data/spec/data/provider/youtube/youtube_videos-activity_streams.xml +629 -0
  183. data/spec/data/provider/youtube/youtube_videos-raw_feed.xml +51 -0
  184. data/spec/data/provider/zooomr/.gitignore +0 -0
  185. data/spec/spec_helper.rb +3 -2
  186. data/spec/support/compare_to_standard_example.rb +17 -0
  187. data/spec/titi_spec.rb +8 -2
  188. data/titi.gemspec +179 -5
  189. metadata +180 -6
  190. data/lib/titi/provider/generic_rss.rb +0 -50
@@ -0,0 +1,15 @@
1
+ module Titi::Provider::ActivityStreams
2
+
3
+ # <link href="http://twitter.com/banksean/statuses/12244282580"
4
+ # type="text/xhtml" rel="via" title="Just saw a @cliqset #salmon @-mention interop demo by @jpanzer. Very neat stuff!">
5
+ # </link>
6
+
7
+ Link = ActivityStreamsStruct.new(
8
+ :href,
9
+ :title,
10
+ :rel,
11
+ :type
12
+ )
13
+ Link.class_eval do
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ module Titi::Provider::ActivityStreams
2
+ # ActivityStream object.
3
+ # We can't call them 'Object' (ruby has a class like that already :)
4
+ # http://activitystrea.ms/spec/1.0/atom-activity-01.html#activityobjectelement
5
+ Obj = ActivityStreamsStruct.new(
6
+ :id,
7
+ :title,
8
+ :content,
9
+ :link_alt,
10
+ :published,
11
+ :updated,
12
+ #
13
+ :author,
14
+ :object_type, # video, post, file
15
+ :vevent
16
+ )
17
+ Obj.class_eval do
18
+ end
19
+ end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,49 @@
1
+ module Titi::Provider
2
+ module GenericRss
3
+
4
+ class Feed
5
+ attr_accessor :rss
6
+ def initialize rss
7
+ self.rss = rss
8
+ end
9
+
10
+ def get_via_feedzirra url
11
+
12
+ end
13
+
14
+ def get_via_restclient_crack url
15
+ rss_xml = RestClient.get(url) ;
16
+ raw_feed = Crack::XML.parse(rss_xml.to_s) ; rss = raw_feed['rss'].to_mash
17
+ end
18
+
19
+ def self.get url
20
+ new Feedzirra::Feed.fetch_and_parse(url)
21
+ end
22
+
23
+ def entry
24
+ rss.entries.first
25
+ end
26
+
27
+ def to_activity_stream_entry
28
+ ActivityStreams::Entry.adapt({
29
+ :activity_verb => :post,
30
+ :id => entry.entry_id,
31
+ :title => entry.title,
32
+ :content => entry.summary,
33
+ :summary => entry.summary,
34
+ :published => entry.published
35
+ }) do |entry|
36
+ # entry.has_author user.name, user.url
37
+ # entry.has_obj do |activity_obj|
38
+ # activity_obj.id = id
39
+ # activity_obj.title = text
40
+ # activity_obj.published = created_at
41
+ # activity_obj.updated = created_at
42
+ # activity_obj.author = entry.author
43
+ # end
44
+ end
45
+
46
+ end
47
+ end
48
+ end
49
+ end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,142 @@
1
+ # Thank to "Cliqset":http://feedproxy.cliqset.com/feed/selection and Rob Dolin:
2
+ PROVIDERS = {
3
+ # Feeds from http://feedproxy.cliqset.com/feed/selection
4
+ # it uses straight-lowercased names, not underscored. We've gone underscored. Dunno which to choose
5
+ :social => %w[ AvatarsUnited Bebo Brightkite Friendster Friendfeed GamerDna Gather Hi5 Hyves Identica
6
+ Jaiku Multiply Netlog Plurk Raptr Skyrock Twitter ],
7
+ :blogging => %w[ Ameba Baidu Blogger Douban Livejournal Posterous Tumblr Wordpress Xanga ],
8
+ :bookmarking => %w[ Delicious Digg Diigo GoogleReader Hatena Meneame Mixx Newsvine Propeller Reddit Stumbleupon Twine ],
9
+ :music => %w[ Blipfm Buzznet Ilike Lastfm Pandora Zooomr ],
10
+ :video => %w[ TwelveSeconds Bliptv Cinchcast DailyMotion FunnyOrDie Hulu Joost Metacafe Qik Revver Vimeo Youtube ],
11
+ :photos => %w[ DeviantArt Flickr Fotolog MobyPicture Photobucket Picasa Photocase Slideshare Smotri Smugmug Visualizeus ],
12
+ :reviews => %w[ Blippr Corkd Flixster Goodreads Librarything Qype Readernaut Yelp ],
13
+
14
+ :activity_streams => %w[ Gowalla Myspace]
15
+
16
+ # # Not yet implemented, need example mappings -- want to help?
17
+ # :more_text_status => %w[ AIM WlMessenger ],
18
+ # :more_location => %w[ Foursquare Tripit UrbanSpoon Whirl ],
19
+ # :more_gaming => %w[ Zynga Playdom MsgrGames ],
20
+ # :more_social => %w[ Facebook LinkedIn Plaxo Xing ],
21
+ # :more_music => %w[ Zune ],
22
+ # :more_video => %w[ BuddyTv ],
23
+ # :more_photos => %w[ MetroFlog WlSkyDrive ],
24
+ # :more_blogging => %w[ TypePad MoveableType WlSpaces ],
25
+ }
26
+
27
+ FEEDPROXY_FEEDS = [
28
+ # %w[ customfeed weblogs posted ],
29
+ #
30
+ %w[ tweleveseconds videos posted ],
31
+ %w[ ameba weblogs posted ],
32
+ %w[ avatarsunited weblogs posted ],
33
+ %w[ baidu weblogs posted ],
34
+ %w[ bebo weblogs posted ],
35
+ %w[ blipfm songs posted ],
36
+ %w[ blippr reviews posted ],
37
+ %w[ bliptv videos posted ],
38
+ %w[ blogger weblogs posted ],
39
+ %w[ brightkite activity posted ],
40
+ %w[ buzznet weblogs posted ],
41
+ %w[ buzznet photos posted ],
42
+ %w[ buzznet videos posted ],
43
+ %w[ cinchcast media posted ],
44
+ %w[ corkd reviews posted ],
45
+ %w[ dailymotion videos posted ],
46
+ %w[ delicious bookmarks posted ],
47
+ %w[ deviantart weblogs posted ],
48
+ %w[ deviantart photos posted ],
49
+ %w[ deviantart photos favorited ],
50
+ %w[ digg bookmarks dugg ],
51
+ %w[ digg bookmarks favorited ],
52
+ %w[ digg bookmarks posted ],
53
+ %w[ digg images dugg ],
54
+ %w[ digg images favorited ],
55
+ %w[ digg images posted ],
56
+ %w[ digg videos dugg ],
57
+ %w[ digg videos favorited ],
58
+ %w[ digg videos posted ],
59
+ %w[ diigo bookmarks posted ],
60
+ %w[ douban weblogs posted ],
61
+ %w[ flickr media posted ],
62
+ %w[ flickr media favorited ],
63
+ %w[ flixster reviews posted ],
64
+ %w[ fotolog photos posted ],
65
+ %w[ fotolog photos favorited ],
66
+ %w[ friendfeed activity posted ],
67
+ %w[ friendster weblogs posted ],
68
+ %w[ funnyordie videos posted ],
69
+ %w[ funnyordie videos favorited ],
70
+ %w[ gamerdna notes posted ],
71
+ %w[ gather weblogs posted ],
72
+ %w[ goodreads reviews posted ],
73
+ %w[ googlereader bookmarks posted ],
74
+ %w[ hatena bookmarks posted ],
75
+ %w[ hatena bookmarks favorited ],
76
+ %w[ hi5 weblogs posted ],
77
+ %w[ hulu activity posted ],
78
+ %w[ hyves media posted ],
79
+ %w[ hyves weblogs posted ],
80
+ %w[ identica notes posted ],
81
+ %w[ ilike songs played ],
82
+ %w[ ilike songs favorited ],
83
+ %w[ jaiku notes posted ],
84
+ %w[ joost activity posted ],
85
+ %w[ joost videos favorited ],
86
+ %w[ lastfm songs played ],
87
+ %w[ lastfm songs favorited ],
88
+ %w[ lastfm weblogs posted ],
89
+ %w[ librarything reviews posted ],
90
+ %w[ livejournal weblogs posted ],
91
+ %w[ meneame bookmarks posted ],
92
+ %w[ meneame bookmarks favorited ],
93
+ %w[ metacafe videos posted ],
94
+ %w[ mixx bookmarks posted ],
95
+ %w[ mobypicture media posted ],
96
+ %w[ multiply activity posted ],
97
+ %w[ netlog photos posted ],
98
+ %w[ netlog weblogs posted ],
99
+ %w[ newsvine bookmarks posted ],
100
+ %w[ pandora songs favorited ],
101
+ %w[ photobucket media posted ],
102
+ %w[ photocase photos posted ],
103
+ %w[ picasa photos posted ],
104
+ %w[ plurk notes posted ],
105
+ %w[ posterous weblogs posted ],
106
+ %w[ propeller bookmarks posted ],
107
+ %w[ propeller bookmarks favorited ],
108
+ %w[ qik videos posted ],
109
+ %w[ qype reviews posted ],
110
+ %w[ raptr notes posted ],
111
+ %w[ readernaut activity posted ],
112
+ %w[ readernaut books read ],
113
+ %w[ reddit bookmarks posted ],
114
+ %w[ revver videos posted ],
115
+ %w[ skyrock weblogs posted ],
116
+ %w[ slideshare files posted ],
117
+ %w[ slideshare files favorited ],
118
+ %w[ smotri videos posted ],
119
+ %w[ smugmug photos posted ],
120
+ %w[ smugmug videos posted ],
121
+ %w[ stumbleupon weblogs posted ],
122
+ %w[ stumbleupon bookmarks favorited ],
123
+ %w[ tumblr weblogs posted ],
124
+ %w[ twine twine created ],
125
+ %w[ twine bookmarks posted ],
126
+ %w[ twitter notes posted ],
127
+ %w[ twitter notes favorited ],
128
+ %w[ vimeo videos posted ],
129
+ %w[ vimeo videos favorited ],
130
+ %w[ visualizeus photos favorited ],
131
+ %w[ wordpress weblogs posted ],
132
+ %w[ xanga weblogs posted ],
133
+ %w[ yelp reviews posted ],
134
+ %w[ youtube videos posted ],
135
+ %w[ youtube videos favorited ],
136
+ %w[ zooomr photos posted ],
137
+ ]
138
+
139
+ # load './lib/titi/provider/list_of_providers.rb' ; pr = PROVIDERS.values.flatten.map(&:underscore).to_set ; ff = FEEDPROXY_FEEDS.map{|provider, obj, verb| provider }.uniq.sort.to_set
140
+ # p (ff - pr).sort ; p (pr - ff).sort
141
+
142
+ true
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -31,24 +31,27 @@ module Titi::Provider
31
31
  # </activity:object>
32
32
  # </entry>
33
33
  #
34
- def to_activity_stream_entry
35
- ActivityStreams::Entry.adapt(
36
- :id => %Q{tag:twitter.com,2007:http://twitter.com/#{user.screen_name}/statuses/#{id}},
37
- :title => text,
38
- :content => text,
39
- :published => created_at,
40
- :verb => :post
41
- ) do |entry|
42
- entry.has_author user.name, user.url
43
- entry.has_obj do |activity_obj|
44
- activity_obj.id = id
45
- activity_obj.title = text
46
- activity_obj.published = created_at
47
- activity_obj.updated = created_at
48
- activity_obj.author = entry.author
34
+ def to_activity_stream
35
+ ActivityStreams::Feed.adapt do |feed|
36
+ feed.has_entry(
37
+ :id => %Q{tag:twitter.com,2007:http://twitter.com/#{user.screen_name}/statuses/#{id}},
38
+ :title => text,
39
+ :content => text,
40
+ :published => created_at,
41
+ :verb => :post
42
+ ) do |entry|
43
+ entry.has_author user.name, user.url
44
+ entry.has_obj do |activity_obj|
45
+ activity_obj.id = id
46
+ activity_obj.title = text
47
+ activity_obj.published = created_at
48
+ activity_obj.updated = created_at
49
+ activity_obj.author = entry.author
50
+ end
49
51
  end
50
52
  end
51
53
  end
54
+
52
55
  end
53
56
  end
54
57
  end
File without changes
@@ -90,6 +90,7 @@ module Titi::Provider
90
90
  Status.class_eval do
91
91
  include Titi::Provider
92
92
  include Titi::Adaptor
93
+ include Titi::Fetcher::Json
93
94
 
94
95
  # virtual setter for user: If argument is not a Twitter::User, adapt it to
95
96
  # be a user (assuming it is a hash or a hash_like.
@@ -99,19 +100,16 @@ module Titi::Provider
99
100
  self[:user] = new_user
100
101
  end
101
102
 
102
-
103
- # Call the twitter API and fetch tweet with given ID
104
- #
105
- # @example
106
- # tweet = Status.get(12233609555)
107
- # tweet.text
108
- # #=> "THANK GOODNESS THE LIBRARY OF CONGRESS HAS UNDERSTOOD THE IMPORTANCE OF MY TWEETS what do you mean others are getting in too"
109
- #
110
- def self.get status_id
111
- raw_json_str = RestClient.get "http://twitter.com/statuses/show/#{status_id}.json"
112
- raw_status = JSON.load(raw_json_str.to_s)
103
+ # Create a new status by fetching the given status_id via the 'statuses/show' API call
104
+ def self.fetch_status status_id
105
+ raw_status = get "http://twitter.com/statuses/show/#{status_id}.json"
113
106
  adapt(raw_status)
114
107
  end
108
+
109
+ def self.from_file filename
110
+ adapt(super(filename))
111
+ end
112
+
115
113
  end
116
114
  end
117
115
  end