Class: FbGraph::Message

Inherits:
Node
  • Object
show all
Defined in:
lib/fb_graph/message.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#access_token, #endpoint, #identifier

Instance Method Summary collapse

Methods inherited from Node

#connection, #destroy, fetch, #fetch

Methods included from Comparison

#==

Constructor Details

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

Returns a new instance of Message.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fb_graph/message.rb', line 9

def initialize(identifier, attributes = {})
  super
  @subject = attributes[:subject]
  @message = attributes[:message]
  if (from = attributes[:from])
    @from = User.new(from.delete(:id), from)
  end
  @to = []
  if attributes[:to]
    Collection.new(attributes[:to]).each do |to|
      @to << User.new(to.delete(:id), to)
    end
  end
  @tags = []
  if attributes[:tags]
    Collection.new(attributes[:tags]).each do |tag|
      @tags << Tag.new(tag)
    end
  end
  if attributes[:created_time]
    @created_time = Time.parse(attributes[:created_time]).utc
  end
end

Instance Attribute Details

#created_timeObject

TODO: include Connections::Attachments include Connections::Shares



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

def created_time
  @created_time
end

#fromObject

TODO: include Connections::Attachments include Connections::Shares



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

def from
  @from
end

#messageObject

TODO: include Connections::Attachments include Connections::Shares



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

def message
  @message
end

#subjectObject

TODO: include Connections::Attachments include Connections::Shares



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

def subject
  @subject
end

#tagsObject

TODO: include Connections::Attachments include Connections::Shares



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

def tags
  @tags
end

#toObject

TODO: include Connections::Attachments include Connections::Shares



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

def to
  @to
end