Class: HipChat::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/hipchat.rb

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ Client

Returns a new instance of Client.



17
18
19
# File 'lib/hipchat.rb', line 17

def initialize(token)
  @token = token
end

Instance Method Details

#[](name) ⇒ Object



26
27
28
# File 'lib/hipchat.rb', line 26

def [](name)
  Room.new(@token, :room_id => name)
end

#roomsObject



21
22
23
24
# File 'lib/hipchat.rb', line 21

def rooms
  @rooms ||= self.class.get("/list", :query => {:auth_token => @token})['rooms'].
    map { |r| Room.new(@token, r) }
end