slack-ruby-client-bhe 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +17 -0
- data/.gitignore +4 -0
- data/.gitmodules +3 -0
- data/.rspec +2 -0
- data/.rubocop.yml +6 -0
- data/.rubocop_todo.yml +78 -0
- data/.travis.yml +26 -0
- data/CHANGELOG.md +79 -0
- data/CONTRIBUTING.md +157 -0
- data/Gemfile +5 -0
- data/LICENSE.md +22 -0
- data/README.md +385 -0
- data/RELEASING.md +69 -0
- data/Rakefile +19 -0
- data/UPGRADING.md +26 -0
- data/bin/commands.rb +21 -0
- data/bin/commands/api.rb +14 -0
- data/bin/commands/auth.rb +12 -0
- data/bin/commands/channels.rb +149 -0
- data/bin/commands/chat.rb +47 -0
- data/bin/commands/dnd.rb +47 -0
- data/bin/commands/emoji.rb +12 -0
- data/bin/commands/files.rb +72 -0
- data/bin/commands/groups.rb +167 -0
- data/bin/commands/im.rb +53 -0
- data/bin/commands/mpim.rb +53 -0
- data/bin/commands/oauth.rb +16 -0
- data/bin/commands/pins.rb +37 -0
- data/bin/commands/reactions.rb +53 -0
- data/bin/commands/rtm.rb +15 -0
- data/bin/commands/search.rb +40 -0
- data/bin/commands/stars.rb +37 -0
- data/bin/commands/team.rb +32 -0
- data/bin/commands/usergroups.rb +73 -0
- data/bin/commands/users.rb +57 -0
- data/bin/slack +50 -0
- data/examples/hi_real_time/Gemfile +5 -0
- data/examples/hi_real_time/hi.gif +0 -0
- data/examples/hi_real_time/hi.rb +32 -0
- data/examples/hi_real_time_and_web/Gemfile +5 -0
- data/examples/hi_real_time_and_web/hi.gif +0 -0
- data/examples/hi_real_time_and_web/hi.rb +24 -0
- data/examples/hi_real_time_async/Gemfile +5 -0
- data/examples/hi_real_time_async/hi.rb +29 -0
- data/examples/hi_web/Gemfile +3 -0
- data/examples/hi_web/hi.gif +0 -0
- data/examples/hi_web/hi.rb +12 -0
- data/examples/new_ticket/Gemfile +3 -0
- data/examples/new_ticket/new_ticket.rb +25 -0
- data/lib/slack-ruby-client.rb +29 -0
- data/lib/slack.rb +1 -0
- data/lib/slack/config.rb +21 -0
- data/lib/slack/messages/formatting.rb +30 -0
- data/lib/slack/real_time/api/message.rb +20 -0
- data/lib/slack/real_time/api/message_id.rb +14 -0
- data/lib/slack/real_time/api/ping.rb +16 -0
- data/lib/slack/real_time/api/typing.rb +17 -0
- data/lib/slack/real_time/client.rb +152 -0
- data/lib/slack/real_time/concurrency.rb +8 -0
- data/lib/slack/real_time/concurrency/celluloid.rb +93 -0
- data/lib/slack/real_time/concurrency/eventmachine.rb +39 -0
- data/lib/slack/real_time/config.rb +55 -0
- data/lib/slack/real_time/socket.rb +81 -0
- data/lib/slack/version.rb +3 -0
- data/lib/slack/web/api/endpoints.rb +53 -0
- data/lib/slack/web/api/endpoints/api.rb +24 -0
- data/lib/slack/web/api/endpoints/auth.rb +20 -0
- data/lib/slack/web/api/endpoints/channels.rb +220 -0
- data/lib/slack/web/api/endpoints/chat.rb +91 -0
- data/lib/slack/web/api/endpoints/dnd.rb +64 -0
- data/lib/slack/web/api/endpoints/emoji.rb +20 -0
- data/lib/slack/web/api/endpoints/files.rb +108 -0
- data/lib/slack/web/api/endpoints/groups.rb +247 -0
- data/lib/slack/web/api/endpoints/im.rb +85 -0
- data/lib/slack/web/api/endpoints/mpim.rb +84 -0
- data/lib/slack/web/api/endpoints/oauth.rb +32 -0
- data/lib/slack/web/api/endpoints/pins.rb +64 -0
- data/lib/slack/web/api/endpoints/presence.rb +23 -0
- data/lib/slack/web/api/endpoints/reactions.rb +89 -0
- data/lib/slack/web/api/endpoints/rtm.rb +27 -0
- data/lib/slack/web/api/endpoints/search.rb +65 -0
- data/lib/slack/web/api/endpoints/stars.rb +61 -0
- data/lib/slack/web/api/endpoints/team.rb +47 -0
- data/lib/slack/web/api/endpoints/usergroups.rb +113 -0
- data/lib/slack/web/api/endpoints/users.rb +73 -0
- data/lib/slack/web/api/error.rb +14 -0
- data/lib/slack/web/api/mixins.rb +3 -0
- data/lib/slack/web/api/mixins/channels.id.json +20 -0
- data/lib/slack/web/api/mixins/channels.id.rb +26 -0
- data/lib/slack/web/api/mixins/groups.id.json +20 -0
- data/lib/slack/web/api/mixins/groups.id.rb +26 -0
- data/lib/slack/web/api/mixins/users.id.json +20 -0
- data/lib/slack/web/api/mixins/users.id.rb +26 -0
- data/lib/slack/web/api/patches/chat.1.text-attachments-required.patch +13 -0
- data/lib/slack/web/api/patches/chat.2.attachments-json.patch +17 -0
- data/lib/slack/web/api/schema/group.json +14 -0
- data/lib/slack/web/api/schema/method.json +45 -0
- data/lib/slack/web/api/tasks/generate.rake +61 -0
- data/lib/slack/web/api/templates/command.erb +34 -0
- data/lib/slack/web/api/templates/commands.erb +5 -0
- data/lib/slack/web/api/templates/endpoints.erb +21 -0
- data/lib/slack/web/api/templates/method.erb +49 -0
- data/lib/slack/web/client.rb +28 -0
- data/lib/slack/web/config.rb +41 -0
- data/lib/slack/web/faraday/connection.rb +29 -0
- data/lib/slack/web/faraday/request.rb +39 -0
- data/lib/slack/web/faraday/response/raise_error.rb +15 -0
- data/lib/slack_ruby_client.rb +1 -0
- data/screenshots/register-bot.png +0 -0
- data/slack-ruby-client.gemspec +31 -0
- data/slack.png +0 -0
- data/spec/fixtures/slack/web/429_error.yml +83 -0
- data/spec/fixtures/slack/web/auth_test_error.yml +48 -0
- data/spec/fixtures/slack/web/auth_test_success.yml +57 -0
- data/spec/fixtures/slack/web/channels_info.yml +46 -0
- data/spec/fixtures/slack/web/groups_info.yml +43 -0
- data/spec/fixtures/slack/web/rtm_start.yml +73 -0
- data/spec/fixtures/slack/web/users_info.yml +130 -0
- data/spec/fixtures/slack/web/users_list.yml +72 -0
- data/spec/integration/integration_spec.rb +107 -0
- data/spec/slack/config_spec.rb +14 -0
- data/spec/slack/messages/formatting_spec.rb +43 -0
- data/spec/slack/real_time/api/message_spec.rb +15 -0
- data/spec/slack/real_time/api/ping_spec.rb +15 -0
- data/spec/slack/real_time/api/typing_spec.rb +15 -0
- data/spec/slack/real_time/client_spec.rb +198 -0
- data/spec/slack/real_time/concurrency/celluloid_spec.rb +58 -0
- data/spec/slack/real_time/concurrency/eventmachine_spec.rb +49 -0
- data/spec/slack/slack_spec.rb +58 -0
- data/spec/slack/version_spec.rb +7 -0
- data/spec/slack/web/api/endpoints/auth_spec.rb +20 -0
- data/spec/slack/web/api/endpoints/channels_spec.rb +11 -0
- data/spec/slack/web/api/endpoints/chat_spec.rb +33 -0
- data/spec/slack/web/api/endpoints/groups_spec.rb +11 -0
- data/spec/slack/web/api/endpoints/users_spec.rb +17 -0
- data/spec/slack/web/api/error_spec.rb +14 -0
- data/spec/slack/web/api/mixins/channels_spec.rb +31 -0
- data/spec/slack/web/api/mixins/groups_spec.rb +31 -0
- data/spec/slack/web/api/mixins/users_spec.rb +31 -0
- data/spec/slack/web/client_spec.rb +134 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/support/queue_with_timeout.rb +34 -0
- data/spec/support/real_time/concurrency/mock.rb +31 -0
- data/spec/support/real_time/connected_client.rb +16 -0
- data/spec/support/token.rb +10 -0
- data/spec/support/vcr.rb +8 -0
- metadata +392 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
# This file was auto-generated by lib/slack/web/api/tasks/generate.rake
|
2
|
+
|
3
|
+
require 'slack/web/api/endpoints/api'
|
4
|
+
require 'slack/web/api/endpoints/auth'
|
5
|
+
require 'slack/web/api/endpoints/channels'
|
6
|
+
require 'slack/web/api/endpoints/chat'
|
7
|
+
require 'slack/web/api/endpoints/dnd'
|
8
|
+
require 'slack/web/api/endpoints/emoji'
|
9
|
+
require 'slack/web/api/endpoints/files'
|
10
|
+
require 'slack/web/api/endpoints/groups'
|
11
|
+
require 'slack/web/api/endpoints/im'
|
12
|
+
require 'slack/web/api/endpoints/mpim'
|
13
|
+
require 'slack/web/api/endpoints/oauth'
|
14
|
+
require 'slack/web/api/endpoints/pins'
|
15
|
+
require 'slack/web/api/endpoints/reactions'
|
16
|
+
require 'slack/web/api/endpoints/rtm'
|
17
|
+
require 'slack/web/api/endpoints/search'
|
18
|
+
require 'slack/web/api/endpoints/stars'
|
19
|
+
require 'slack/web/api/endpoints/team'
|
20
|
+
require 'slack/web/api/endpoints/usergroups'
|
21
|
+
require 'slack/web/api/endpoints/users'
|
22
|
+
|
23
|
+
module Slack
|
24
|
+
module Web
|
25
|
+
module Api
|
26
|
+
module Endpoints
|
27
|
+
include Slack::Web::Api::Mixins::Channels
|
28
|
+
include Slack::Web::Api::Mixins::Users
|
29
|
+
include Slack::Web::Api::Mixins::Groups
|
30
|
+
|
31
|
+
include Api
|
32
|
+
include Auth
|
33
|
+
include Channels
|
34
|
+
include Chat
|
35
|
+
include Dnd
|
36
|
+
include Emoji
|
37
|
+
include Files
|
38
|
+
include Groups
|
39
|
+
include Im
|
40
|
+
include Mpim
|
41
|
+
include Oauth
|
42
|
+
include Pins
|
43
|
+
include Reactions
|
44
|
+
include Rtm
|
45
|
+
include Search
|
46
|
+
include Stars
|
47
|
+
include Team
|
48
|
+
include Usergroups
|
49
|
+
include Users
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# This file was auto-generated by lib/slack/web/api/tasks/generate.rake
|
2
|
+
|
3
|
+
module Slack
|
4
|
+
module Web
|
5
|
+
module Api
|
6
|
+
module Endpoints
|
7
|
+
module Api
|
8
|
+
#
|
9
|
+
# This method helps you test your calling code.
|
10
|
+
#
|
11
|
+
# @option options [Object] :error
|
12
|
+
# Error response to return.
|
13
|
+
# @option options [Object] :foo
|
14
|
+
# example property to return.
|
15
|
+
# @see https://api.slack.com/methods/api.test
|
16
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/api.test.json
|
17
|
+
def api_test(options = {})
|
18
|
+
post('api.test', options)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# This file was auto-generated by lib/slack/web/api/tasks/generate.rake
|
2
|
+
|
3
|
+
module Slack
|
4
|
+
module Web
|
5
|
+
module Api
|
6
|
+
module Endpoints
|
7
|
+
module Auth
|
8
|
+
#
|
9
|
+
# This method checks authentication and tells you who you are.
|
10
|
+
#
|
11
|
+
# @see https://api.slack.com/methods/auth.test
|
12
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/auth.test.json
|
13
|
+
def auth_test(options = {})
|
14
|
+
post('auth.test', options)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,220 @@
|
|
1
|
+
# This file was auto-generated by lib/slack/web/api/tasks/generate.rake
|
2
|
+
|
3
|
+
module Slack
|
4
|
+
module Web
|
5
|
+
module Api
|
6
|
+
module Endpoints
|
7
|
+
module Channels
|
8
|
+
#
|
9
|
+
# This method archives a channel.
|
10
|
+
#
|
11
|
+
# @option options [channel] :channel
|
12
|
+
# Channel to archive.
|
13
|
+
# @see https://api.slack.com/methods/channels.archive
|
14
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels.archive.json
|
15
|
+
def channels_archive(options = {})
|
16
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
17
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
18
|
+
post('channels.archive', options)
|
19
|
+
end
|
20
|
+
|
21
|
+
#
|
22
|
+
# This method is used to create a channel.
|
23
|
+
#
|
24
|
+
# @option options [Object] :name
|
25
|
+
# Name of channel to create.
|
26
|
+
# @see https://api.slack.com/methods/channels.create
|
27
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels.create.json
|
28
|
+
def channels_create(options = {})
|
29
|
+
throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
|
30
|
+
post('channels.create', options)
|
31
|
+
end
|
32
|
+
|
33
|
+
#
|
34
|
+
# This method returns a portion of messages/events from the specified channel.
|
35
|
+
# To read the entire history for a channel, call the method with no latest or
|
36
|
+
# oldest arguments, and then continue paging using the instructions below.
|
37
|
+
#
|
38
|
+
# @option options [channel] :channel
|
39
|
+
# Channel to fetch history for.
|
40
|
+
# @option options [timestamp] :latest
|
41
|
+
# End of time range of messages to include in results.
|
42
|
+
# @option options [timestamp] :oldest
|
43
|
+
# Start of time range of messages to include in results.
|
44
|
+
# @option options [Object] :inclusive
|
45
|
+
# Include messages with latest or oldest timestamp in results.
|
46
|
+
# @option options [Object] :unreads
|
47
|
+
# Include unread_count_display in the output?.
|
48
|
+
# @see https://api.slack.com/methods/channels.history
|
49
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels.history.json
|
50
|
+
def channels_history(options = {})
|
51
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
52
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
53
|
+
post('channels.history', options)
|
54
|
+
end
|
55
|
+
|
56
|
+
#
|
57
|
+
# This method returns information about a team channel.
|
58
|
+
#
|
59
|
+
# @option options [channel] :channel
|
60
|
+
# Channel to get info on.
|
61
|
+
# @see https://api.slack.com/methods/channels.info
|
62
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels.info.json
|
63
|
+
def channels_info(options = {})
|
64
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
65
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
66
|
+
post('channels.info', options)
|
67
|
+
end
|
68
|
+
|
69
|
+
#
|
70
|
+
# This method is used to invite a user to a channel. The calling user must be a member of the channel.
|
71
|
+
#
|
72
|
+
# @option options [channel] :channel
|
73
|
+
# Channel to invite user to.
|
74
|
+
# @option options [user] :user
|
75
|
+
# User to invite to channel.
|
76
|
+
# @see https://api.slack.com/methods/channels.invite
|
77
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels.invite.json
|
78
|
+
def channels_invite(options = {})
|
79
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
80
|
+
throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
|
81
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
82
|
+
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
83
|
+
post('channels.invite', options)
|
84
|
+
end
|
85
|
+
|
86
|
+
#
|
87
|
+
# This method is used to join a channel. If the channel does not exist, it is
|
88
|
+
# created.
|
89
|
+
#
|
90
|
+
# @option options [Object] :name
|
91
|
+
# Name of channel to join.
|
92
|
+
# @see https://api.slack.com/methods/channels.join
|
93
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels.join.json
|
94
|
+
def channels_join(options = {})
|
95
|
+
throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
|
96
|
+
post('channels.join', options)
|
97
|
+
end
|
98
|
+
|
99
|
+
#
|
100
|
+
# This method allows a user to remove another member from a team channel.
|
101
|
+
#
|
102
|
+
# @option options [channel] :channel
|
103
|
+
# Channel to remove user from.
|
104
|
+
# @option options [user] :user
|
105
|
+
# User to remove from channel.
|
106
|
+
# @see https://api.slack.com/methods/channels.kick
|
107
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels.kick.json
|
108
|
+
def channels_kick(options = {})
|
109
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
110
|
+
throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
|
111
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
112
|
+
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
113
|
+
post('channels.kick', options)
|
114
|
+
end
|
115
|
+
|
116
|
+
#
|
117
|
+
# This method is used to leave a channel.
|
118
|
+
#
|
119
|
+
# @option options [channel] :channel
|
120
|
+
# Channel to leave.
|
121
|
+
# @see https://api.slack.com/methods/channels.leave
|
122
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels.leave.json
|
123
|
+
def channels_leave(options = {})
|
124
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
125
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
126
|
+
post('channels.leave', options)
|
127
|
+
end
|
128
|
+
|
129
|
+
#
|
130
|
+
# 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.
|
131
|
+
#
|
132
|
+
# @option options [Object] :exclude_archived
|
133
|
+
# Don't return archived channels.
|
134
|
+
# @see https://api.slack.com/methods/channels.list
|
135
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels.list.json
|
136
|
+
def channels_list(options = {})
|
137
|
+
post('channels.list', options)
|
138
|
+
end
|
139
|
+
|
140
|
+
#
|
141
|
+
# This method moves the read cursor in a channel.
|
142
|
+
#
|
143
|
+
# @option options [channel] :channel
|
144
|
+
# Channel to set reading cursor in.
|
145
|
+
# @option options [timestamp] :ts
|
146
|
+
# Timestamp of the most recently seen message.
|
147
|
+
# @see https://api.slack.com/methods/channels.mark
|
148
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels.mark.json
|
149
|
+
def channels_mark(options = {})
|
150
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
151
|
+
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
152
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
153
|
+
post('channels.mark', options)
|
154
|
+
end
|
155
|
+
|
156
|
+
#
|
157
|
+
# This method renames a team channel.
|
158
|
+
#
|
159
|
+
# @option options [channel] :channel
|
160
|
+
# Channel to rename.
|
161
|
+
# @option options [Object] :name
|
162
|
+
# New name for channel.
|
163
|
+
# @see https://api.slack.com/methods/channels.rename
|
164
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels.rename.json
|
165
|
+
def channels_rename(options = {})
|
166
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
167
|
+
throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
|
168
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
169
|
+
post('channels.rename', options)
|
170
|
+
end
|
171
|
+
|
172
|
+
#
|
173
|
+
# This method is used to change the purpose of a channel. The calling user must be a member of the channel.
|
174
|
+
#
|
175
|
+
# @option options [channel] :channel
|
176
|
+
# Channel to set the purpose of.
|
177
|
+
# @option options [Object] :purpose
|
178
|
+
# The new purpose.
|
179
|
+
# @see https://api.slack.com/methods/channels.setPurpose
|
180
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels.setPurpose.json
|
181
|
+
def channels_setPurpose(options = {})
|
182
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
183
|
+
throw ArgumentError.new('Required arguments :purpose missing') if options[:purpose].nil?
|
184
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
185
|
+
post('channels.setPurpose', options)
|
186
|
+
end
|
187
|
+
|
188
|
+
#
|
189
|
+
# This method is used to change the topic of a channel. The calling user must be a member of the channel.
|
190
|
+
#
|
191
|
+
# @option options [channel] :channel
|
192
|
+
# Channel to set the topic of.
|
193
|
+
# @option options [Object] :topic
|
194
|
+
# The new topic.
|
195
|
+
# @see https://api.slack.com/methods/channels.setTopic
|
196
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels.setTopic.json
|
197
|
+
def channels_setTopic(options = {})
|
198
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
199
|
+
throw ArgumentError.new('Required arguments :topic missing') if options[:topic].nil?
|
200
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
201
|
+
post('channels.setTopic', options)
|
202
|
+
end
|
203
|
+
|
204
|
+
#
|
205
|
+
# This method unarchives a channel. The calling user is added to the channel.
|
206
|
+
#
|
207
|
+
# @option options [channel] :channel
|
208
|
+
# Channel to unarchive.
|
209
|
+
# @see https://api.slack.com/methods/channels.unarchive
|
210
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels.unarchive.json
|
211
|
+
def channels_unarchive(options = {})
|
212
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
213
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
214
|
+
post('channels.unarchive', options)
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# This file was auto-generated by lib/slack/web/api/tasks/generate.rake
|
2
|
+
|
3
|
+
module Slack
|
4
|
+
module Web
|
5
|
+
module Api
|
6
|
+
module Endpoints
|
7
|
+
module Chat
|
8
|
+
#
|
9
|
+
# This method deletes a message from a channel.
|
10
|
+
#
|
11
|
+
# @option options [timestamp] :ts
|
12
|
+
# Timestamp of the message to be deleted.
|
13
|
+
# @option options [channel] :channel
|
14
|
+
# Channel containing the message to be deleted.
|
15
|
+
# @see https://api.slack.com/methods/chat.delete
|
16
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/chat.delete.json
|
17
|
+
def chat_delete(options = {})
|
18
|
+
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
19
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
20
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
21
|
+
post('chat.delete', options)
|
22
|
+
end
|
23
|
+
|
24
|
+
#
|
25
|
+
# This method posts a message to a public channel, private group, or IM channel.
|
26
|
+
#
|
27
|
+
# @option options [channel] :channel
|
28
|
+
# Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.
|
29
|
+
# @option options [Object] :text
|
30
|
+
# Text of the message to send. See below for an explanation of formatting.
|
31
|
+
# @option options [Object] :username
|
32
|
+
# Name of bot.
|
33
|
+
# @option options [Object] :as_user
|
34
|
+
# Pass true to post the message as the authed user, instead of as a bot.
|
35
|
+
# @option options [Object] :parse
|
36
|
+
# Change how messages are treated. See below.
|
37
|
+
# @option options [Object] :link_names
|
38
|
+
# Find and link channel names and usernames.
|
39
|
+
# @option options [Object] :attachments
|
40
|
+
# Structured message attachments.
|
41
|
+
# @option options [Object] :unfurl_links
|
42
|
+
# Pass true to enable unfurling of primarily text-based content.
|
43
|
+
# @option options [Object] :unfurl_media
|
44
|
+
# Pass false to disable unfurling of media content.
|
45
|
+
# @option options [Object] :icon_url
|
46
|
+
# URL to an image to use as the icon for this message.
|
47
|
+
# @option options [Object] :icon_emoji
|
48
|
+
# emoji to use as the icon for this message. Overrides icon_url.
|
49
|
+
# @see https://api.slack.com/methods/chat.postMessage
|
50
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/chat.postMessage.json
|
51
|
+
def chat_postMessage(options = {})
|
52
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
53
|
+
throw ArgumentError.new('Required arguments :text or :attachments missing') if options[:text].nil? && options[:attachments].nil?
|
54
|
+
# attachments must be passed as an encoded JSON string
|
55
|
+
if options.key?(:attachments)
|
56
|
+
attachments = options[:attachments]
|
57
|
+
attachments = JSON.dump(attachments) unless attachments.is_a?(String)
|
58
|
+
options = options.merge(attachments: attachments)
|
59
|
+
end
|
60
|
+
post('chat.postMessage', options)
|
61
|
+
end
|
62
|
+
|
63
|
+
#
|
64
|
+
# This method updates a message in a channel.
|
65
|
+
#
|
66
|
+
# @option options [timestamp] :ts
|
67
|
+
# Timestamp of the message to be updated.
|
68
|
+
# @option options [channel] :channel
|
69
|
+
# Channel containing the message to be updated.
|
70
|
+
# @option options [Object] :text
|
71
|
+
# New text for the message, using the default formatting rules.
|
72
|
+
# @option options [Object] :attachments
|
73
|
+
# Structured message attachments.
|
74
|
+
# @option options [Object] :parse
|
75
|
+
# Change how messages are treated. See below.
|
76
|
+
# @option options [Object] :link_names
|
77
|
+
# Find and link channel names and usernames.
|
78
|
+
# @see https://api.slack.com/methods/chat.update
|
79
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/chat.update.json
|
80
|
+
def chat_update(options = {})
|
81
|
+
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
82
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
83
|
+
throw ArgumentError.new('Required arguments :text missing') if options[:text].nil?
|
84
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
85
|
+
post('chat.update', options)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# This file was auto-generated by lib/slack/web/api/tasks/generate.rake
|
2
|
+
|
3
|
+
module Slack
|
4
|
+
module Web
|
5
|
+
module Api
|
6
|
+
module Endpoints
|
7
|
+
module Dnd
|
8
|
+
#
|
9
|
+
# Ends the user's currently scheduled Do Not Disturb session immediately.
|
10
|
+
#
|
11
|
+
# @see https://api.slack.com/methods/dnd.endDnd
|
12
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/dnd.endDnd.json
|
13
|
+
def dnd_endDnd(options = {})
|
14
|
+
post('dnd.endDnd', options)
|
15
|
+
end
|
16
|
+
|
17
|
+
#
|
18
|
+
# Ends the current user's snooze mode immediately.
|
19
|
+
#
|
20
|
+
# @see https://api.slack.com/methods/dnd.endSnooze
|
21
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/dnd.endSnooze.json
|
22
|
+
def dnd_endSnooze(options = {})
|
23
|
+
post('dnd.endSnooze', options)
|
24
|
+
end
|
25
|
+
|
26
|
+
#
|
27
|
+
# Provides information about a user's current Do Not Disturb settings.
|
28
|
+
#
|
29
|
+
# @option options [user] :user
|
30
|
+
# User to fetch status for (defaults to current user).
|
31
|
+
# @see https://api.slack.com/methods/dnd.info
|
32
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/dnd.info.json
|
33
|
+
def dnd_info(options = {})
|
34
|
+
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
35
|
+
post('dnd.info', options)
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# Adjusts the snooze duration for a user's Do Not Disturb settings. If a snooze session is not already active for the user, invoking this method will begin one for the specified duration.
|
40
|
+
#
|
41
|
+
# @option options [Object] :num_minutes
|
42
|
+
# Number of minutes, from now, to snooze until.
|
43
|
+
# @see https://api.slack.com/methods/dnd.setSnooze
|
44
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/dnd.setSnooze.json
|
45
|
+
def dnd_setSnooze(options = {})
|
46
|
+
throw ArgumentError.new('Required arguments :num_minutes missing') if options[:num_minutes].nil?
|
47
|
+
post('dnd.setSnooze', options)
|
48
|
+
end
|
49
|
+
|
50
|
+
#
|
51
|
+
# Provides information about the current Do Not Disturb settings for users of a Slack team.
|
52
|
+
#
|
53
|
+
# @option options [Object] :users
|
54
|
+
# Comma-separated list of users to fetch Do Not Disturb status for.
|
55
|
+
# @see https://api.slack.com/methods/dnd.teamInfo
|
56
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/dnd.teamInfo.json
|
57
|
+
def dnd_teamInfo(options = {})
|
58
|
+
post('dnd.teamInfo', options)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|