Module: Slack::Endpoint::Pins

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

Instance Method Summary collapse

Instance Method Details

#pins_add(options = {}) ⇒ Object

This method pins an item (file, file comment, channel message, or group message) to a particular channel. The channel argument is required and one of file, file_comment, or timestamp must also be specified.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (Object)

    Channel to pin the item in.

  • :file (Object)

    File to pin.

  • :file_comment (Object)

    File comment to pin.

  • :timestamp (Object)

    Timestamp of the message to pin.

See Also:



21
22
23
24
25
# File 'lib/slack/endpoint/pins.rb', line 21

def pins_add(options={})
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("pins.add", options)
end

#pins_list(options = {}) ⇒ Object

This method lists the items pinned to a channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (Object)

    Channel to get pinned items for.

See Also:



35
36
37
38
39
# File 'lib/slack/endpoint/pins.rb', line 35

def pins_list(options={})
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("pins.list", options)
end

#pins_remove(options = {}) ⇒ Object

This method un-pins an item (file, file comment, channel message, or group message) from a channel. The channel argument is required and one of file, file_comment, or timestamp must also be specified.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (Object)

    Channel where the item is pinned to.

  • :file (Object)

    File to un-pin.

  • :file_comment (Object)

    File comment to un-pin.

  • :timestamp (Object)

    Timestamp of the message to un-pin.

See Also:



56
57
58
59
60
# File 'lib/slack/endpoint/pins.rb', line 56

def pins_remove(options={})
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("pins.remove", options)
end