Module: Slack::Endpoint::Files

Included in:
Slack::Endpoint
Defined in:
lib/slack/endpoint/files.rb

Instance Method Summary collapse

Instance Method Details

#files_delete(options = {}) ⇒ Object

This method deletes a file from your team.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :file (Object)

    ID of file to delete.

See Also:



14
15
16
17
18
# File 'lib/slack/endpoint/files.rb', line 14

def files_delete(options={})
  throw ArgumentError.new("Required arguments :file missing") if options[:file].nil?
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("files.delete", options)
end

#files_info(options = {}) ⇒ Object

This method returns information about a file in your team.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :file (Object)

    File to fetch info for

  • :count (Object)

    Number of items to return per page.

  • :page (Object)

    Page number of results to return.

See Also:



32
33
34
35
36
# File 'lib/slack/endpoint/files.rb', line 32

def files_info(options={})
  throw ArgumentError.new("Required arguments :file missing") if options[:file].nil?
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("files.info", options)
end

#files_list(options = {}) ⇒ Object

This method returns a list of files within the team. It can be filtered and sliced in various ways.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :user (Object)

    Filter files created by a single user.

  • :ts_from (Object)

    Filter files created after this timestamp (inclusive).

  • :ts_to (Object)

    Filter files created before this timestamp (inclusive).

  • :types (Object)

    Filter files by type:

    all - All files posts - Posts snippets - Snippets images - Image files gdocs - Google docs zips - Zip files pdfs - PDF files

    You can pass multiple values in the types argument, like types=posts,snippets.The default value is all, which does not filter the list.

  • :count (Object)

    Number of items to return per page.

  • :page (Object)

    Page number of results to return.

See Also:



68
69
70
71
# File 'lib/slack/endpoint/files.rb', line 68

def files_list(options={})
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("files.list", options)
end

#files_upload(options = {}) ⇒ Object

This method allows you to create or upload an existing file.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :file (Object)

    File contents via multipart/form-data.

  • :content (Object)

    File contents via a POST var.

  • :filetype (Object)

    Slack-internal file type identifier.

  • :filename (Object)

    Filename of file.

  • :title (Object)

    Title of file.

  • :initial_comment (Object)

    Initial comment to add to file.

  • :channels (Object)

    Comma separated list of channels to share the file into.

See Also:



93
94
95
96
# File 'lib/slack/endpoint/files.rb', line 93

def files_upload(options={})
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("files.upload", options)
end