Module: ChatWork::Message
- Extended by:
- EntityMethods
- Defined in:
- lib/chatwork/message.rb
Class Method Summary collapse
-
.create(room_id:, body:) ⇒ Hashie::Mash
Add new message to the chat.
-
.destroy(room_id:, message_id:) ⇒ Hashie::Mash
Destroy the specified message.
-
.find(room_id:, message_id:) ⇒ Hashie::Mash
Get information about the specified message.
-
.get(room_id:, force: nil) ⇒ Array<Hashie::Mash>
Get all messages associated with the specified chat (returns up to 100 entries).
-
.read(room_id:, message_id: nil) ⇒ Hashie::Mash
Mark messages as read.
-
.unread(room_id:, message_id:) ⇒ Hashie::Mash
Mark messages as unread.
-
.update(room_id:, message_id:, body:) ⇒ Hashie::Mash
Update the specified message.
Class Method Details
.create(room_id:, body:) ⇒ Hashie::Mash
Add new message to the chat
49 50 51 |
# File 'lib/chatwork/message.rb', line 49 def self.create(room_id:, body:) _post("/rooms/#{room_id}/messages", body: body) end |
.destroy(room_id:, message_id:) ⇒ Hashie::Mash
Destroy the specified message
150 151 152 |
# File 'lib/chatwork/message.rb', line 150 def self.destroy(room_id:, message_id:) _delete("/rooms/#{room_id}/messages/#{message_id}") end |
.find(room_id:, message_id:) ⇒ Hashie::Mash
Get information about the specified message
113 114 115 |
# File 'lib/chatwork/message.rb', line 113 def self.find(room_id:, message_id:) _get("/rooms/#{room_id}/messages/#{message_id}") end |
.get(room_id:, force: nil) ⇒ Array<Hashie::Mash>
Get all messages associated with the specified chat (returns up to 100 entries).
If the parameter is not set, it returns the next 100 entries from previous call.
31 32 33 |
# File 'lib/chatwork/message.rb', line 31 def self.get(room_id:, force: nil) _get("/rooms/#{room_id}/messages", force: boolean_to_integer(force)) end |
.read(room_id:, message_id: nil) ⇒ Hashie::Mash
Mark messages as read
68 69 70 |
# File 'lib/chatwork/message.rb', line 68 def self.read(room_id:, message_id: nil) _put("/rooms/#{room_id}/messages/read", message_id: ) end |
.unread(room_id:, message_id:) ⇒ Hashie::Mash
Mark messages as unread
87 88 89 |
# File 'lib/chatwork/message.rb', line 87 def self.unread(room_id:, message_id:) _put("/rooms/#{room_id}/messages/unread", message_id: ) end |
.update(room_id:, message_id:, body:) ⇒ Hashie::Mash
Update the specified message
132 133 134 |
# File 'lib/chatwork/message.rb', line 132 def self.update(room_id:, message_id:, body:) _put("/rooms/#{room_id}/messages/#{message_id}", body: body) end |