Module: ChatWork::Client::MessageMethods
- Included in:
- ChatWork::Client
- Defined in:
- lib/chatwork/client/message_methods.rb
Instance Method Summary collapse
-
#create_message(room_id:, body:, self_unread: false) {|response_body, response_header| ... } ⇒ Hashie::Mash
Add new message to the chat.
-
#destroy_message(room_id:, message_id:) {|response_body, response_header| ... } ⇒ Hashie::Mash
Destroy the specified message.
-
#find_message(room_id:, message_id:) {|response_body, response_header| ... } ⇒ Hashie::Mash
Get information about the specified message.
-
#get_messages(room_id:, force: nil) {|response_body, response_header| ... } ⇒ Array<Hashie::Mash>
Get all messages associated with the specified chat (returns up to 100 entries).
-
#read_message(room_id:, message_id: nil) {|response_body, response_header| ... } ⇒ Hashie::Mash
Mark messages as read.
-
#unread_message(room_id:, message_id:) {|response_body, response_header| ... } ⇒ Hashie::Mash
Mark messages as unread.
-
#update_message(room_id:, message_id:, body:) {|response_body, response_header| ... } ⇒ Hashie::Mash
Update the specified message.
Instance Method Details
#create_message(room_id:, body:, self_unread: false) {|response_body, response_header| ... } ⇒ Hashie::Mash
Add new message to the chat
55 56 57 |
# File 'lib/chatwork/client/message_methods.rb', line 55 def (room_id:, body:, self_unread: false, &block) post("/rooms/#{room_id}/messages", body: body, self_unread: boolean_to_integer(self_unread), &block) end |
#destroy_message(room_id:, message_id:) {|response_body, response_header| ... } ⇒ Hashie::Mash
Destroy the specified message
176 177 178 |
# File 'lib/chatwork/client/message_methods.rb', line 176 def (room_id:, message_id:, &block) delete("/rooms/#{room_id}/messages/#{}", &block) end |
#find_message(room_id:, message_id:) {|response_body, response_header| ... } ⇒ Hashie::Mash
Get information about the specified message
131 132 133 |
# File 'lib/chatwork/client/message_methods.rb', line 131 def (room_id:, message_id:, &block) get("/rooms/#{room_id}/messages/#{}", &block) end |
#get_messages(room_id:, force: nil) {|response_body, response_header| ... } ⇒ 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.
32 33 34 |
# File 'lib/chatwork/client/message_methods.rb', line 32 def (room_id:, force: nil, &block) get("/rooms/#{room_id}/messages", force: boolean_to_integer(force), &block) end |
#read_message(room_id:, message_id: nil) {|response_body, response_header| ... } ⇒ Hashie::Mash
Mark messages as read
78 79 80 |
# File 'lib/chatwork/client/message_methods.rb', line 78 def (room_id:, message_id: nil, &block) put("/rooms/#{room_id}/messages/read", message_id: , &block) end |
#unread_message(room_id:, message_id:) {|response_body, response_header| ... } ⇒ Hashie::Mash
Mark messages as unread
101 102 103 |
# File 'lib/chatwork/client/message_methods.rb', line 101 def (room_id:, message_id:, &block) put("/rooms/#{room_id}/messages/unread", message_id: , &block) end |
#update_message(room_id:, message_id:, body:) {|response_body, response_header| ... } ⇒ Hashie::Mash
Update the specified message
154 155 156 |
# File 'lib/chatwork/client/message_methods.rb', line 154 def (room_id:, message_id:, body:, &block) put("/rooms/#{room_id}/messages/#{}", body: body, &block) end |