Sha256: 9e1c51c2c7710d1c0d67519c42f2bc5691f079d0523ffe27d62fab9c832c1742

Contents?: true

Size: 748 Bytes

Versions: 7

Compression:

Stored size: 748 Bytes

Contents

module FbGraph2
  class Edge
    module Comments
      def assign(attributes)
        super
        if attributes.include? :comments
          @_cached_comments = Collection.new attributes[:comments]
        end
      end

      def comments(params = {})
        comments = if @_cached_comments.present? && params.blank?
          @_cached_comments
        else
          self.edge :comments, params
        end
        comments.collect do |comment|
          Comment.new(comment[:id], comment).authenticate self.access_token
        end
      end

      def comment!(params = {})
        comment = self.post params, edge: :comments
        Comment.new(comment[:id], params.merge(comment)).authenticate self.access_token
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fb_graph2-0.1.0 lib/fb_graph2/edge/comments.rb
fb_graph2-0.0.11 lib/fb_graph2/edge/comments.rb
fb_graph2-0.0.10 lib/fb_graph2/edge/comments.rb
fb_graph2-0.0.9 lib/fb_graph2/edge/comments.rb
fb_graph2-0.0.8 lib/fb_graph2/edge/comments.rb
fb_graph2-0.0.7 lib/fb_graph2/edge/comments.rb
fb_graph2-0.0.6 lib/fb_graph2/edge/comments.rb