slack-ruby-client 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +10 -6
- data/CHANGELOG.md +6 -0
- data/README.md +40 -2
- data/bin/commands/channels.rb +9 -0
- data/bin/commands/groups.rb +9 -0
- data/bin/commands/users.rb +9 -0
- data/examples/hi_real_time/hi.rb +5 -0
- data/lib/slack-ruby-client.rb +1 -0
- data/lib/slack/real_time/concurrency/celluloid.rb +4 -4
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints.rb +4 -0
- data/lib/slack/web/api/endpoints/channels.rb +13 -0
- data/lib/slack/web/api/endpoints/chat.rb +2 -0
- data/lib/slack/web/api/endpoints/dnd.rb +1 -0
- data/lib/slack/web/api/endpoints/files.rb +1 -0
- data/lib/slack/web/api/endpoints/groups.rb +16 -0
- data/lib/slack/web/api/endpoints/im.rb +4 -0
- data/lib/slack/web/api/endpoints/mpim.rb +3 -0
- data/lib/slack/web/api/endpoints/pins.rb +3 -0
- data/lib/slack/web/api/endpoints/reactions.rb +4 -0
- data/lib/slack/web/api/endpoints/stars.rb +3 -0
- data/lib/slack/web/api/endpoints/team.rb +1 -0
- data/lib/slack/web/api/endpoints/users.rb +2 -0
- data/lib/slack/web/api/error.rb +1 -1
- 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 +1 -1
- data/lib/slack/web/api/tasks/generate.rake +4 -1
- data/lib/slack/web/api/templates/endpoints.erb +4 -0
- data/lib/slack/web/api/templates/method.erb +14 -5
- 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/users_info.yml +130 -0
- data/spec/integration/integration_spec.rb +11 -2
- data/spec/slack/web/api/endpoints/channels_spec.rb +11 -0
- data/spec/slack/web/api/endpoints/groups_spec.rb +11 -0
- data/spec/slack/web/api/endpoints/users_spec.rb +4 -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
- metadata +25 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b77bc84985aeaa9109f41148ebfc2ef720c55232
|
|
4
|
+
data.tar.gz: b6a097a441ec9255f3b1b062bceca5b29888fd34
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b6f08da6827379462c86c589af7b4dd38b108b14a31d537bf740c727f16830d76ef982fd69ef6e573b26be8ebdeefe05d74eee7bfbebebc6a3814b965829c43c
|
|
7
|
+
data.tar.gz: 6b0f320fa1985a987e54f793d61463ad2780771db8871a8848140e912cc5f5fc817213a8885f80fc7e08ca10db81b17890a785e2e0223f28e6fe655293865717
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2016-01-
|
|
3
|
+
# on 2016-01-22 14:19:14 -0500 using RuboCop version 0.35.0.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
@@ -20,16 +20,20 @@ Lint/UnusedBlockArgument:
|
|
|
20
20
|
Exclude:
|
|
21
21
|
- 'lib/slack/messages/formatting.rb'
|
|
22
22
|
|
|
23
|
-
# Offense count:
|
|
23
|
+
# Offense count: 7
|
|
24
24
|
Metrics/AbcSize:
|
|
25
|
-
Max:
|
|
25
|
+
Max: 22
|
|
26
26
|
|
|
27
27
|
# Offense count: 1
|
|
28
28
|
# Configuration parameters: CountComments.
|
|
29
29
|
Metrics/ClassLength:
|
|
30
30
|
Max: 112
|
|
31
31
|
|
|
32
|
-
# Offense count:
|
|
32
|
+
# Offense count: 1
|
|
33
|
+
Metrics/CyclomaticComplexity:
|
|
34
|
+
Max: 7
|
|
35
|
+
|
|
36
|
+
# Offense count: 438
|
|
33
37
|
# Configuration parameters: AllowURI, URISchemes.
|
|
34
38
|
Metrics/LineLength:
|
|
35
39
|
Max: 288
|
|
@@ -39,7 +43,7 @@ Metrics/LineLength:
|
|
|
39
43
|
Metrics/MethodLength:
|
|
40
44
|
Max: 15
|
|
41
45
|
|
|
42
|
-
# Offense count:
|
|
46
|
+
# Offense count: 46
|
|
43
47
|
# Configuration parameters: Exclude.
|
|
44
48
|
Style/Documentation:
|
|
45
49
|
Enabled: false
|
|
@@ -50,7 +54,7 @@ Style/FileName:
|
|
|
50
54
|
Exclude:
|
|
51
55
|
- 'lib/slack-ruby-client.rb'
|
|
52
56
|
|
|
53
|
-
# Offense count:
|
|
57
|
+
# Offense count: 86
|
|
54
58
|
# Configuration parameters: AllowedVariables.
|
|
55
59
|
Style/GlobalVars:
|
|
56
60
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
### 0.5.4 (1/23/2016)
|
|
2
|
+
|
|
3
|
+
* [#45](https://github.com/dblock/slack-ruby-client/issues/45): Added `channels_id`, `groups_id` and `users_id` - [@dblock](https://github.com/dblock).
|
|
4
|
+
* [#45](https://github.com/dblock/slack-ruby-client/issues/45): Automatically lookup channel, group and user ID in Web API methods when Slack API doesn't accept #channel or @user names - [@dblock](https://github.com/dblock).
|
|
5
|
+
* [#49](https://github.com/dblock/slack-ruby-client/pull/49): Fix: Celluloid `#connected?` method. - [@mikz](https://github.com/mikz), [@kandadaboggu](https://github.com/kandadaboggu).
|
|
6
|
+
|
|
1
7
|
### 0.5.3 (1/11/2016)
|
|
2
8
|
|
|
3
9
|
* [#47](https://github.com/dblock/slack-ruby-client/pull/47): Fix: default to Celluloid newer API - [@jlyonsmith](https://github.com/jlyonsmith), [@dblock](https://github.com/dblock).
|
data/README.md
CHANGED
|
@@ -18,7 +18,7 @@ A Ruby client for the Slack [Web](https://api.slack.com/web) and [RealTime Messa
|
|
|
18
18
|
|
|
19
19
|
## Stable Release
|
|
20
20
|
|
|
21
|
-
You're reading the documentation for the **stable** release of slack-ruby-client, 0.5.
|
|
21
|
+
You're reading the documentation for the **stable** release of slack-ruby-client, 0.5.4. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
|
|
22
22
|
|
|
23
23
|
## Installation
|
|
24
24
|
|
|
@@ -103,6 +103,30 @@ client.files_upload(
|
|
|
103
103
|
)
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
+
### Get Channel Info
|
|
107
|
+
|
|
108
|
+
You can use a channel ID or name (prefixed with `#`) in all functions that take a `:channel` argument. Lookup by name is not supported by the Slack API and the `channels_id` method called invokes `channels_list` in order to locate the channel ID.
|
|
109
|
+
|
|
110
|
+
```ruby
|
|
111
|
+
client.channels_info(channel: 'C04KB5X4D') # calls channels_info
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
```ruby
|
|
115
|
+
client.channels_info(channel: '#general') # calls channels_list followed by channels_info
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Get User Info
|
|
119
|
+
|
|
120
|
+
You can use a user ID or name (prefixed with `@`) in all functions that take a `:user` argument. Lookup by name is not supported by the Slack API and the `users_id` method called invokes `users_list` in order to locate the user ID.
|
|
121
|
+
|
|
122
|
+
```ruby
|
|
123
|
+
client.users_info(user: 'U092BDCLV') # calls users_info
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
```ruby
|
|
127
|
+
client.users_info(user: '@dblock') # calls users_list followed by users_info
|
|
128
|
+
```
|
|
129
|
+
|
|
106
130
|
#### Other
|
|
107
131
|
|
|
108
132
|
Refer to the [Slack Web API Method Reference](https://api.slack.com/methods) for the list of all available functions.
|
|
@@ -207,7 +231,7 @@ See a fullly working example in [examples/hi_real_time](examples/hi_real_time/hi
|
|
|
207
231
|
|
|
208
232
|

|
|
209
233
|
|
|
210
|
-
###
|
|
234
|
+
### Combining RealTime and Web Clients
|
|
211
235
|
|
|
212
236
|
Since the Web client is used to obtain the RealTime client's WebSocket URL, you can continue using the Web client in combination with the RealTime client.
|
|
213
237
|
|
|
@@ -314,6 +338,20 @@ $ slack chat postMessage --text="hello world" --channel="#general"
|
|
|
314
338
|
{"ok":true,"channel":"...","ts":"...","message":{"text":"hello world","username":"bot","type":"message","subtype":"bot_message","ts":"..."}}
|
|
315
339
|
```
|
|
316
340
|
|
|
341
|
+
#### Get Channel Id
|
|
342
|
+
|
|
343
|
+
```
|
|
344
|
+
$ slack channels id --channel=#general
|
|
345
|
+
{"ok":true,"channel":{"id":"C04KB5X4D"}}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
#### Get Channel Info
|
|
349
|
+
|
|
350
|
+
```
|
|
351
|
+
$ slack channels info --channel=#general
|
|
352
|
+
{"ok":true,"channel":{"id":"C04KB5X4D","name":"general", ...}}
|
|
353
|
+
```
|
|
354
|
+
|
|
317
355
|
#### List Users
|
|
318
356
|
|
|
319
357
|
Combine with [jq](http://stedolan.github.io/jq), a command-line JSON parser.
|
data/bin/commands/channels.rb
CHANGED
|
@@ -137,4 +137,13 @@ command 'channels' do |g|
|
|
|
137
137
|
puts JSON.dump($client.channels_unarchive(options))
|
|
138
138
|
end
|
|
139
139
|
end
|
|
140
|
+
|
|
141
|
+
g.desc 'This method returns the ID of a team channel.'
|
|
142
|
+
g.long_desc %( This method returns the ID of a team channel. )
|
|
143
|
+
g.command 'id' do |c|
|
|
144
|
+
c.flag 'channel', desc: 'Channel to get ID for, prefixed with #.'
|
|
145
|
+
c.action do |_global_options, options, _args|
|
|
146
|
+
puts JSON.dump($client.channels_id(options))
|
|
147
|
+
end
|
|
148
|
+
end
|
|
140
149
|
end
|
data/bin/commands/groups.rb
CHANGED
|
@@ -155,4 +155,13 @@ command 'groups' do |g|
|
|
|
155
155
|
puts JSON.dump($client.groups_unarchive(options))
|
|
156
156
|
end
|
|
157
157
|
end
|
|
158
|
+
|
|
159
|
+
g.desc 'This method returns the ID of a group.'
|
|
160
|
+
g.long_desc %( This method returns the ID of a group. )
|
|
161
|
+
g.command 'id' do |c|
|
|
162
|
+
c.flag 'channel', desc: 'Group channel to get ID for, prefixed with #.'
|
|
163
|
+
c.action do |_global_options, options, _args|
|
|
164
|
+
puts JSON.dump($client.groups_id(options))
|
|
165
|
+
end
|
|
166
|
+
end
|
|
158
167
|
end
|
data/bin/commands/users.rb
CHANGED
|
@@ -45,4 +45,13 @@ command 'users' do |g|
|
|
|
45
45
|
puts JSON.dump($client.users_setPresence(options))
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
|
+
|
|
49
|
+
g.desc 'This method returns the ID of a team user.'
|
|
50
|
+
g.long_desc %( This method returns the ID of a team user. )
|
|
51
|
+
g.command 'id' do |c|
|
|
52
|
+
c.flag 'user', desc: 'User to get ID for, prefixed with @.'
|
|
53
|
+
c.action do |_global_options, options, _args|
|
|
54
|
+
puts JSON.dump($client.users_id(options))
|
|
55
|
+
end
|
|
56
|
+
end
|
|
48
57
|
end
|
data/examples/hi_real_time/hi.rb
CHANGED
data/lib/slack-ruby-client.rb
CHANGED
|
@@ -14,6 +14,7 @@ require 'slack/web/api/error'
|
|
|
14
14
|
require 'slack/web/faraday/response/raise_error'
|
|
15
15
|
require 'slack/web/faraday/connection'
|
|
16
16
|
require 'slack/web/faraday/request'
|
|
17
|
+
require 'slack/web/api/mixins'
|
|
17
18
|
require 'slack/web/api/endpoints'
|
|
18
19
|
require 'slack/web/client'
|
|
19
20
|
|
|
@@ -50,6 +50,10 @@ module Slack
|
|
|
50
50
|
Actor.new(future)
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
+
def connected?
|
|
54
|
+
!@connected.nil?
|
|
55
|
+
end
|
|
56
|
+
|
|
53
57
|
protected
|
|
54
58
|
|
|
55
59
|
class Actor
|
|
@@ -64,10 +68,6 @@ module Slack
|
|
|
64
68
|
end
|
|
65
69
|
end
|
|
66
70
|
|
|
67
|
-
def connected?
|
|
68
|
-
!@connected.nil?
|
|
69
|
-
end
|
|
70
|
-
|
|
71
71
|
def build_socket
|
|
72
72
|
socket = TCPSocket.new(addr, port)
|
|
73
73
|
socket = SSLSocket.new(socket, build_ssl_context) if secure?
|
data/lib/slack/version.rb
CHANGED
|
@@ -14,6 +14,7 @@ module Slack
|
|
|
14
14
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels.archive.json
|
|
15
15
|
def channels_archive(options = {})
|
|
16
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]
|
|
17
18
|
post('channels.archive', options)
|
|
18
19
|
end
|
|
19
20
|
|
|
@@ -48,6 +49,7 @@ module Slack
|
|
|
48
49
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels.history.json
|
|
49
50
|
def channels_history(options = {})
|
|
50
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]
|
|
51
53
|
post('channels.history', options)
|
|
52
54
|
end
|
|
53
55
|
|
|
@@ -60,6 +62,7 @@ module Slack
|
|
|
60
62
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels.info.json
|
|
61
63
|
def channels_info(options = {})
|
|
62
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]
|
|
63
66
|
post('channels.info', options)
|
|
64
67
|
end
|
|
65
68
|
|
|
@@ -75,6 +78,8 @@ module Slack
|
|
|
75
78
|
def channels_invite(options = {})
|
|
76
79
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
77
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]
|
|
78
83
|
post('channels.invite', options)
|
|
79
84
|
end
|
|
80
85
|
|
|
@@ -103,6 +108,8 @@ module Slack
|
|
|
103
108
|
def channels_kick(options = {})
|
|
104
109
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
105
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]
|
|
106
113
|
post('channels.kick', options)
|
|
107
114
|
end
|
|
108
115
|
|
|
@@ -115,6 +122,7 @@ module Slack
|
|
|
115
122
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels.leave.json
|
|
116
123
|
def channels_leave(options = {})
|
|
117
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]
|
|
118
126
|
post('channels.leave', options)
|
|
119
127
|
end
|
|
120
128
|
|
|
@@ -141,6 +149,7 @@ module Slack
|
|
|
141
149
|
def channels_mark(options = {})
|
|
142
150
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
143
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]
|
|
144
153
|
post('channels.mark', options)
|
|
145
154
|
end
|
|
146
155
|
|
|
@@ -156,6 +165,7 @@ module Slack
|
|
|
156
165
|
def channels_rename(options = {})
|
|
157
166
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
158
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]
|
|
159
169
|
post('channels.rename', options)
|
|
160
170
|
end
|
|
161
171
|
|
|
@@ -171,6 +181,7 @@ module Slack
|
|
|
171
181
|
def channels_setPurpose(options = {})
|
|
172
182
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
173
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]
|
|
174
185
|
post('channels.setPurpose', options)
|
|
175
186
|
end
|
|
176
187
|
|
|
@@ -186,6 +197,7 @@ module Slack
|
|
|
186
197
|
def channels_setTopic(options = {})
|
|
187
198
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
188
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]
|
|
189
201
|
post('channels.setTopic', options)
|
|
190
202
|
end
|
|
191
203
|
|
|
@@ -198,6 +210,7 @@ module Slack
|
|
|
198
210
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels.unarchive.json
|
|
199
211
|
def channels_unarchive(options = {})
|
|
200
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]
|
|
201
214
|
post('channels.unarchive', options)
|
|
202
215
|
end
|
|
203
216
|
end
|
|
@@ -17,6 +17,7 @@ module Slack
|
|
|
17
17
|
def chat_delete(options = {})
|
|
18
18
|
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
|
19
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]
|
|
20
21
|
post('chat.delete', options)
|
|
21
22
|
end
|
|
22
23
|
|
|
@@ -80,6 +81,7 @@ module Slack
|
|
|
80
81
|
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
|
81
82
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
82
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]
|
|
83
85
|
post('chat.update', options)
|
|
84
86
|
end
|
|
85
87
|
end
|
|
@@ -31,6 +31,7 @@ module Slack
|
|
|
31
31
|
# @see https://api.slack.com/methods/dnd.info
|
|
32
32
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/dnd.info.json
|
|
33
33
|
def dnd_info(options = {})
|
|
34
|
+
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
|
34
35
|
post('dnd.info', options)
|
|
35
36
|
end
|
|
36
37
|
|
|
@@ -73,6 +73,7 @@ module Slack
|
|
|
73
73
|
# @see https://api.slack.com/methods/files.list
|
|
74
74
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/files.list.json
|
|
75
75
|
def files_list(options = {})
|
|
76
|
+
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
|
76
77
|
post('files.list', options)
|
|
77
78
|
end
|
|
78
79
|
|
|
@@ -14,6 +14,7 @@ module Slack
|
|
|
14
14
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.archive.json
|
|
15
15
|
def groups_archive(options = {})
|
|
16
16
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
17
|
+
options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
|
|
17
18
|
post('groups.archive', options)
|
|
18
19
|
end
|
|
19
20
|
|
|
@@ -26,6 +27,7 @@ module Slack
|
|
|
26
27
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.close.json
|
|
27
28
|
def groups_close(options = {})
|
|
28
29
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
30
|
+
options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
|
|
29
31
|
post('groups.close', options)
|
|
30
32
|
end
|
|
31
33
|
|
|
@@ -50,6 +52,7 @@ module Slack
|
|
|
50
52
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.createChild.json
|
|
51
53
|
def groups_createChild(options = {})
|
|
52
54
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
55
|
+
options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
|
|
53
56
|
post('groups.createChild', options)
|
|
54
57
|
end
|
|
55
58
|
|
|
@@ -72,6 +75,7 @@ module Slack
|
|
|
72
75
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.history.json
|
|
73
76
|
def groups_history(options = {})
|
|
74
77
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
78
|
+
options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
|
|
75
79
|
post('groups.history', options)
|
|
76
80
|
end
|
|
77
81
|
|
|
@@ -84,6 +88,7 @@ module Slack
|
|
|
84
88
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.info.json
|
|
85
89
|
def groups_info(options = {})
|
|
86
90
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
91
|
+
options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
|
|
87
92
|
post('groups.info', options)
|
|
88
93
|
end
|
|
89
94
|
|
|
@@ -99,6 +104,8 @@ module Slack
|
|
|
99
104
|
def groups_invite(options = {})
|
|
100
105
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
101
106
|
throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
|
|
107
|
+
options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
|
|
108
|
+
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
|
102
109
|
post('groups.invite', options)
|
|
103
110
|
end
|
|
104
111
|
|
|
@@ -114,6 +121,8 @@ module Slack
|
|
|
114
121
|
def groups_kick(options = {})
|
|
115
122
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
116
123
|
throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
|
|
124
|
+
options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
|
|
125
|
+
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
|
117
126
|
post('groups.kick', options)
|
|
118
127
|
end
|
|
119
128
|
|
|
@@ -126,6 +135,7 @@ module Slack
|
|
|
126
135
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.leave.json
|
|
127
136
|
def groups_leave(options = {})
|
|
128
137
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
138
|
+
options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
|
|
129
139
|
post('groups.leave', options)
|
|
130
140
|
end
|
|
131
141
|
|
|
@@ -153,6 +163,7 @@ module Slack
|
|
|
153
163
|
def groups_mark(options = {})
|
|
154
164
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
155
165
|
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
|
166
|
+
options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
|
|
156
167
|
post('groups.mark', options)
|
|
157
168
|
end
|
|
158
169
|
|
|
@@ -165,6 +176,7 @@ module Slack
|
|
|
165
176
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.open.json
|
|
166
177
|
def groups_open(options = {})
|
|
167
178
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
179
|
+
options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
|
|
168
180
|
post('groups.open', options)
|
|
169
181
|
end
|
|
170
182
|
|
|
@@ -180,6 +192,7 @@ module Slack
|
|
|
180
192
|
def groups_rename(options = {})
|
|
181
193
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
182
194
|
throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
|
|
195
|
+
options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
|
|
183
196
|
post('groups.rename', options)
|
|
184
197
|
end
|
|
185
198
|
|
|
@@ -195,6 +208,7 @@ module Slack
|
|
|
195
208
|
def groups_setPurpose(options = {})
|
|
196
209
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
197
210
|
throw ArgumentError.new('Required arguments :purpose missing') if options[:purpose].nil?
|
|
211
|
+
options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
|
|
198
212
|
post('groups.setPurpose', options)
|
|
199
213
|
end
|
|
200
214
|
|
|
@@ -210,6 +224,7 @@ module Slack
|
|
|
210
224
|
def groups_setTopic(options = {})
|
|
211
225
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
212
226
|
throw ArgumentError.new('Required arguments :topic missing') if options[:topic].nil?
|
|
227
|
+
options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
|
|
213
228
|
post('groups.setTopic', options)
|
|
214
229
|
end
|
|
215
230
|
|
|
@@ -222,6 +237,7 @@ module Slack
|
|
|
222
237
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.unarchive.json
|
|
223
238
|
def groups_unarchive(options = {})
|
|
224
239
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
240
|
+
options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
|
|
225
241
|
post('groups.unarchive', options)
|
|
226
242
|
end
|
|
227
243
|
end
|