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

This method 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
18
# File 'lib/slack/endpoint/channels.rb', line 14

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

#channels_create(options = {}) ⇒ Object

This method is used to create a channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :name (Object)

    Name of channel to create

See Also:



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

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

#channels_history(options = {}) ⇒ Object

This method returns a portion of message events from the specified channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (Object)

    Channel to fetch history for.

  • :latest (Object)

    End of time range of messages to include in results.

  • :oldest (Object)

    Start of time range of messages to include in results.

  • :inclusive (Object)

    Include messages with latest or oldest timestamp in results.

  • :count (Object)

    Number of messages to return, between 1 and 1000.

  • :unreads (Object)

    Include unread_count_display in the output?

See Also:



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

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

#channels_info(options = {}) ⇒ Object

This method returns information about a team channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (Object)

    Channel to get info on

See Also:



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

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

#channels_invite(options = {}) ⇒ Object

This method is used to invite a user to a channel. The calling user must be a member of the 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
87
# 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?
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("channels.invite", options)
end

#channels_join(options = {}) ⇒ Object

This method is used to join a channel. If the channel does not exist, it is created.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :name (Object)

    Name of channel to join

See Also:



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

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

#channels_kick(options = {}) ⇒ Object

This method allows a user to remove another member from a team 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:



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

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?
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("channels.kick", options)
end

#channels_leave(options = {}) ⇒ Object

This method is used to leave a channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (Object)

    Channel to leave

See Also:



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

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

#channels_list(options = {}) ⇒ Object

This method returns a list of all channels in the team. This includes channels the caller is in, channels they are not currently in, and archived channels but does not include private channels. The number of (non-deactivated) members in each channel is also returned.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :exclude_archived (Object)

    Don’t return archived channels.

See Also:



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

def channels_list(options={})
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("channels.list", options)
end

#channels_mark(options = {}) ⇒ Object

This method moves 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:



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

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?
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("channels.mark", options)
end

#channels_rename(options = {}) ⇒ Object

This method renames a team 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.

See Also:



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

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?
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("channels.rename", options)
end

#channels_setPurpose(options = {}) ⇒ Object

This method is used to change the purpose of a channel. The calling user must be a member of the 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:



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

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?
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("channels.setPurpose", options)
end

#channels_setTopic(options = {}) ⇒ Object

This method is used to change the topic of a channel. The calling user must be a member of the 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:



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

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?
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("channels.setTopic", options)
end

#channels_unarchive(options = {}) ⇒ Object

This method unarchives a channel. The calling user is added to the channel.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (Object)

    Channel to unarchive

See Also:



224
225
226
227
228
# File 'lib/slack/endpoint/channels.rb', line 224

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