Class: Socialcastr::Comment

Inherits:
Base
  • Object
show all
Defined in:
lib/socialcastr/comment.rb

Instance Method Summary collapse

Methods inherited from Base

all, api, #api, collection_name, #collection_path, collection_path, #copy_attributes_from_object, #create, #element_path, element_path, find, find_every, find_single, first, from_hash, #id, #initialize, last, #method_missing, #method_name, model_name, #new?, #param_name, parse, parse_options, prefix, #save, #to_params, #update

Constructor Details

This class inherits a constructor from Socialcastr::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Socialcastr::Base

Instance Method Details

#likable_by?(api_id) ⇒ Boolean

Returns:



7
8
9
# File 'lib/socialcastr/comment.rb', line 7

def likable_by?(api_id)
  self.user_id  != api_id
end

#like_id(api_id) ⇒ Object



11
12
13
# File 'lib/socialcastr/comment.rb', line 11

def like_id(api_id)
  self.likes.select { |like| like.unlikable_by?(api_id) }.first.id
end

#unlikable_by?(api_id) ⇒ Boolean

Returns:



3
4
5
# File 'lib/socialcastr/comment.rb', line 3

def unlikable_by?(api_id)
  self.likes.map{|l| l.unlikable_by?(api_id)}.any?
end