broach 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/broach.rb +1 -1
- data/lib/broach/room.rb +8 -1
- metadata +1 -1
data/lib/broach.rb
CHANGED
@@ -26,7 +26,7 @@ require 'broach/exceptions'
|
|
26
26
|
#
|
27
27
|
# If you want to post multiple lines to one room, it's a good idea to create a Room instance.
|
28
28
|
#
|
29
|
-
# room = Broach.
|
29
|
+
# room = Broach::Room.find_by_name('Office')
|
30
30
|
# room.speak('Manfred just commited to the `weblog' repository')
|
31
31
|
# room.speak("commit 4578530113cb87e1e7dbd696c376181e97d429d7\n" +
|
32
32
|
# "Author: Manfred Stienstra <manfred@fngtps.com>\n" +
|
data/lib/broach/room.rb
CHANGED
@@ -43,9 +43,16 @@ module Broach
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
# Returns a Room instance for a room with a specific ID
|
46
|
+
# Returns a Room instance for a room with a specific ID, raises an exception when it
|
47
|
+
# can't find the room.
|
47
48
|
def self.find(id)
|
48
49
|
new(Broach.session.get("room/#{id.to_i}")['room'])
|
49
50
|
end
|
51
|
+
|
52
|
+
# Returns a Room instance for a room with a specific name, returns nil when it can't find
|
53
|
+
# the room.
|
54
|
+
def self.find_by_name(name)
|
55
|
+
all.find { |room| room.name == name }
|
56
|
+
end
|
50
57
|
end
|
51
58
|
end
|