lib/slack/web/api/endpoints/files.rb in slack-ruby-client-0.10.0 vs lib/slack/web/api/endpoints/files.rb in slack-ruby-client-0.11.0

- old
+ new

@@ -9,23 +9,39 @@ # Deletes a file. # # @option options [file] :file # ID of file to delete. # @see https://api.slack.com/methods/files.delete - # @see https://github.com/dblock/slack-api-ref/blob/master/methods/files/files.delete.json + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.delete.json def files_delete(options = {}) throw ArgumentError.new('Required arguments :file missing') if options[:file].nil? post('files.delete', options) end # + # Change the properties of a file (undocumented) + # + # @option options [Object] :file + # ID of the file to be edited + # @option options [Object] :title + # New title of the file + # @option options [Object] :filetype + # New filetype of the file. See https://api.slack.com/types/file#file_types for a list of all supported types. + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/undocumented/files/files.edit.json + def files_edit(options = {}) + throw ArgumentError.new('Required arguments :file missing') if options[:file].nil? + throw ArgumentError.new('Required arguments :title missing') if options[:title].nil? + post('files.edit', options) + end + + # # Gets information about a team file. # # @option options [file] :file # Specify a file by providing its ID. # @see https://api.slack.com/methods/files.info - # @see https://github.com/dblock/slack-api-ref/blob/master/methods/files/files.info.json + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.info.json def files_info(options = {}) throw ArgumentError.new('Required arguments :file missing') if options[:file].nil? post('files.info', options) end @@ -53,11 +69,11 @@ # You can pass multiple values in the types argument, like types=spaces,snippets.The default value is all, which does not filter the list. # . # @option options [user] :user # Filter files created by a single user. # @see https://api.slack.com/methods/files.list - # @see https://github.com/dblock/slack-api-ref/blob/master/methods/files/files.list.json + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.list.json def files_list(options = {}) options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel] options = options.merge(user: users_id(options)['user']['id']) if options[:user] post('files.list', options) end @@ -66,23 +82,38 @@ # Revokes public/external sharing access for a file # # @option options [file] :file # File to revoke. # @see https://api.slack.com/methods/files.revokePublicURL - # @see https://github.com/dblock/slack-api-ref/blob/master/methods/files/files.revokePublicURL.json + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.revokePublicURL.json def files_revokePublicURL(options = {}) throw ArgumentError.new('Required arguments :file missing') if options[:file].nil? post('files.revokePublicURL', options) end # + # Share an existing file in a channel (undocumented) + # + # @option options [Object] :file + # ID of the file to be shared + # @option options [channel] :channel + # Channel to share the file in. Works with both public (channel ID) and private channels (group ID). + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/undocumented/files/files.share.json + def files_share(options = {}) + throw ArgumentError.new('Required arguments :file missing') if options[:file].nil? + throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil? + options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel] + post('files.share', options) + end + + # # Enables a file for public/external sharing. # # @option options [file] :file # File to share. # @see https://api.slack.com/methods/files.sharedPublicURL - # @see https://github.com/dblock/slack-api-ref/blob/master/methods/files/files.sharedPublicURL.json + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.sharedPublicURL.json def files_sharedPublicURL(options = {}) throw ArgumentError.new('Required arguments :file missing') if options[:file].nil? post('files.sharedPublicURL', options) end @@ -102,10 +133,10 @@ # @option options [Object] :initial_comment # Initial comment to add to file. # @option options [Object] :title # Title of file. # @see https://api.slack.com/methods/files.upload - # @see https://github.com/dblock/slack-api-ref/blob/master/methods/files/files.upload.json + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.upload.json def files_upload(options = {}) post('files.upload', options) end end end