Sha256: 9a27b318f06b658d9df9824f43abe68739e38ca039e4b5909632f21e8fe3ff1d

Contents?: true

Size: 1.09 KB

Versions: 30

Compression:

Stored size: 1.09 KB

Contents

module FbGraph
  module Connections
    module Comments
      def comments(options = {})
        comments = if @_comments_ && options.blank?
          self.connection(:comments, options.merge(:cached_collection => @_comments_))
        else
          self.connection(:comments, options)
        end
        comments.map! do |comment|
          Comment.new(comment[:id], comment.merge(
            :access_token => options[:access_token] || self.access_token
          ))
        end
      end

      def comment!(options = {})
        comment = post(options.merge(:connection => :comments))
        Comment.new(comment[:id], options.merge(comment).merge(
          :access_token => options[:access_token] || self.access_token
        ))
      end

      # 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!
      def like!(options = {})
        post(options.merge(:connection => :likes))
      end

      def unlike!(options = {})
        destroy(options.merge(:connection => :likes))
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
fb_graph-2.1.11 lib/fb_graph/connections/comments.rb
fb_graph-2.1.10 lib/fb_graph/connections/comments.rb
fb_graph-2.1.9 lib/fb_graph/connections/comments.rb
fb_graph-2.1.8 lib/fb_graph/connections/comments.rb
fb_graph-2.1.7 lib/fb_graph/connections/comments.rb
fb_graph-2.1.6 lib/fb_graph/connections/comments.rb
fb_graph-2.1.5 lib/fb_graph/connections/comments.rb
fb_graph-2.1.4 lib/fb_graph/connections/comments.rb
fb_graph-2.1.3 lib/fb_graph/connections/comments.rb
fb_graph-2.1.2 lib/fb_graph/connections/comments.rb
fb_graph-2.1.1 lib/fb_graph/connections/comments.rb
fb_graph-2.1.0 lib/fb_graph/connections/comments.rb
fb_graph-2.1.0.alpha lib/fb_graph/connections/comments.rb
fb_graph-2.0.2 lib/fb_graph/connections/comments.rb
fb_graph-2.0.1 lib/fb_graph/connections/comments.rb
fb_graph-2.0.0 lib/fb_graph/connections/comments.rb
fb_graph-2.0.0.beta lib/fb_graph/connections/comments.rb
fb_graph-2.0.0.alpha lib/fb_graph/connections/comments.rb
fb_graph-1.9.5 lib/fb_graph/connections/comments.rb
fb_graph-1.9.4 lib/fb_graph/connections/comments.rb