Sha256: 3654b2cab7d64d83d398c049a28b06ac410910e6bfde51e8d8d7c33f26b7b375

Contents?: true

Size: 1.11 KB

Versions: 42

Compression:

Stored size: 1.11 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.delete(: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.delete(: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

42 entries across 42 versions & 1 rubygems

Version Path
fb_graph-1.8.0 lib/fb_graph/connections/comments.rb
fb_graph-1.8.0.alpha2 lib/fb_graph/connections/comments.rb
fb_graph-1.7.5 lib/fb_graph/connections/comments.rb
fb_graph-1.8.0.alpha lib/fb_graph/connections/comments.rb
fb_graph-1.7.4 lib/fb_graph/connections/comments.rb
fb_graph-1.7.3 lib/fb_graph/connections/comments.rb
fb_graph-1.7.2 lib/fb_graph/connections/comments.rb
fb_graph-1.7.1 lib/fb_graph/connections/comments.rb
fb_graph-1.7.0 lib/fb_graph/connections/comments.rb
fb_graph-1.7.0.alpha2 lib/fb_graph/connections/comments.rb
fb_graph-1.6.9 lib/fb_graph/connections/comments.rb
fb_graph-1.7.0.alpha lib/fb_graph/connections/comments.rb
fb_graph-1.6.8 lib/fb_graph/connections/comments.rb
fb_graph-1.6.7 lib/fb_graph/connections/comments.rb
fb_graph-1.6.5 lib/fb_graph/connections/comments.rb
fb_graph-1.6.4 lib/fb_graph/connections/comments.rb
fb_graph-1.6.3 lib/fb_graph/connections/comments.rb
fb_graph-1.6.2 lib/fb_graph/connections/comments.rb
fb_graph-1.6.1 lib/fb_graph/connections/comments.rb
fb_graph-1.6.0 lib/fb_graph/connections/comments.rb