Sha256: 3a39febef4b3b493d874cca29dae357eef03fc0e9daf1af9ac65430cfaa62709

Contents?: true

Size: 806 Bytes

Versions: 15

Compression:

Stored size: 806 Bytes

Contents

module FbGraph
  class Comment < Node
    include Connections::Comments
    include Connections::Likes
    include Connections::Likes::Likable

    attr_accessor :from, :message, :created_time, :like_count, :can_comment

    def initialize(identifier, attributes = {})
      super
      if (from = attributes[:from])
        @from = if from[:category]
          Page.new(from[:id], from)
        else
          User.new(from[:id], from)
        end
      end
      @message = attributes[:message]
      @like_count = attributes[:likes]
      @can_comment = attributes[:can_comment]

      if attributes[:created_time]
        @created_time = Time.parse(attributes[:created_time]).utc
      end
    end

    def can_comment?
      !!can_comment
    end
    alias_method :commentable?, :can_comment
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
fb_graph-2.7.17 lib/fb_graph/comment.rb
fb_graph-2.7.16 lib/fb_graph/comment.rb
fb_graph-2.7.15 lib/fb_graph/comment.rb
fb_graph-2.7.14 lib/fb_graph/comment.rb
fb_graph-2.7.13 lib/fb_graph/comment.rb
fb_graph-2.7.12 lib/fb_graph/comment.rb
fb_graph-2.7.11 lib/fb_graph/comment.rb
fb_graph-2.7.10 lib/fb_graph/comment.rb
fb_graph-2.7.9 lib/fb_graph/comment.rb
fb_graph-2.7.8 lib/fb_graph/comment.rb
fb_graph-2.7.7 lib/fb_graph/comment.rb
fb_graph-2.7.6 lib/fb_graph/comment.rb
fb_graph-2.7.5 lib/fb_graph/comment.rb
fb_graph-2.7.4 lib/fb_graph/comment.rb
fb_graph-2.7.3 lib/fb_graph/comment.rb