Class: FbGraph::Comment

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

Instance Attribute Summary collapse

Attributes inherited from Node

#access_token, #endpoint, #identifier

Instance Method Summary collapse

Methods included from FbGraph::Connections::Likes

#likes

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.



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

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]
  if attributes[:created_time]
    @created_time = Time.parse(attributes[:created_time]).utc
  end
end

Instance Attribute Details

#created_timeObject

Returns the value of attribute created_time.



5
6
7
# File 'lib/fb_graph/comment.rb', line 5

def created_time
  @created_time
end

#fromObject

Returns the value of attribute from.



5
6
7
# File 'lib/fb_graph/comment.rb', line 5

def from
  @from
end

#like_countObject

Returns the value of attribute like_count.



5
6
7
# File 'lib/fb_graph/comment.rb', line 5

def like_count
  @like_count
end

#messageObject

Returns the value of attribute message.



5
6
7
# File 'lib/fb_graph/comment.rb', line 5

def message
  @message
end