Class: FbGraph::Comment

Inherits:
Node
  • Object
show all
Includes:
FbGraph::Connections::Comments, FbGraph::Connections::Likes, FbGraph::Connections::Likes::Likable
Defined in:
lib/fb_graph/comment.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#access_token, #endpoint, #identifier, #raw_attributes

Instance Method Summary collapse

Methods included from FbGraph::Connections::Likes::Likable

#like!, #unlike!

Methods included from FbGraph::Connections::Likes

#likes

Methods included from FbGraph::Connections::Comments

#comment!, #comments, #reply!

Methods inherited from Node

#connection, #destroy, #fetch, fetch, #update

Methods included from Comparison

#==

Constructor Details

#initialize(identifier, attributes = {}) ⇒ Comment

Returns a new instance of Comment



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fb_graph/comment.rb', line 9

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

Instance Attribute Details

#can_commentObject Also known as: commentable?

Returns the value of attribute can_comment



7
8
9
# File 'lib/fb_graph/comment.rb', line 7

def can_comment
  @can_comment
end

#created_timeObject

Returns the value of attribute created_time



7
8
9
# File 'lib/fb_graph/comment.rb', line 7

def created_time
  @created_time
end

#fromObject

Returns the value of attribute from



7
8
9
# File 'lib/fb_graph/comment.rb', line 7

def from
  @from
end

#like_countObject

Returns the value of attribute like_count



7
8
9
# File 'lib/fb_graph/comment.rb', line 7

def like_count
  @like_count
end

#messageObject

Returns the value of attribute message



7
8
9
# File 'lib/fb_graph/comment.rb', line 7

def message
  @message
end

Instance Method Details

#can_comment?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/fb_graph/comment.rb', line 27

def can_comment?
  !!can_comment
end