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 (Object) —

    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

  • :validate (Object) —

    Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.

See Also:



29
30
31
32
# File 'lib/slack/endpoint/channels.rb', line 29

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 (Object) —

    Channel to fetch history for.

  • :count (Object) —

    Number of messages to return, between 1 and 1000.

  • :inclusive (Object) —

    Include messages with latest or oldest timestamp in results.

  • :latest (Object) —

    End of time range of messages to include in results.

  • :oldest (Object) —

    Start of time range of messages to include in results.

  • :unreads (Object) —

    Include unread_count_display in the output?

See Also:



52
53
54
55
# File 'lib/slack/endpoint/channels.rb', line 52

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 (Object) —

    Channel to get info on

  • :include_locale (Object) —

    Set this to true to receive the locale for this channel. Defaults to false

See Also:



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

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 (Object) —

    Channel to invite user to.

  • :user (Object) —

    User to invite to channel.

See Also:



82
83
84
85
86
# File 'lib/slack/endpoint/channels.rb', line 82

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

  • :validate (Object) —

    Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.

See Also:



98
99
100
101
# File 'lib/slack/endpoint/channels.rb', line 98

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 (Object) —

    Channel to remove user from.

  • :user (Object) —

    User to remove from channel.

See Also:



113
114
115
116
117
# File 'lib/slack/endpoint/channels.rb', line 113

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 (Object) —

    Channel to leave

See Also:



127
128
129
130
# File 'lib/slack/endpoint/channels.rb', line 127

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):

  • :cursor (Object) —

    Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail.

  • :exclude_archived (Object) —

    Exclude archived channels from the list

  • :exclude_members (Object) —

    Exclude the members collection from each channel

  • :limit (Object) —

    The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached.

See Also:



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

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 (Object) —

    Channel to set reading cursor in.

  • :ts (Object) —

    Timestamp of the most recently seen message.

See Also:



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

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 (Object) —

    Channel to rename

  • :name (Object) —

    New name for channel.

  • :validate (Object) —

    Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.

See Also:



178
179
180
181
182
# File 'lib/slack/endpoint/channels.rb', line 178

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_replies(options = {}) ⇒ Object

Retrieve a thread of messages posted to a channel

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (Object) —

    Channel to fetch thread from

  • :thread_ts (Object) —

    Unique identifier of a thread's parent message

See Also:



194
195
196
197
198
# File 'lib/slack/endpoint/channels.rb', line 194

def channels_replies(options={})
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
  throw ArgumentError.new("Required arguments :thread_ts missing") if options[:thread_ts].nil?
  post("channels.replies", 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 (Object) —

    Channel to set the purpose of

  • :purpose (Object) —

    The new purpose

See Also:



210
211
212
213
214
# File 'lib/slack/endpoint/channels.rb', line 210

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 (Object) —

    Channel to set the topic of

  • :topic (Object) —

    The new topic

See Also:



226
227
228
229
230
# File 'lib/slack/endpoint/channels.rb', line 226

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 (Object) —

    Channel to unarchive

See Also:



240
241
242
243
# File 'lib/slack/endpoint/channels.rb', line 240

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