Class: Blend::CLI::Hipchat
Instance Method Summary collapse
- #create(room) ⇒ Object
- #message(room, message) ⇒ Object
- #room(room) ⇒ Object
- #rooms ⇒ Object
- #topic(room, topic) ⇒ Object
- #users ⇒ Object
Instance Method Details
#create(room) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/blend/cli/hipchat.rb', line 36 def create( room ) puts "Creating room: #{room}" client.create_room( room, "Let's talk about #{room}!" ) rooms end |
#message(room, message) ⇒ Object
50 51 52 |
# File 'lib/blend/cli/hipchat.rb', line 50 def ( room, ) client. room, end |
#room(room) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/blend/cli/hipchat.rb', line 14 def room( room ) room_info = client.room_info( room ) puts "Name : #{room_info['name']}" puts "ID : #{room_info['room_id']}" puts "Topic : #{room_info['topic']}" puts "Last active : #{room_info['last_active']}" puts "Participants:" room_info['participants'].each do |p| puts p['name'] end end |
#rooms ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/blend/cli/hipchat.rb', line 5 def rooms client.rooms.sort do |b,a| a['last_active'].to_i <=> b['last_active'].to_i end.each do |r| printf "%6s %-35s %10s %s\n", r['room_id'], r['name'], r['last_active'], r['topic'] end end |
#topic(room, topic) ⇒ Object
45 46 47 |
# File 'lib/blend/cli/hipchat.rb', line 45 def topic( room, topic ) client.set_topic room, topic end |
#users ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/blend/cli/hipchat.rb', line 27 def users client.users.sort do |b,a| a['last_active'].to_i <=> b['last_active'].to_i end.each do |u| printf "%6s %-25s %-15s %-25s %-17s %-19s %s\n", u['user_id'], u['name'], u['mention_name'], u['email'], u['last_active'], u['timezone'], u['title'] end end |