Sha256: eb76bf004870591e6517ef1467aaea756a287fe74b0b5714c362a0f1299da766
Contents?: true
Size: 766 Bytes
Versions: 3
Compression:
Stored size: 766 Bytes
Contents
module ActivityFeed module Custom class Item attr_accessor :user_id attr_accessor :nickname attr_accessor :type attr_accessor :title attr_accessor :text attr_accessor :url attr_accessor :icon attr_accessor :sticky def initialize(attributes = {}) @attributes = attributes attributes.each do |key,value| self.send("#{key}=", value) end end def self.find(item) JSON.parse(item) end def save raise 'user_id MUST be defined in the attributes' if user_id.blank? ActivityFeed.redis.zadd("#{ActivityFeed.namespace}:#{ActivityFeed.key}:#{self.user_id}", DateTime.now.to_i, @attributes.to_json) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
activity_feed-1.1.1 | spec/activity_feed/custom/item.rb |
activity_feed-1.1.0 | spec/activity_feed/custom/item.rb |
activity_feed-1.0.0 | spec/activity_feed/custom/item.rb |