Sha256: 2a38666ae6e671cf3a418a3daab662d7cbe17d36e5a12d56792bff51e4c6bc9e
Contents?: true
Size: 683 Bytes
Versions: 1
Compression:
Stored size: 683 Bytes
Contents
module Socialcastr class Comment < Base def like! self.likes ||= [] likes << Like.parse(api.post(element_path(:message_id => self.message_id) + "/likes")) return self end def unlike! self.likes.reject! do |l| l.unlikable_by?(self.user_id) && api.delete(element_path(:message_id => self.mesage_id) + "/likes/#{l.id}") end return self end def unlikable_by?(api_id) self.likes.map{|l| l.unlikable_by?(api_id)}.any? end def likable_by?(api_id) self.user_id != api_id end def like_id(api_id) self.likes.select { |like| like.unlikable_by?(api_id) }.first.id end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
socialcastr-0.2.7 | lib/socialcastr/comment.rb |