Class: HipChat::Client

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

Instance Method Summary collapse

Constructor Details

#initialize(token, options = {}) ⇒ Client

Returns a new instance of Client.



19
20
21
22
23
24
# File 'lib/hipchat-chef.rb', line 19

def initialize(token, options={})
  @token = token

  http_proxy = options[:http_proxy] || ENV['http_proxy']
  setup_proxy(http_proxy) if http_proxy
end

Instance Method Details

#[](name) ⇒ Object



31
32
33
# File 'lib/hipchat-chef.rb', line 31

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

#roomsObject



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

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