Method: FbGraph::Thread::BeforeTransition#initialize

Defined in:
lib/fb_graph/thread.rb

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



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/fb_graph/thread.rb', line 31

def initialize(identifier, attributes = {})
  super
  @subject = attributes[:subject]
  @message = attributes[:message]
  if (from = attributes[:from])
    @from = if from[:start_time]
      Event.new(from[:id], from)
    else
      User.new(from[:id], from)
    end
  end
  @to = []
  Collection.new(attributes[:to]).each do |to|
    @to << User.new(to[:id], to)
  end
  if attributes[:updated_time]
    @created_time = Time.parse(attributes[:updated_time]).utc
  end
  @unread = attributes[:unread] == 1
  @unseen = attributes[:unseen] == 1

  # cached connection
  cache_collection attributes, :comments
end