Module: Slack::Web::Api::Endpoints::Pins

Included in:
Slack::Web::Api::Endpoints
Defined in:
lib/slack/web/api/endpoints/pins.rb

Instance Method Summary collapse

Instance Method Details

#pins_add(options = {}) ⇒ Object

Pins an item to a channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Channel to pin the messsage to. You must also include a timestamp when pinning messages.

  • :timestamp (string)

    Timestamp of the message to pin. You must also include the channel.

Raises:

  • (ArgumentError)

See Also:



18
19
20
21
22
# File 'lib/slack/web/api/endpoints/pins.rb', line 18

def pins_add(options = {})
  raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
  post('pins.add', options)
end

#pins_list(options = {}) ⇒ Object

Lists items pinned to a channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Channel to get pinned items for.

Raises:

  • (ArgumentError)

See Also:



31
32
33
34
35
# File 'lib/slack/web/api/endpoints/pins.rb', line 31

def pins_list(options = {})
  raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
  post('pins.list', options)
end

#pins_remove(options = {}) ⇒ Object

Un-pins an item from a channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Channel where the item is pinned to.

  • :timestamp (string)

    Timestamp of the message to un-pin.

Raises:

  • (ArgumentError)

See Also:



46
47
48
49
50
# File 'lib/slack/web/api/endpoints/pins.rb', line 46

def pins_remove(options = {})
  raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
  post('pins.remove', options)
end