Class: Jabber::MUC::HipChat::RoomData

Inherits:
Object
  • Object
show all
Defined in:
lib/xmpp4r/muc/hipchat/room_data.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(room) ⇒ RoomData

Returns a new instance of RoomData.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/xmpp4r/muc/hipchat/room_data.rb', line 8

def initialize room
  @room       = room
  @attributes = {
    "name" => name,
    "id" => id,
  }

  room.first.children.each do |c|
    @attributes[c.name] ||= c.text
  end
end

Instance Attribute Details

#attributesObject

ATTRIBUTES = [:id, :topic, :privacy, :is_archived, :guest_url, :owner, :last_active, :num_participants]



6
7
8
# File 'lib/xmpp4r/muc/hipchat/room_data.rb', line 6

def attributes
  @attributes
end

Class Method Details

.get_rooms_data(stream, conference_host) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/xmpp4r/muc/hipchat/room_data.rb', line 29

def get_rooms_data stream, conference_host
  iq = Iq.new(:get, conference_host)
  iq.from = stream.jid
  iq.add(Discovery::IqQueryDiscoItems.new)

  rooms = []
  stream.send_with_id(iq) do |answer|
    answer.query.each_element('item') do |item|
      rooms << self.new(item)
    end
  end
  rooms
end

Instance Method Details

#idObject



24
25
26
# File 'lib/xmpp4r/muc/hipchat/room_data.rb', line 24

def id
  @room.jid.node
end

#nameObject



20
21
22
# File 'lib/xmpp4r/muc/hipchat/room_data.rb', line 20

def name
  @room.iname
end