Sha256: 2c573949704df47826e4b49183fe0379ae452c6c8061bfec1cf27eb090393472

Contents?: true

Size: 749 Bytes

Versions: 37

Compression:

Stored size: 749 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

37 entries across 37 versions & 1 rubygems

Version Path
fb_graph2-1.3.0 lib/fb_graph2/edge/comments.rb
fb_graph2-1.2.0 lib/fb_graph2/edge/comments.rb
fb_graph2-1.1.1 lib/fb_graph2/edge/comments.rb
fb_graph2-1.1.0 lib/fb_graph2/edge/comments.rb
fb_graph2-1.0.1 lib/fb_graph2/edge/comments.rb
fb_graph2-1.0.0 lib/fb_graph2/edge/comments.rb
fb_graph2-0.9.1 lib/fb_graph2/edge/comments.rb
fb_graph2-0.9.0 lib/fb_graph2/edge/comments.rb
fb_graph2-0.8.0 lib/fb_graph2/edge/comments.rb
fb_graph2-0.7.9 lib/fb_graph2/edge/comments.rb
fb_graph2-0.7.8 lib/fb_graph2/edge/comments.rb
fb_graph2-0.7.7 lib/fb_graph2/edge/comments.rb
fb_graph2-0.7.6 lib/fb_graph2/edge/comments.rb
fb_graph2-0.7.5 lib/fb_graph2/edge/comments.rb
fb_graph2-0.7.4 lib/fb_graph2/edge/comments.rb
fb_graph2-0.7.3 lib/fb_graph2/edge/comments.rb
fb_graph2-0.7.2 lib/fb_graph2/edge/comments.rb
fb_graph2-0.7.1 lib/fb_graph2/edge/comments.rb
fb_graph2-0.7.0 lib/fb_graph2/edge/comments.rb
fb_graph2-0.6.2 lib/fb_graph2/edge/comments.rb