lib/protolink/channel.rb in protolink-0.1.1 vs lib/protolink/channel.rb in protolink-0.2.0
- old
+ new
@@ -14,10 +14,20 @@
# Post a new message to the chat channel
def speak(message, options = {})
send_message(message)
end
+ def delete!
+ connection.delete("/api/v1/channels/#{self.id}")
+ end
+
+ def listener
+ users = connection.get("/api/v1/channels/#{self.id}/users")
+ users && users.map do |user|
+ User.new(connection, user)
+ end
+ end
protected
def load
reload! unless @loaded
@@ -32,10 +42,10 @@
@description = attributes['description']
@loaded = true
end
def send_message(message)
- connection.post("/api/v1/meeps/create", {:channel_id => self.id, :message => message})
+ connection.post("/api/v1/meeps/create", :body => {:channel_id => self.id, :message => message})
end
def connection
@connection
end