Module: Slack::Endpoint::Channels

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

Instance Method Summary collapse

Instance Method Details

#channels_archive(options = {}) ⇒ Object

Archives a channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Channel to archive

See Also:



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

def channels_archive(options={})
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
  post("channels.archive", options)
end

#channels_create(options = {}) ⇒ Object

Creates a channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :name (Object)

    Name of channel to create

See Also:



27
28
29
30
# File 'lib/slack/endpoint/channels.rb', line 27

def channels_create(options={})
  throw ArgumentError.new("Required arguments :name missing") if options[:name].nil?
  post("channels.create", options)
end

#channels_history(options = {}) ⇒ Object

Fetches history of messages and events from a channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Channel to fetch history for.

  • :latest (timestamp)

    Latest message timestamp to include in results.

  • :oldest (timestamp)

    Oldest message timestamp to include in results.

  • :count (Object)

    Number of messages to return, between 1 and 1000.

See Also:



46
47
48
49
# File 'lib/slack/endpoint/channels.rb', line 46

def channels_history(options={})
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
  post("channels.history", options)
end

#channels_info(options = {}) ⇒ Object

Gets information about a channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Channel to get info on

See Also:



59
60
61
62
# File 'lib/slack/endpoint/channels.rb', line 59

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

#channels_invite(options = {}) ⇒ Object

Invites a user to a channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Channel to invite user to.

  • :user (user)

    User to invite to channel.

See Also:



74
75
76
77
78
# File 'lib/slack/endpoint/channels.rb', line 74

def channels_invite(options={})
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
  throw ArgumentError.new("Required arguments :user missing") if options[:user].nil?
  post("channels.invite", options)
end

#channels_join(options = {}) ⇒ Object

Joins a channel, creating it if needed.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :name (Object)

    Name of channel to join

See Also:



88
89
90
91
# File 'lib/slack/endpoint/channels.rb', line 88

def channels_join(options={})
  throw ArgumentError.new("Required arguments :name missing") if options[:name].nil?
  post("channels.join", options)
end

#channels_kick(options = {}) ⇒ Object

Removes a user from a channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Channel to remove user from.

  • :user (user)

    User to remove from channel.

See Also:



103
104
105
106
107
# File 'lib/slack/endpoint/channels.rb', line 103

def channels_kick(options={})
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
  throw ArgumentError.new("Required arguments :user missing") if options[:user].nil?
  post("channels.kick", options)
end

#channels_leave(options = {}) ⇒ Object

Leaves a channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Channel to leave

See Also:



117
118
119
120
# File 'lib/slack/endpoint/channels.rb', line 117

def channels_leave(options={})
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
  post("channels.leave", options)
end

#channels_list(options = {}) ⇒ Object

Lists all channels in a Slack team.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :exclude_archived (Object)

    Don’t return archived channels.

See Also:



130
131
132
# File 'lib/slack/endpoint/channels.rb', line 130

def channels_list(options={})
  post("channels.list", options)
end

#channels_mark(options = {}) ⇒ Object

Sets the read cursor in a channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Channel to set reading cursor in.

  • :ts (timestamp)

    Timestamp of the most recently seen message.

See Also:



144
145
146
147
148
# File 'lib/slack/endpoint/channels.rb', line 144

def channels_mark(options={})
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
  throw ArgumentError.new("Required arguments :ts missing") if options[:ts].nil?
  post("channels.mark", options)
end

#channels_rename(options = {}) ⇒ Object

Renames a channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Channel to rename

  • :name (Object)

    New name for channel.

See Also:



160
161
162
163
164
# File 'lib/slack/endpoint/channels.rb', line 160

def channels_rename(options={})
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
  throw ArgumentError.new("Required arguments :name missing") if options[:name].nil?
  post("channels.rename", options)
end

#channels_setPurpose(options = {}) ⇒ Object

Sets the purpose for a channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Channel to set the purpose of

  • :purpose (Object)

    The new purpose

See Also:



176
177
178
179
180
# File 'lib/slack/endpoint/channels.rb', line 176

def channels_setPurpose(options={})
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
  throw ArgumentError.new("Required arguments :purpose missing") if options[:purpose].nil?
  post("channels.setPurpose", options)
end

#channels_setTopic(options = {}) ⇒ Object

Sets the topic for a channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Channel to set the topic of

  • :topic (Object)

    The new topic

See Also:



192
193
194
195
196
# File 'lib/slack/endpoint/channels.rb', line 192

def channels_setTopic(options={})
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
  throw ArgumentError.new("Required arguments :topic missing") if options[:topic].nil?
  post("channels.setTopic", options)
end

#channels_unarchive(options = {}) ⇒ Object

Unarchives a channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Channel to unarchive

See Also:



206
207
208
209
# File 'lib/slack/endpoint/channels.rb', line 206

def channels_unarchive(options={})
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
  post("channels.unarchive", options)
end