Module: FbGraph::Connections::Comments
- Defined in:
- lib/fb_graph/connections/comments.rb
Instance Method Summary collapse
- #comment!(options = {}) ⇒ Object
- #comments(options = {}) ⇒ Object
-
#like!(options = {}) ⇒ Object
NOTE: the context of getting likes is User, but the context of posting like is not user.
- #unlike!(options = {}) ⇒ Object
Instance Method Details
#comment!(options = {}) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/fb_graph/connections/comments.rb', line 20 def comment!( = {}) comment = post(.merge(:connection => 'comments')) Comment.new(comment.delete(:id), .merge(comment).merge( :access_token => [:access_token] || self.access_token )) end |
#comments(options = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/fb_graph/connections/comments.rb', line 4 def comments( = {}) comments = if @_comments_.present? && .blank? # Note: # "comments" is a connection, but included in fetched "post" object # this improves performance when rendering the stream with comments @_comments_ else self.connection(:comments, ) end comments.map! do |comment| Comment.new(comment.delete(:id), comment.merge( :access_token => [:access_token] || self.access_token )) 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!
30 31 32 |
# File 'lib/fb_graph/connections/comments.rb', line 30 def like!( = {}) post(.merge(:connection => 'likes')) end |
#unlike!(options = {}) ⇒ Object
34 35 36 |
# File 'lib/fb_graph/connections/comments.rb', line 34 def unlike!( = {}) destroy(.merge(:connection => 'likes')) end |