Class: FbGraph::Note

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

Instance Attribute Summary collapse

Attributes inherited from Node

#access_token, #endpoint, #identifier, #raw_attributes

Instance Method Summary collapse

Methods included from Connections::Likes::Likable

#like!, #unlike!

Methods included from Connections::Likes

#likes

Methods included from Connections::Comments

#comment!, #comments, #reply!

Methods inherited from Node

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

Methods included from Comparison

#==

Constructor Details

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

Returns a new instance of Note.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fb_graph/note.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
  @subject = attributes[:subject]
  @message = attributes[:message]
  if attributes[:created_time]
    @created_time = Time.parse(attributes[:created_time]).utc
  end
  if attributes[:updated_time]
    @updated_time = Time.parse(attributes[:updated_time]).utc
  end
  @icon = attributes[:icon]

  # cached connection
  cache_collection attributes, :comments
end

Instance Attribute Details

#created_timeObject

Returns the value of attribute created_time.



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

def created_time
  @created_time
end

#fromObject

Returns the value of attribute from.



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

def from
  @from
end

#iconObject

Returns the value of attribute icon.



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

def icon
  @icon
end

#messageObject

Returns the value of attribute message.



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

def message
  @message
end

#subjectObject

Returns the value of attribute subject.



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

def subject
  @subject
end

#updated_timeObject

Returns the value of attribute updated_time.



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

def updated_time
  @updated_time
end