Module: Gitter::Client::Messages

Included in:
Gitter::Client
Defined in:
lib/gitter/client/messages.rb

Instance Method Summary collapse

Instance Method Details

#messages(room_id, options = {}) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/gitter/client/messages.rb', line 8

def messages(room_id, options={})
  message_list = []
  self.class.get("/rooms/#{room_id}/chatMessages", headers: @headers, query: options).each do |message|
    message_list << Hashie::Mash.new(message)
  end
  message_list
end

#send_message(message, room_id) ⇒ Object



16
17
18
# File 'lib/gitter/client/messages.rb', line 16

def send_message(message, room_id)
  Hashie::Mash.new(self.class.post("/rooms/#{room_id}/chatMessages", headers: @headers, body: { text: message }.to_json ))
end

#update_message(message, room_id, chat_id) ⇒ Object



20
21
22
# File 'lib/gitter/client/messages.rb', line 20

def update_message(message, room_id, chat_id)
  Hashie::Mash.new(self.class.put("/rooms/#{room_id}/chatMessages/#{chat_id}", headers: @headers, body: { text: message }.to_json ))
end