lib/chatwork/client/message_methods.rb in chatwork-0.8.0 vs lib/chatwork/client/message_methods.rb in chatwork-0.9.0
- old
+ new
@@ -36,12 +36,13 @@
# Add new message to the chat
#
# @see http://developer.chatwork.com/ja/endpoint_rooms.html#POST-rooms-room_id-messages
# @see http://download.chatwork.com/ChatWork_API_Documentation.pdf
#
- # @param room_id [Integer]
- # @param body [String] message body
+ # @param room_id [Integer]
+ # @param body [String] message body
+ # @param self_unread [Boolean] Whether to add the added message as unread by looking at it from myself
#
# @yield [response_body, response_header] if block was given, return response body and response header through block arguments
# @yieldparam response_body [Hashie::Mash] response body
# @yieldparam response_header [Hash<String, String>] response header (e.g. X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset)
#
@@ -49,11 +50,11 @@
#
# @example response format
# {
# "message_id": "1234"
# }
- def create_message(room_id:, body:, &block)
- post("/rooms/#{room_id}/messages", body: body, &block)
+ def create_message(room_id:, body:, self_unread: false, &block)
+ post("/rooms/#{room_id}/messages", body: body, self_unread: boolean_to_integer(self_unread), &block)
end
# Mark messages as read
#
# @see http://developer.chatwork.com/ja/endpoint_rooms.html#PUT-rooms-room_id-messages-read