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
|
@@ -14,6 +14,7 @@ module Slack
|
|
|
14
14
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/im.close.json
|
|
15
15
|
def im_close(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('im.close', options)
|
|
18
19
|
end
|
|
19
20
|
|
|
@@ -36,6 +37,7 @@ module Slack
|
|
|
36
37
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/im.history.json
|
|
37
38
|
def im_history(options = {})
|
|
38
39
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
40
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
|
39
41
|
post('im.history', options)
|
|
40
42
|
end
|
|
41
43
|
|
|
@@ -60,6 +62,7 @@ module Slack
|
|
|
60
62
|
def im_mark(options = {})
|
|
61
63
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
62
64
|
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
|
65
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
|
63
66
|
post('im.mark', options)
|
|
64
67
|
end
|
|
65
68
|
|
|
@@ -72,6 +75,7 @@ module Slack
|
|
|
72
75
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/im.open.json
|
|
73
76
|
def im_open(options = {})
|
|
74
77
|
throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
|
|
78
|
+
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
|
75
79
|
post('im.open', options)
|
|
76
80
|
end
|
|
77
81
|
end
|
|
@@ -14,6 +14,7 @@ module Slack
|
|
|
14
14
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/mpim.close.json
|
|
15
15
|
def mpim_close(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('mpim.close', options)
|
|
18
19
|
end
|
|
19
20
|
|
|
@@ -36,6 +37,7 @@ module Slack
|
|
|
36
37
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/mpim.history.json
|
|
37
38
|
def mpim_history(options = {})
|
|
38
39
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
40
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
|
39
41
|
post('mpim.history', options)
|
|
40
42
|
end
|
|
41
43
|
|
|
@@ -60,6 +62,7 @@ module Slack
|
|
|
60
62
|
def mpim_mark(options = {})
|
|
61
63
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
62
64
|
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
|
65
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
|
63
66
|
post('mpim.mark', options)
|
|
64
67
|
end
|
|
65
68
|
|
|
@@ -21,6 +21,7 @@ module Slack
|
|
|
21
21
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/pins.add.json
|
|
22
22
|
def pins_add(options = {})
|
|
23
23
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
24
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
|
24
25
|
post('pins.add', options)
|
|
25
26
|
end
|
|
26
27
|
|
|
@@ -33,6 +34,7 @@ module Slack
|
|
|
33
34
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/pins.list.json
|
|
34
35
|
def pins_list(options = {})
|
|
35
36
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
37
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
|
36
38
|
post('pins.list', options)
|
|
37
39
|
end
|
|
38
40
|
|
|
@@ -52,6 +54,7 @@ module Slack
|
|
|
52
54
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/pins.remove.json
|
|
53
55
|
def pins_remove(options = {})
|
|
54
56
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
|
57
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
|
55
58
|
post('pins.remove', options)
|
|
56
59
|
end
|
|
57
60
|
end
|
|
@@ -23,6 +23,7 @@ module Slack
|
|
|
23
23
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/reactions.add.json
|
|
24
24
|
def reactions_add(options = {})
|
|
25
25
|
throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
|
|
26
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
|
26
27
|
post('reactions.add', options)
|
|
27
28
|
end
|
|
28
29
|
|
|
@@ -42,6 +43,7 @@ module Slack
|
|
|
42
43
|
# @see https://api.slack.com/methods/reactions.get
|
|
43
44
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/reactions.get.json
|
|
44
45
|
def reactions_get(options = {})
|
|
46
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
|
45
47
|
post('reactions.get', options)
|
|
46
48
|
end
|
|
47
49
|
|
|
@@ -55,6 +57,7 @@ module Slack
|
|
|
55
57
|
# @see https://api.slack.com/methods/reactions.list
|
|
56
58
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/reactions.list.json
|
|
57
59
|
def reactions_list(options = {})
|
|
60
|
+
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
|
58
61
|
post('reactions.list', options)
|
|
59
62
|
end
|
|
60
63
|
|
|
@@ -76,6 +79,7 @@ module Slack
|
|
|
76
79
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/reactions.remove.json
|
|
77
80
|
def reactions_remove(options = {})
|
|
78
81
|
throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
|
|
82
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
|
79
83
|
post('reactions.remove', options)
|
|
80
84
|
end
|
|
81
85
|
end
|
|
@@ -20,6 +20,7 @@ module Slack
|
|
|
20
20
|
# @see https://api.slack.com/methods/stars.add
|
|
21
21
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/stars.add.json
|
|
22
22
|
def stars_add(options = {})
|
|
23
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
|
23
24
|
post('stars.add', options)
|
|
24
25
|
end
|
|
25
26
|
|
|
@@ -31,6 +32,7 @@ module Slack
|
|
|
31
32
|
# @see https://api.slack.com/methods/stars.list
|
|
32
33
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/stars.list.json
|
|
33
34
|
def stars_list(options = {})
|
|
35
|
+
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
|
34
36
|
post('stars.list', options)
|
|
35
37
|
end
|
|
36
38
|
|
|
@@ -49,6 +51,7 @@ module Slack
|
|
|
49
51
|
# @see https://api.slack.com/methods/stars.remove
|
|
50
52
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/stars.remove.json
|
|
51
53
|
def stars_remove(options = {})
|
|
54
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
|
52
55
|
post('stars.remove', options)
|
|
53
56
|
end
|
|
54
57
|
end
|
|
@@ -37,6 +37,7 @@ module Slack
|
|
|
37
37
|
# @see https://api.slack.com/methods/team.integrationLogs
|
|
38
38
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/team.integrationLogs.json
|
|
39
39
|
def team_integrationLogs(options = {})
|
|
40
|
+
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
|
40
41
|
post('team.integrationLogs', options)
|
|
41
42
|
end
|
|
42
43
|
end
|
|
@@ -15,6 +15,7 @@ module Slack
|
|
|
15
15
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/users.getPresence.json
|
|
16
16
|
def users_getPresence(options = {})
|
|
17
17
|
throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
|
|
18
|
+
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
|
18
19
|
post('users.getPresence', options)
|
|
19
20
|
end
|
|
20
21
|
|
|
@@ -27,6 +28,7 @@ module Slack
|
|
|
27
28
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/users.info.json
|
|
28
29
|
def users_info(options = {})
|
|
29
30
|
throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
|
|
31
|
+
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
|
30
32
|
post('users.info', options)
|
|
31
33
|
end
|
|
32
34
|
|
data/lib/slack/web/api/error.rb
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mixin": true,
|
|
3
|
+
"group": "channels",
|
|
4
|
+
"name": "channels.id",
|
|
5
|
+
"desc": "This method returns the ID of a team channel.",
|
|
6
|
+
"args": {
|
|
7
|
+
"channel": {
|
|
8
|
+
"required": true,
|
|
9
|
+
"example": "#general",
|
|
10
|
+
"desc": "Channel to get ID for, prefixed with #.",
|
|
11
|
+
"type": "channel"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"errors": {
|
|
15
|
+
"channel_not_found": "Value passed for channel was invalid.",
|
|
16
|
+
"not_authed": "No authentication token provided.",
|
|
17
|
+
"invalid_auth": "Invalid authentication token.",
|
|
18
|
+
"account_inactive": "Authentication token is for a deleted user or team."
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Slack
|
|
2
|
+
module Web
|
|
3
|
+
module Api
|
|
4
|
+
module Mixins
|
|
5
|
+
module Channels
|
|
6
|
+
#
|
|
7
|
+
# This method returns a channel ID given a channel name.
|
|
8
|
+
#
|
|
9
|
+
# @option options [channel] :channel
|
|
10
|
+
# Channel to get ID for, prefixed with #.
|
|
11
|
+
def channels_id(options = {})
|
|
12
|
+
name = options[:channel]
|
|
13
|
+
throw ArgumentError.new('Required arguments :channel missing') if name.nil?
|
|
14
|
+
return { 'ok' => true, 'channel' => { 'id' => name } } unless name[0] == '#'
|
|
15
|
+
channels_list.tap do |list|
|
|
16
|
+
list['channels'].each do |channel|
|
|
17
|
+
return { 'ok' => true, 'channel' => { 'id' => channel['id'] } } if channel['name'] == name[1..-1]
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
fail Slack::Web::Api::Error, 'channel_not_found'
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mixin": true,
|
|
3
|
+
"group": "groups",
|
|
4
|
+
"name": "groups.id",
|
|
5
|
+
"desc": "This method returns the ID of a group.",
|
|
6
|
+
"args": {
|
|
7
|
+
"channel": {
|
|
8
|
+
"required": true,
|
|
9
|
+
"example": "#general",
|
|
10
|
+
"desc": "Group channel to get ID for, prefixed with #.",
|
|
11
|
+
"type": "group"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"errors": {
|
|
15
|
+
"channel_not_found": "Value passed for group was invalid.",
|
|
16
|
+
"not_authed": "No authentication token provided.",
|
|
17
|
+
"invalid_auth": "Invalid authentication token.",
|
|
18
|
+
"account_inactive": "Authentication token is for a deleted user or team."
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Slack
|
|
2
|
+
module Web
|
|
3
|
+
module Api
|
|
4
|
+
module Mixins
|
|
5
|
+
module Groups
|
|
6
|
+
#
|
|
7
|
+
# This method returns a group ID given a group name.
|
|
8
|
+
#
|
|
9
|
+
# @option options [channel] :channel
|
|
10
|
+
# Group channel to get ID for, prefixed with #.
|
|
11
|
+
def groups_id(options = {})
|
|
12
|
+
name = options[:channel]
|
|
13
|
+
throw ArgumentError.new('Required arguments :channel missing') if name.nil?
|
|
14
|
+
return { 'ok' => true, 'group' => { 'id' => name } } unless name[0] == '#'
|
|
15
|
+
groups_list.tap do |list|
|
|
16
|
+
list['groups'].each do |group|
|
|
17
|
+
return { 'ok' => true, 'group' => { 'id' => group['id'] } } if group['name'] == name[1..-1]
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
fail Slack::Web::Api::Error, 'channel_not_found'
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mixin": true,
|
|
3
|
+
"group": "users",
|
|
4
|
+
"name": "users.id",
|
|
5
|
+
"desc": "This method returns the ID of a team user.",
|
|
6
|
+
"args": {
|
|
7
|
+
"user": {
|
|
8
|
+
"required": true,
|
|
9
|
+
"example": "#general",
|
|
10
|
+
"desc": "User to get ID for, prefixed with @.",
|
|
11
|
+
"type": "user"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"errors": {
|
|
15
|
+
"user_not_found": "Value passed for user was invalid.",
|
|
16
|
+
"not_authed": "No authentication token provided.",
|
|
17
|
+
"invalid_auth": "Invalid authentication token.",
|
|
18
|
+
"account_inactive": "Authentication token is for a deleted user or team."
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Slack
|
|
2
|
+
module Web
|
|
3
|
+
module Api
|
|
4
|
+
module Mixins
|
|
5
|
+
module Users
|
|
6
|
+
#
|
|
7
|
+
# This method returns a user ID given a user name.
|
|
8
|
+
#
|
|
9
|
+
# @option options [user] :user
|
|
10
|
+
# User to get ID for, prefixed with '@'.
|
|
11
|
+
def users_id(options = {})
|
|
12
|
+
name = options[:user]
|
|
13
|
+
throw ArgumentError.new('Required arguments :user missing') if name.nil?
|
|
14
|
+
return { 'ok' => true, 'user' => { 'id' => name } } unless name[0] == '@'
|
|
15
|
+
users_list.tap do |list|
|
|
16
|
+
list['members'].each do |user|
|
|
17
|
+
return { 'ok' => true, 'user' => { 'id' => user['id'] } } if user['name'] == name[1..-1]
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
fail Slack::Web::Api::Error, 'user_not_found'
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -22,7 +22,10 @@ namespace :slack do
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
method_schema = JSON.parse(File.read('lib/slack/web/api/schema/method.json'))
|
|
25
|
-
data =
|
|
25
|
+
data = [
|
|
26
|
+
Dir.glob('lib/slack/web/api/slack-api-ref/methods/**/*.json'),
|
|
27
|
+
Dir.glob('lib/slack/web/api/mixins/**/*.json')
|
|
28
|
+
].flatten.each_with_object({}) do |path, result|
|
|
26
29
|
name = File.basename(path, '.json')
|
|
27
30
|
prefix, name = name.split('.')
|
|
28
31
|
result[prefix] ||= {}
|
|
@@ -8,6 +8,10 @@ module Slack
|
|
|
8
8
|
module Web
|
|
9
9
|
module Api
|
|
10
10
|
module Endpoints
|
|
11
|
+
include Slack::Web::Api::Mixins::Channels
|
|
12
|
+
include Slack::Web::Api::Mixins::Users
|
|
13
|
+
include Slack::Web::Api::Mixins::Groups
|
|
14
|
+
|
|
11
15
|
<% files.each do |f| %>
|
|
12
16
|
include <%= f.capitalize %>
|
|
13
17
|
<% end %>
|
|
@@ -6,17 +6,18 @@ module Slack
|
|
|
6
6
|
module Endpoints
|
|
7
7
|
module <%= group.capitalize %>
|
|
8
8
|
<% names.each_with_index do |(name, data), index| %>
|
|
9
|
+
<% next if data['mixin'] %>
|
|
9
10
|
<% if index > 0 %>
|
|
10
11
|
|
|
11
12
|
<% end %>
|
|
12
13
|
#
|
|
13
|
-
<% data[
|
|
14
|
+
<% data['desc'].split("\n").each do |line| %>
|
|
14
15
|
# <%= line %>
|
|
15
16
|
<% end %>
|
|
16
17
|
#
|
|
17
|
-
<% data[
|
|
18
|
-
# @option options [<%= arg_v[
|
|
19
|
-
<% arg_v[
|
|
18
|
+
<% data['args'].each do |arg_name, arg_v| %>
|
|
19
|
+
# @option options [<%= arg_v['type'] %>] :<%= arg_name %>
|
|
20
|
+
<% arg_v['desc'].lines.each do |l| %>
|
|
20
21
|
<% if l.strip.length > 0 %>
|
|
21
22
|
# <%= l.strip %>
|
|
22
23
|
<% else %>
|
|
@@ -27,8 +28,16 @@ module Slack
|
|
|
27
28
|
# @see https://api.slack.com/methods/<%= group %>.<%= name %>
|
|
28
29
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/<%= group %>.<%= name %>.json
|
|
29
30
|
def <%= group %>_<%= name %>(options = {})
|
|
30
|
-
<% data[
|
|
31
|
+
<% data['args'].select{ |k, v| v['required'] }.each do |arg_name, arg_v| %>
|
|
31
32
|
throw ArgumentError.new('Required arguments :<%= arg_name %> missing') if options[:<%= arg_name %>].nil?
|
|
33
|
+
<% end %>
|
|
34
|
+
<% if data['group'] == 'groups' && data['args']['channel'] && !data['args']['channel']['desc'].include?('Can be an encoded ID, or a name.') %>
|
|
35
|
+
options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
|
|
36
|
+
<% elsif data['args']['channel'] && !data['args']['channel']['desc'].include?('Can be an encoded ID, or a name.') %>
|
|
37
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
|
38
|
+
<% end %>
|
|
39
|
+
<% if data['args']['user'] %>
|
|
40
|
+
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
|
32
41
|
<% end %>
|
|
33
42
|
post('<%= group %>.<%= name %>', options)
|
|
34
43
|
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: post
|
|
5
|
+
uri: https://slack.com/api/channels.list
|
|
6
|
+
body:
|
|
7
|
+
encoding: UTF-8
|
|
8
|
+
string: token=token
|
|
9
|
+
response:
|
|
10
|
+
status:
|
|
11
|
+
code: 200
|
|
12
|
+
message: OK
|
|
13
|
+
headers:
|
|
14
|
+
Content-Type:
|
|
15
|
+
- application/json; charset=utf-8
|
|
16
|
+
body:
|
|
17
|
+
encoding: UTF-8
|
|
18
|
+
string: '{"ok":true,"channels":[{"id":"C04KB5X4D","name":"general","is_channel":true,"created":1430222230,"creator":"U04KB5WQR","is_archived":false,"is_general":true,"is_member":true,"last_read":"1435863302.000026","latest":{"type":"message","user":"U0HPMN0GY","text":"```\n{\"ok\":true,\"args\":{\"token\":\"xoxb-17803748576-H794PZkqOo4DkjYddb438F2J\"}}```","ts":"1452025068.000045"},"unread_count":321,"unread_count_display":283,"members":["U04JPQ0JS","U04JZBDQQ","U04KB5WQR"],"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"This
|
|
19
|
+
channel is for team-wide communication and announcements. All team members
|
|
20
|
+
are in this channel.","creator":"","last_set":0}}]}'
|
|
21
|
+
http_version:
|
|
22
|
+
recorded_at: Fri, 22 Jan 2016 19:01:46 GMT
|
|
23
|
+
- request:
|
|
24
|
+
method: post
|
|
25
|
+
uri: https://slack.com/api/channels.info
|
|
26
|
+
body:
|
|
27
|
+
encoding: UTF-8
|
|
28
|
+
string: channel=C04KB5X4D&token=token
|
|
29
|
+
headers:
|
|
30
|
+
Content-Type:
|
|
31
|
+
- application/x-www-form-urlencoded
|
|
32
|
+
response:
|
|
33
|
+
status:
|
|
34
|
+
code: 200
|
|
35
|
+
message: OK
|
|
36
|
+
headers:
|
|
37
|
+
Content-Type:
|
|
38
|
+
- application/json; charset=utf-8
|
|
39
|
+
body:
|
|
40
|
+
encoding: UTF-8
|
|
41
|
+
string: '{"ok":true,"channel":{"id":"C04KB5X4D","name":"general","is_channel":true,"created":1430222230,"creator":"U04KB5WQR","is_archived":false,"is_general":true,"is_member":true,"last_read":"1435863302.000026","latest":{"type":"message","user":"U0HPMN0GY","text":"```\n{\"ok\":true,\"args\":{\"token\":\"xoxb-17803748576-H794PZkqOo4DkjYddb438F2J\"}}```","ts":"1452025068.000045"},"unread_count":321,"unread_count_display":283,"members":["U04JPQ0JS","U04JZBDQQ","U04KB5WQR","U06JGTU5V","U07518DTL","U07KECJ77","U092BDCLV","U092V4E9L","U0EA7TZJN","U0H701CJZ","U0HLFUZLJ","U0HPMN0GY"],"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"This
|
|
42
|
+
channel is for team-wide communication and announcements. All team members
|
|
43
|
+
are in this channel.","creator":"","last_set":0}}}'
|
|
44
|
+
http_version:
|
|
45
|
+
recorded_at: Fri, 22 Jan 2016 19:01:46 GMT
|
|
46
|
+
recorded_with: VCR 3.0.1
|