Class: Twitterize::Feed
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Twitterize::Feed
- Defined in:
- lib/twitterize.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.find_refreshable ⇒ Object
57 58 59 |
# File 'lib/twitterize.rb', line 57 def Feed.find_refreshable Feed.find(:all, :conditions => ["next_check IS NULL or next_check < ?", Time.now]) end |
.update_feeds(feeds) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/twitterize.rb', line 65 def Feed.update_feeds(feeds) raise Error, "No feeds found" if feeds.size == 0 feeds.each do |f| dbfeed = Feed.find_by_name(f[0]) dbfeed = Feed.new if dbfeed.nil? dbfeed.name = f[0] dbfeed.url = f[1]['url'] dbfeed.user = f[1]['user'] dbfeed.password = f[1]['password'] dbfeed.interval = f[1]['interval'] || nil dbfeed.save end end |
Instance Method Details
#mark_read(ttl = nil) ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/twitterize.rb', line 81 def mark_read(ttl=nil) if interval.nil? increment = ttl increment = 30.minutes if increment.nil? else increment = interval end self.next_check = Time.now + increment save end |
#save_rss_item(item, shorturl) ⇒ Object
61 62 63 |
# File 'lib/twitterize.rb', line 61 def save_rss_item(item, shorturl) Item.save_rss_item(self, item, shorturl) end |