Class: Yammer::Thread

Inherits:
Base
  • Object
show all
Defined in:
lib/yammer/thread.rb

Instance Attribute Summary

Attributes inherited from Base

#attrs, #id

Instance Method Summary collapse

Methods inherited from Base

#api_handler, attr_accessor_deffered, base_name, #base_name, #changes, #delete!, fetch, get, identity_map, #initialize, #load!, #load_deferred_attribute!, #loaded?, model_attributes, #modified?, #new_record?, #persisted?, #reload!, #save, #update

Methods included from ApiHandler

#api_handler, #establish_api_handler

Constructor Details

This class inherits a constructor from Yammer::Base

Instance Method Details

#first_replyObject



12
13
14
# File 'lib/yammer/thread.rb', line 12

def first_reply
  @first_reply ||= first_reply_id ? Yammer::Message.new(:id => first_reply_id) : nil
end

#first_reply_idObject



8
9
10
# File 'lib/yammer/thread.rb', line 8

def first_reply_id
  stats[:first_reply_id]
end

#last_replyObject



20
21
22
# File 'lib/yammer/thread.rb', line 20

def last_reply
  @latest_reply ||= latest_reply_id ? Yammer::Message.new(:id => latest_reply_id) : nil
end

#latest_reply_idObject



16
17
18
# File 'lib/yammer/thread.rb', line 16

def latest_reply_id
  stats[:latest_reply_id]
end

#messagesObject



34
35
36
37
38
39
40
41
42
# File 'lib/yammer/thread.rb', line 34

def messages
  @messages = {}
  result = api_handler.messages_in_thread(self.id)
  msgs = result.body[:messages].each do |message|
    msg = Yammer::Message.new(message)
    @messages["#{msg.id}"] = msg
  end
  @messages
end

#peopleObject



24
25
26
27
28
29
30
31
32
# File 'lib/yammer/thread.rb', line 24

def people
  @people ||= begin
    @participants.map do |part|
      next unless part[:type] == 'user'
      Yammer::User.new(:id => part[:id])
    end
  end
  @people
end