Sha256: 7f5ed1cc4b28fd777b8371d1a5bf6c097523df12dfed522b3ef5493709cfc387
Contents?: true
Size: 1.79 KB
Versions: 1
Compression:
Stored size: 1.79 KB
Contents
module ActivityFeed module Item # Add or update an item in the activity feed for a given +user_id+. # # @param user_id [String] User ID. # @param item_id [String] Item ID. # @param timestamp [int] Timestamp for the item being added or updated. # @param aggregate [boolean, false] Whether to add or update the item in the aggregate feed for +user_id+. def update_item(user_id, item_id, timestamp, aggregate = ActivityFeed.aggregate) feederboard = ActivityFeed.feederboard_for(user_id, false) feederboard.rank_member(item_id, timestamp) if aggregate feederboard = ActivityFeed.feederboard_for(user_id, true) feederboard.rank_member(item_id, timestamp) end end alias_method :add_item, :update_item # Specifically aggregate an item in the activity feed for a given +user_id+. # This is useful if you are going to background the process of populating # a user's activity feed from friend's activities. # # @param user_id [String] User ID. # @param item_id [String] Item ID. # @param timestamp [int] Timestamp for the item being added or updated. def aggregate_item(user_id, item_id, timestamp) feederboard = ActivityFeed.feederboard_for(user_id, true) feederboard.rank_member(item_id, timestamp) end # Remove an item from the activity feed for a given +user_id+. This # will also remove the item from the aggregate activity feed for the # user. # # @param user_id [String] User ID. # @param item_id [String] Item ID. def remove_item(user_id, item_id) feederboard = ActivityFeed.feederboard_for(user_id, false) feederboard.remove_member(item_id) feederboard = ActivityFeed.feederboard_for(user_id, true) feederboard.remove_member(item_id) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activity_feed-2.2.2 | lib/activity_feed/item.rb |