Module: FbGraph::Connections::Comments

Included in:
Album, Link, Note, Photo, Post, Status, Video
Defined in:
lib/fb_graph/connections/comments.rb

Instance Method Summary collapse

Instance Method Details

#comment!(options = {}) ⇒ Object



18
19
20
21
# File 'lib/fb_graph/connections/comments.rb', line 18

def comment!(options = {})
  comment = post(options.merge(:connection => 'comments'))
  Comment.new(comment.delete(:id), options.merge(comment))
end

#comments(options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fb_graph/connections/comments.rb', line 4

def comments(options = {})
  comments = if @_comments_.present? && options.blank?
    # Note:
    # "comments" is a connection, but included in fetched "post" object
    # this improves performance when rendering the stream with comments
    @_comments_
  else
    FbGraph::Collection.new(get(options.merge(:connection => 'comments')))
  end
  comments.map! do |comment|
    Comment.new(comment.delete(:id), comment)
  end
end

#like!(options = {}) ⇒ Object

NOTE: the context of getting likes is User, but the context of posting like is not user. posting like is always in same context with comment!



26
27
28
# File 'lib/fb_graph/connections/comments.rb', line 26

def like!(options = {})
  post(options.merge(:connection => 'likes'))
end