Sha256: a452473aace45208a116af5e006aa3beb1a1d54c00f4b3925f40c7ced3ba4404
Contents?: true
Size: 583 Bytes
Versions: 1
Compression:
Stored size: 583 Bytes
Contents
module Socialcastr class Comment < Base def like! api.post(element_path(:message_id => message_id) + "/likes") refresh return self end def unlike! api.delete(element_path(:message_id => message_id) + "/likes/#{like_id}") refresh 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 self.likes.select { |like| like.unlikable_by?(api.profile.id) }.first.id end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
socialcastr-0.2.9 | lib/socialcastr/comment.rb |