Skip to content

Instantly share code, notes, and snippets.

@mahcloud
Created December 5, 2015 02:09
Show Gist options
  • Select an option

  • Save mahcloud/1dac784319cb5be341cd to your computer and use it in GitHub Desktop.

Select an option

Save mahcloud/1dac784319cb5be341cd to your computer and use it in GitHub Desktop.
rss job
def self.perform(rss_feed_id, rss_import_id)
rss_feed = RssFeed.find(rss_feed_id)
rss_feed.run(rss_import_id)
rss_import = RssImport.find(rss_import_id)
firebase = Firebase::Client.new(ENV['FIREBASE_URL'])
json = {
rss_feed.state_abbr.to_sym => {
fillKey: rss_feed.map_color(rss_import.id),
articles_count: rss_import.rss_articles.where(rss_feed_id: rss_feed.id).count,
finished_articles_count: rss_import.rss_articles.where(rss_feed_id: rss_feed.id).where(finished: true).count
}
}
firebase.update('rss_map', json)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment