Class: GSGraph::Comment

Inherits:
Node
  • Object
show all
Includes:
GSGraph::Connections::Likes, GSGraph::Connections::Likes::Likable
Defined in:
lib/gs_graph/comment.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#access_token, #endpoint, #identifier, #raw_attributes

Instance Method Summary collapse

Methods included from GSGraph::Connections::Likes::Likable

#like!, #unlike!

Methods included from GSGraph::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.



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

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.



6
7
8
# File 'lib/gs_graph/comment.rb', line 6

def created_time
  @created_time
end

#fromObject

Returns the value of attribute from.



6
7
8
# File 'lib/gs_graph/comment.rb', line 6

def from
  @from
end

#like_countObject

Returns the value of attribute like_count.



6
7
8
# File 'lib/gs_graph/comment.rb', line 6

def like_count
  @like_count
end

#messageObject

Returns the value of attribute message.



6
7
8
# File 'lib/gs_graph/comment.rb', line 6

def message
  @message
end