lib/slack/web/api/endpoints/im.rb in slack-ruby-client-0.5.3 vs lib/slack/web/api/endpoints/im.rb in slack-ruby-client-0.5.4

- old
+ new

@@ -12,10 +12,11 @@ # Direct message channel to close. # @see https://api.slack.com/methods/im.close # @see https://github.com/dblock/slack-api-ref/blob/master/methods/im.close.json def im_close(options = {}) throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil? + options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel] post('im.close', options) end # # This method returns a portion of messages/events from the specified direct message channel. @@ -34,10 +35,11 @@ # Include unread_count_display in the output?. # @see https://api.slack.com/methods/im.history # @see https://github.com/dblock/slack-api-ref/blob/master/methods/im.history.json def im_history(options = {}) throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil? + options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel] post('im.history', options) end # # This method returns a list of all im channels that the user has. @@ -58,10 +60,11 @@ # @see https://api.slack.com/methods/im.mark # @see https://github.com/dblock/slack-api-ref/blob/master/methods/im.mark.json def im_mark(options = {}) throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil? throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil? + options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel] post('im.mark', options) end # # This method opens a direct message channel with another member of your Slack team. @@ -70,9 +73,10 @@ # User to open a direct message channel with. # @see https://api.slack.com/methods/im.open # @see https://github.com/dblock/slack-api-ref/blob/master/methods/im.open.json def im_open(options = {}) throw ArgumentError.new('Required arguments :user missing') if options[:user].nil? + options = options.merge(user: users_id(options)['user']['id']) if options[:user] post('im.open', options) end end end end