Module: Slack::Endpoint::Files

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

Instance Method Summary collapse

Instance Method Details

#files_info(options = {}) ⇒ Object

Gets information about a team file.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :file (file)

    File to fetch info for

See Also:



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

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

#files_list(options = {}) ⇒ Object

Lists & filters team files.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :user (user)

    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.

See Also:



43
44
45
# File 'lib/slack/endpoint/files.rb', line 43

def files_list(options={})
  post("files.list", options)
end

#files_upload(options = {}) ⇒ Object

Uploads or creates a 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 (channel)

    Comma separated list of channels to share the file into.

See Also:



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

def files_upload(options={})
  post("files.upload", options)
end