slack-api-wrapper 0.0.6 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +2 -0
- data/.coveralls.yml +1 -0
- data/{spec/slack/oauth2/flow_base_spec.rb → .simplecov} +0 -0
- data/.travis.yml +18 -1
- data/.yardopts +9 -0
- data/CHANGELOG.md +10 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/{LICENSE.txt → MIT-LICENSE} +0 -0
- data/README.md +50 -11
- data/Rakefile +3 -4
- data/lib/slack-api-wrapper.rb +15 -92
- data/lib/slack/client.rb +5 -6
- data/lib/slack/error.rb +1 -9
- data/lib/slack/request.rb +56 -0
- data/lib/slack/session.rb +20 -55
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api.rb +4 -5
- data/lib/slack/web/auth.rb +4 -4
- data/lib/slack/web/channels.rb +60 -61
- data/lib/slack/web/chat.rb +17 -18
- data/lib/slack/web/emoji.rb +4 -4
- data/lib/slack/web/files.rb +16 -16
- data/lib/slack/web/groups.rb +81 -68
- data/lib/slack/web/im.rb +21 -22
- data/lib/slack/web/pins.rb +65 -0
- data/lib/slack/web/reactions.rb +97 -0
- data/lib/slack/web/search.rb +17 -18
- data/lib/slack/web/stars.rb +4 -5
- data/lib/slack/web/team.rb +12 -4
- data/lib/slack/web/users.rb +22 -23
- data/slack-api-wrapper.gemspec +13 -11
- data/spec/slack/client_spec.rb +2 -3
- data/spec/slack/session_spec.rb +21 -0
- data/spec/slack_spec.rb +0 -19
- data/spec/spec_helper.rb +81 -1
- metadata +52 -16
- data/lib/slack/oauth2.rb +0 -10
- data/lib/slack/oauth2/flow.rb +0 -165
- data/lib/slack/oauth2/flow_base.rb +0 -81
- data/spec/slack/oauth2/flow_spec.rb +0 -0
- data/spec/slack/oauth2_spec.rb +0 -7
data/lib/slack/version.rb
CHANGED
data/lib/slack/web/api.rb
CHANGED
@@ -6,7 +6,7 @@ module Slack
|
|
6
6
|
# Module for the api methods.
|
7
7
|
module Api
|
8
8
|
# Endpoint scope
|
9
|
-
SCOPE =
|
9
|
+
SCOPE = 'api'
|
10
10
|
|
11
11
|
# Checks API calling code.
|
12
12
|
#
|
@@ -18,11 +18,10 @@ module Slack
|
|
18
18
|
# example property to return
|
19
19
|
#
|
20
20
|
# @see https://api.slack.com/methods/api.test
|
21
|
-
def api_test(params={})
|
22
|
-
response = @session.
|
23
|
-
Slack
|
21
|
+
def api_test(params = {})
|
22
|
+
response = @session.do_post "#{SCOPE}.test", params
|
23
|
+
Slack.parse_response(response)
|
24
24
|
end
|
25
|
-
|
26
25
|
end
|
27
26
|
end
|
28
27
|
end
|
data/lib/slack/web/auth.rb
CHANGED
@@ -6,7 +6,7 @@ module Slack
|
|
6
6
|
# Module for the auth methods.
|
7
7
|
module Auth
|
8
8
|
# Endpoint scope
|
9
|
-
SCOPE =
|
9
|
+
SCOPE = 'auth'
|
10
10
|
|
11
11
|
# Checks authentication & identity.
|
12
12
|
#
|
@@ -14,9 +14,9 @@ module Slack
|
|
14
14
|
# API call arguments
|
15
15
|
#
|
16
16
|
# @see https://api.slack.com/methods/auth.test
|
17
|
-
def auth_test(params={})
|
18
|
-
response = @session.
|
19
|
-
Slack
|
17
|
+
def auth_test(params = {})
|
18
|
+
response = @session.do_post "#{SCOPE}.test", params
|
19
|
+
Slack.parse_response(response)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
data/lib/slack/web/channels.rb
CHANGED
@@ -8,7 +8,7 @@ module Slack
|
|
8
8
|
# invite users, set the topic and purpose, and mark a channel as read.
|
9
9
|
module Channels
|
10
10
|
# Endpoint scope
|
11
|
-
SCOPE =
|
11
|
+
SCOPE = 'channels'
|
12
12
|
|
13
13
|
# Archives a channel.
|
14
14
|
#
|
@@ -19,9 +19,9 @@ module Slack
|
|
19
19
|
#
|
20
20
|
# @see https://api.slack.com/methods/channels.archive
|
21
21
|
def channels_archive(params = {})
|
22
|
-
|
23
|
-
response = @session.
|
24
|
-
Slack
|
22
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
23
|
+
response = @session.do_post "#{SCOPE}.archive", params
|
24
|
+
Slack.parse_response(response)
|
25
25
|
end
|
26
26
|
|
27
27
|
# Creates a channel.
|
@@ -33,9 +33,9 @@ module Slack
|
|
33
33
|
#
|
34
34
|
# @see https://api.slack.com/methods/channels.create
|
35
35
|
def channels_create(params = {})
|
36
|
-
|
37
|
-
response = @session.
|
38
|
-
Slack
|
36
|
+
fail ArgumentError, "Required arguments 'name' missing" if params['name'].nil?
|
37
|
+
response = @session.do_post "#{SCOPE}.create", params
|
38
|
+
Slack.parse_response(response)
|
39
39
|
end
|
40
40
|
|
41
41
|
# Fetches history of messages and events from a channel.
|
@@ -54,10 +54,10 @@ module Slack
|
|
54
54
|
# Number of messages to return, between 1 and 1000.
|
55
55
|
#
|
56
56
|
# @see https://api.slack.com/methods/channels.history
|
57
|
-
def channels_history(params={})
|
58
|
-
|
59
|
-
response = @session.
|
60
|
-
Slack
|
57
|
+
def channels_history(params = {})
|
58
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
59
|
+
response = @session.do_post "#{SCOPE}.history", params
|
60
|
+
Slack.parse_response(response)
|
61
61
|
end
|
62
62
|
|
63
63
|
# Gets information about a channel.
|
@@ -68,10 +68,10 @@ module Slack
|
|
68
68
|
# Channel to get info on
|
69
69
|
#
|
70
70
|
# @see https://api.slack.com/methods/channels.info
|
71
|
-
def channels_info(params={})
|
72
|
-
|
73
|
-
response = @session.
|
74
|
-
Slack
|
71
|
+
def channels_info(params = {})
|
72
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
73
|
+
response = @session.do_post "#{SCOPE}.info", params
|
74
|
+
Slack.parse_response(response)
|
75
75
|
end
|
76
76
|
|
77
77
|
# Invites a user to a channel.
|
@@ -84,11 +84,11 @@ module Slack
|
|
84
84
|
# User to invite to channel.
|
85
85
|
#
|
86
86
|
# @see https://api.slack.com/methods/channels.invite
|
87
|
-
def channels_invite(params={})
|
88
|
-
|
89
|
-
|
90
|
-
response = @session.
|
91
|
-
Slack
|
87
|
+
def channels_invite(params = {})
|
88
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
89
|
+
fail ArgumentError, "Required arguments 'user' missing" if params['user'].nil?
|
90
|
+
response = @session.do_post "#{SCOPE}.invite", params
|
91
|
+
Slack.parse_response(response)
|
92
92
|
end
|
93
93
|
|
94
94
|
# Joins a channel, creating it if needed.
|
@@ -99,10 +99,10 @@ module Slack
|
|
99
99
|
# Name of channel to join
|
100
100
|
#
|
101
101
|
# @see https://api.slack.com/methods/channels.join
|
102
|
-
def channels_join(params={})
|
103
|
-
|
104
|
-
response = @session.
|
105
|
-
Slack
|
102
|
+
def channels_join(params = {})
|
103
|
+
fail ArgumentError, "Required arguments 'name' missing" if params['name'].nil?
|
104
|
+
response = @session.do_post "#{SCOPE}.join", params
|
105
|
+
Slack.parse_response(response)
|
106
106
|
end
|
107
107
|
|
108
108
|
# Removes a user from a channel.
|
@@ -115,11 +115,11 @@ module Slack
|
|
115
115
|
# User to remove from channel.
|
116
116
|
#
|
117
117
|
# @see https://api.slack.com/methods/channels.kick
|
118
|
-
def channels_kick(params={})
|
119
|
-
|
120
|
-
|
121
|
-
response = @session.
|
122
|
-
Slack
|
118
|
+
def channels_kick(params = {})
|
119
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
120
|
+
fail ArgumentError, "Required arguments 'user' missing" if params['user'].nil?
|
121
|
+
response = @session.do_post "#{SCOPE}.kick", params
|
122
|
+
Slack.parse_response(response)
|
123
123
|
end
|
124
124
|
|
125
125
|
# Leaves a channel.
|
@@ -129,10 +129,10 @@ module Slack
|
|
129
129
|
# @option params [channel] 'channel'
|
130
130
|
# Channel to leave
|
131
131
|
# @see https://api.slack.com/methods/channels.leave
|
132
|
-
def channels_leave(params={})
|
133
|
-
|
134
|
-
response = @session.
|
135
|
-
Slack
|
132
|
+
def channels_leave(params = {})
|
133
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
134
|
+
response = @session.do_post "#{SCOPE}.leave", params
|
135
|
+
Slack.parse_response(response)
|
136
136
|
end
|
137
137
|
|
138
138
|
# Lists all channels in a Slack team.
|
@@ -143,9 +143,9 @@ module Slack
|
|
143
143
|
# Don't return archived channels.
|
144
144
|
#
|
145
145
|
# @see https://api.slack.com/methods/channels.list
|
146
|
-
def channels_list(params={})
|
147
|
-
response = @session.
|
148
|
-
Slack
|
146
|
+
def channels_list(params = {})
|
147
|
+
response = @session.do_post "#{SCOPE}.list", params
|
148
|
+
Slack.parse_response(response)
|
149
149
|
end
|
150
150
|
|
151
151
|
# Sets the read cursor in a channel.
|
@@ -158,11 +158,11 @@ module Slack
|
|
158
158
|
# Timestamp of the most recently seen message.
|
159
159
|
#
|
160
160
|
# @see https://api.slack.com/methods/channels.mark
|
161
|
-
def channels_mark(params={})
|
162
|
-
|
163
|
-
|
164
|
-
response = @session.
|
165
|
-
Slack
|
161
|
+
def channels_mark(params = {})
|
162
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
163
|
+
fail ArgumentError, "Required arguments 'ts' missing" if params['ts'].nil?
|
164
|
+
response = @session.do_post "#{SCOPE}.mark", params
|
165
|
+
Slack.parse_response(response)
|
166
166
|
end
|
167
167
|
|
168
168
|
# Renames a channel.
|
@@ -175,11 +175,11 @@ module Slack
|
|
175
175
|
# New name for channel.
|
176
176
|
#
|
177
177
|
# @see https://api.slack.com/methods/channels.rename
|
178
|
-
def channels_rename(params={})
|
179
|
-
|
180
|
-
|
181
|
-
response = @session.
|
182
|
-
Slack
|
178
|
+
def channels_rename(params = {})
|
179
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
180
|
+
fail ArgumentError, "Required arguments 'name' missing" if params['name'].nil?
|
181
|
+
response = @session.do_post "#{SCOPE}.rename", params
|
182
|
+
Slack.parse_response(response)
|
183
183
|
end
|
184
184
|
|
185
185
|
# Sets the purpose for a channel.
|
@@ -192,11 +192,11 @@ module Slack
|
|
192
192
|
# The new purpose
|
193
193
|
#
|
194
194
|
# @see https://api.slack.com/methods/channels.setPurpose
|
195
|
-
def channels_set_purpose(params={})
|
196
|
-
|
197
|
-
|
198
|
-
response = @session.
|
199
|
-
Slack
|
195
|
+
def channels_set_purpose(params = {})
|
196
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
197
|
+
fail ArgumentError, "Required arguments 'purpose' missing" if params['purpose'].nil?
|
198
|
+
response = @session.do_post "#{SCOPE}.setPurpose", params
|
199
|
+
Slack.parse_response(response)
|
200
200
|
end
|
201
201
|
|
202
202
|
# Sets the topic for a channel.
|
@@ -209,11 +209,11 @@ module Slack
|
|
209
209
|
# The new topic
|
210
210
|
# @raise [ArgumentError] if 'channel' or 'topic' are not present
|
211
211
|
# @see https://api.slack.com/methods/channels.setTopic
|
212
|
-
def channels_set_topic(params={})
|
213
|
-
|
214
|
-
|
215
|
-
response = @session.
|
216
|
-
Slack
|
212
|
+
def channels_set_topic(params = {})
|
213
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
214
|
+
fail ArgumentError, "Required arguments 'topic' missing" if params['topic'].nil?
|
215
|
+
response = @session.do_post "#{SCOPE}.setTopic", params
|
216
|
+
Slack.parse_response(response)
|
217
217
|
end
|
218
218
|
|
219
219
|
# Unarchives a channel.
|
@@ -224,12 +224,11 @@ module Slack
|
|
224
224
|
# Channel to unarchive
|
225
225
|
# @raise [ArgumentError] if 'channel' is not present
|
226
226
|
# @see https://api.slack.com/methods/channels.unarchive
|
227
|
-
def channels_unarchive(params={})
|
228
|
-
|
229
|
-
response = @session.
|
230
|
-
Slack
|
227
|
+
def channels_unarchive(params = {})
|
228
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
229
|
+
response = @session.do_post "#{SCOPE}.unarchive", params
|
230
|
+
Slack.parse_response(response)
|
231
231
|
end
|
232
|
-
|
233
232
|
end
|
234
233
|
end
|
235
234
|
end
|
data/lib/slack/web/chat.rb
CHANGED
@@ -7,7 +7,7 @@ module Slack
|
|
7
7
|
# Post chat messages to Slack.
|
8
8
|
module Chat
|
9
9
|
# Endpoint scope
|
10
|
-
SCOPE =
|
10
|
+
SCOPE = 'chat'
|
11
11
|
|
12
12
|
# Deletes a message.
|
13
13
|
#
|
@@ -19,11 +19,11 @@ module Slack
|
|
19
19
|
# Channel containing the message to be deleted.
|
20
20
|
#
|
21
21
|
# @see https://api.slack.com/methods/chat.delete
|
22
|
-
def chat_delete(params={})
|
23
|
-
|
24
|
-
|
25
|
-
response = @session.
|
26
|
-
Slack
|
22
|
+
def chat_delete(params = {})
|
23
|
+
fail ArgumentError, "Required arguments 'ts' missing" if params['ts'].nil?
|
24
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
25
|
+
response = @session.do_post "#{SCOPE}.delete", params
|
26
|
+
Slack.parse_response(response)
|
27
27
|
end
|
28
28
|
|
29
29
|
# Sends a message to a channel.
|
@@ -54,11 +54,11 @@ module Slack
|
|
54
54
|
# emoji to use as the icon for this message. Overrides `icon_url`.
|
55
55
|
#
|
56
56
|
# @see https://api.slack.com/methods/chat.postMessage
|
57
|
-
def chat_post_message(params={})
|
58
|
-
|
59
|
-
|
60
|
-
response = @session.
|
61
|
-
Slack
|
57
|
+
def chat_post_message(params = {})
|
58
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
59
|
+
fail ArgumentError, "Required arguments 'text' missing" if params['text'].nil?
|
60
|
+
response = @session.do_post "#{SCOPE}.postMessage", params
|
61
|
+
Slack.parse_response(response)
|
62
62
|
end
|
63
63
|
|
64
64
|
# Updates a message.
|
@@ -73,14 +73,13 @@ module Slack
|
|
73
73
|
# New text for the message, using the default formatting rules.
|
74
74
|
#
|
75
75
|
# @see https://api.slack.com/methods/chat.update
|
76
|
-
def chat_update(params={})
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
response = @session.
|
81
|
-
Slack
|
76
|
+
def chat_update(params = {})
|
77
|
+
fail ArgumentError, "Required arguments 'ts' missing" if params['ts'].nil?
|
78
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
79
|
+
fail ArgumentError, "Required arguments 'text' missing" if params['text'].nil?
|
80
|
+
response = @session.do_post "#{SCOPE}.update", params
|
81
|
+
Slack.parse_response(response)
|
82
82
|
end
|
83
|
-
|
84
83
|
end
|
85
84
|
end
|
86
85
|
end
|
data/lib/slack/web/emoji.rb
CHANGED
@@ -6,7 +6,7 @@ module Slack
|
|
6
6
|
# Module for the emoji methods.
|
7
7
|
module Emoji
|
8
8
|
# Endpoint scope
|
9
|
-
SCOPE =
|
9
|
+
SCOPE = 'emoji'
|
10
10
|
|
11
11
|
# Lists custom emoji for a team.
|
12
12
|
#
|
@@ -14,9 +14,9 @@ module Slack
|
|
14
14
|
# API call arguments
|
15
15
|
#
|
16
16
|
# @see https://api.slack.com/methods/emoji.list
|
17
|
-
def emoji_list(params={})
|
18
|
-
response = @session.
|
19
|
-
Slack
|
17
|
+
def emoji_list(params = {})
|
18
|
+
response = @session.do_post "#{SCOPE}.list", params
|
19
|
+
Slack.parse_response(response)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
data/lib/slack/web/files.rb
CHANGED
@@ -7,7 +7,7 @@ module Slack
|
|
7
7
|
# Get info on files uploaded to Slack, upload new files to Slack.
|
8
8
|
module Files
|
9
9
|
# Endpoint scope
|
10
|
-
SCOPE =
|
10
|
+
SCOPE = 'files'
|
11
11
|
|
12
12
|
# Deletes a file.
|
13
13
|
#
|
@@ -17,10 +17,10 @@ module Slack
|
|
17
17
|
# ID of file to delete.
|
18
18
|
#
|
19
19
|
# @see https://api.slack.com/methods/files.delete
|
20
|
-
def files_delete(params={})
|
21
|
-
|
22
|
-
response = @session.
|
23
|
-
Slack
|
20
|
+
def files_delete(params = {})
|
21
|
+
fail ArgumentError, "Required arguments 'file' missing" if params['file'].nil?
|
22
|
+
response = @session.do_post "#{SCOPE}.delete", params
|
23
|
+
Slack.parse_response(response)
|
24
24
|
end
|
25
25
|
|
26
26
|
# Gets information about a team file.
|
@@ -35,10 +35,10 @@ module Slack
|
|
35
35
|
# Page number of results to return.
|
36
36
|
#
|
37
37
|
# @see https://api.slack.com/methods/files.info
|
38
|
-
def files_info(params={})
|
39
|
-
|
40
|
-
response = @session.
|
41
|
-
Slack
|
38
|
+
def files_info(params = {})
|
39
|
+
fail ArgumentError, "Required arguments 'file' missing" if params['file'].nil?
|
40
|
+
response = @session.do_post "#{SCOPE}.info", params
|
41
|
+
Slack.parse_response(response)
|
42
42
|
end
|
43
43
|
|
44
44
|
# Lists & filters team files.
|
@@ -69,9 +69,9 @@ module Slack
|
|
69
69
|
# Page number of results to return.
|
70
70
|
#
|
71
71
|
# @see https://api.slack.com/methods/files.list
|
72
|
-
def files_list(params={})
|
73
|
-
response = @session.
|
74
|
-
Slack
|
72
|
+
def files_list(params = {})
|
73
|
+
response = @session.do_post "#{SCOPE}.list", params
|
74
|
+
Slack.parse_response(response)
|
75
75
|
end
|
76
76
|
|
77
77
|
# Uploads or creates a file.
|
@@ -86,16 +86,16 @@ module Slack
|
|
86
86
|
# Slack-internal file type identifier.
|
87
87
|
# @option params [Object] 'filename'
|
88
88
|
# Filename of file.
|
89
|
-
# @option
|
89
|
+
# @option params [Object] 'title'
|
90
90
|
# Title of file.
|
91
91
|
# @option params [Object] 'initial_comment'
|
92
92
|
# Initial comment to add to file.
|
93
93
|
# @option params [channel] 'channels'
|
94
94
|
# Comma separated list of channels to share the file into.
|
95
95
|
# @see https://api.slack.com/methods/files.upload
|
96
|
-
def files_upload(params={})
|
97
|
-
response = @session.
|
98
|
-
Slack
|
96
|
+
def files_upload(params = {})
|
97
|
+
response = @session.do_post "#{SCOPE}.upload", params
|
98
|
+
Slack.parse_response(response)
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
data/lib/slack/web/groups.rb
CHANGED
@@ -7,7 +7,7 @@ module Slack
|
|
7
7
|
# Get info on your team's private groups.
|
8
8
|
module Groups
|
9
9
|
# Endpoint scope
|
10
|
-
SCOPE =
|
10
|
+
SCOPE = 'groups'
|
11
11
|
|
12
12
|
# Archives a private group.
|
13
13
|
#
|
@@ -17,10 +17,10 @@ module Slack
|
|
17
17
|
# Private group to archive
|
18
18
|
#
|
19
19
|
# @see https://api.slack.com/methods/groups.archive
|
20
|
-
def groups_archive(params={})
|
21
|
-
|
22
|
-
response = @session.
|
23
|
-
Slack
|
20
|
+
def groups_archive(params = {})
|
21
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
22
|
+
response = @session.do_post "#{SCOPE}.archive", params
|
23
|
+
Slack.parse_response(response)
|
24
24
|
end
|
25
25
|
|
26
26
|
# Closes a private group.
|
@@ -31,10 +31,10 @@ module Slack
|
|
31
31
|
# Group to close.
|
32
32
|
#
|
33
33
|
# @see https://api.slack.com/methods/groups.close
|
34
|
-
def groups_close(params={})
|
35
|
-
|
36
|
-
response = @session.
|
37
|
-
Slack
|
34
|
+
def groups_close(params = {})
|
35
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
36
|
+
response = @session.do_post "#{SCOPE}.close", params
|
37
|
+
Slack.parse_response(response)
|
38
38
|
end
|
39
39
|
|
40
40
|
# Creates a private group.
|
@@ -45,10 +45,10 @@ module Slack
|
|
45
45
|
# Name of group to create
|
46
46
|
#
|
47
47
|
# @see https://api.slack.com/methods/groups.create
|
48
|
-
def groups_create(params={})
|
49
|
-
|
50
|
-
response = @session.
|
51
|
-
Slack
|
48
|
+
def groups_create(params = {})
|
49
|
+
fail ArgumentError, "Required arguments 'name' missing" if params['name'].nil?
|
50
|
+
response = @session.do_post "#{SCOPE}.create", params
|
51
|
+
Slack.parse_response(response)
|
52
52
|
end
|
53
53
|
|
54
54
|
# Clones and archives a private group.
|
@@ -59,10 +59,10 @@ module Slack
|
|
59
59
|
# Group to clone and archive.
|
60
60
|
#
|
61
61
|
# @see https://api.slack.com/methods/groups.createChild
|
62
|
-
def groups_create_child(params={})
|
63
|
-
|
64
|
-
response = @session.
|
65
|
-
Slack
|
62
|
+
def groups_create_child(params = {})
|
63
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
64
|
+
response = @session.do_post "#{SCOPE}.createChild", params
|
65
|
+
Slack.parse_response(response)
|
66
66
|
end
|
67
67
|
|
68
68
|
# Fetches history of messages and events from a private group.
|
@@ -81,10 +81,24 @@ module Slack
|
|
81
81
|
# Number of messages to return, between 1 and 1000.
|
82
82
|
#
|
83
83
|
# @see https://api.slack.com/methods/groups.history
|
84
|
-
def groups_history(params={})
|
85
|
-
|
86
|
-
response = @session.
|
87
|
-
Slack
|
84
|
+
def groups_history(params = {})
|
85
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
86
|
+
response = @session.do_post "#{SCOPE}.history", params
|
87
|
+
Slack.parse_response(response)
|
88
|
+
end
|
89
|
+
|
90
|
+
# This method returns information about a private group.
|
91
|
+
#
|
92
|
+
# @param [Hash] params
|
93
|
+
# API call arguments
|
94
|
+
# @option params [channel] 'channel'
|
95
|
+
# Group to get info on
|
96
|
+
#
|
97
|
+
# @see https://api.slack.com/methods/channels.info
|
98
|
+
def groups_info(params = {})
|
99
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
100
|
+
response = @session.do_post "#{SCOPE}.info", params
|
101
|
+
Slack.parse_response(response)
|
88
102
|
end
|
89
103
|
|
90
104
|
# Invites a user to a private group.
|
@@ -97,11 +111,11 @@ module Slack
|
|
97
111
|
# User to invite.
|
98
112
|
#
|
99
113
|
# @see https://api.slack.com/methods/groups.invite
|
100
|
-
def groups_invite(params={})
|
101
|
-
|
102
|
-
|
103
|
-
response = @session.
|
104
|
-
Slack
|
114
|
+
def groups_invite(params = {})
|
115
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
116
|
+
fail ArgumentError, "Required arguments 'user' missing" if params['user'].nil?
|
117
|
+
response = @session.do_post "#{SCOPE}.invite", params
|
118
|
+
Slack.parse_response(response)
|
105
119
|
end
|
106
120
|
|
107
121
|
# Removes a user from a private group.
|
@@ -114,11 +128,11 @@ module Slack
|
|
114
128
|
# User to remove from group.
|
115
129
|
#
|
116
130
|
# @see https://api.slack.com/methods/groups.kick
|
117
|
-
def groups_kick(params={})
|
118
|
-
|
119
|
-
|
120
|
-
response = @session.
|
121
|
-
Slack
|
131
|
+
def groups_kick(params = {})
|
132
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
133
|
+
fail ArgumentError, "Required arguments 'user' missing" if params['user'].nil?
|
134
|
+
response = @session.do_post "#{SCOPE}.kick", params
|
135
|
+
Slack.parse_response(response)
|
122
136
|
end
|
123
137
|
|
124
138
|
# Leaves a private group.
|
@@ -128,10 +142,10 @@ module Slack
|
|
128
142
|
# Group to leave
|
129
143
|
#
|
130
144
|
# @see https://api.slack.com/methods/groups.leave
|
131
|
-
def groups_leave(params={})
|
132
|
-
|
133
|
-
response = @session.
|
134
|
-
Slack
|
145
|
+
def groups_leave(params = {})
|
146
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
147
|
+
response = @session.do_post "#{SCOPE}.leave", params
|
148
|
+
Slack.parse_response(response)
|
135
149
|
end
|
136
150
|
|
137
151
|
# Lists private groups that the calling user has access to.
|
@@ -142,9 +156,9 @@ module Slack
|
|
142
156
|
# Don't return archived groups.
|
143
157
|
#
|
144
158
|
# @see https://api.slack.com/methods/groups.list
|
145
|
-
def groups_list(params={})
|
146
|
-
response = @session.
|
147
|
-
Slack
|
159
|
+
def groups_list(params = {})
|
160
|
+
response = @session.do_post "#{SCOPE}.list", params
|
161
|
+
Slack.parse_response(response)
|
148
162
|
end
|
149
163
|
|
150
164
|
# Sets the read cursor in a private group.
|
@@ -157,11 +171,11 @@ module Slack
|
|
157
171
|
# Timestamp of the most recently seen message.
|
158
172
|
#
|
159
173
|
# @see https://api.slack.com/methods/groups.mark
|
160
|
-
def groups_mark(params={})
|
161
|
-
|
162
|
-
|
163
|
-
response = @session.
|
164
|
-
Slack
|
174
|
+
def groups_mark(params = {})
|
175
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
176
|
+
fail ArgumentError, "Required arguments 'ts' missing" if params['ts'].nil?
|
177
|
+
response = @session.do_post "#{SCOPE}.mark", params
|
178
|
+
Slack.parse_response(response)
|
165
179
|
end
|
166
180
|
|
167
181
|
# Opens a private group.
|
@@ -172,10 +186,10 @@ module Slack
|
|
172
186
|
# Group to open.
|
173
187
|
#
|
174
188
|
# @see https://api.slack.com/methods/groups.open
|
175
|
-
def groups_open(params={})
|
176
|
-
|
177
|
-
response = @session.
|
178
|
-
Slack
|
189
|
+
def groups_open(params = {})
|
190
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
191
|
+
response = @session.do_post "#{SCOPE}.open", params
|
192
|
+
Slack.parse_response(response)
|
179
193
|
end
|
180
194
|
|
181
195
|
# Renames a private group.
|
@@ -188,11 +202,11 @@ module Slack
|
|
188
202
|
# New name for group.
|
189
203
|
#
|
190
204
|
# @see https://api.slack.com/methods/groups.rename
|
191
|
-
def groups_rename(params={})
|
192
|
-
|
193
|
-
|
194
|
-
response = @session.
|
195
|
-
Slack
|
205
|
+
def groups_rename(params = {})
|
206
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
207
|
+
fail ArgumentError, "Required arguments 'name' missing" if params['name'].nil?
|
208
|
+
response = @session.do_post "#{SCOPE}.rename", params
|
209
|
+
Slack.parse_response(response)
|
196
210
|
end
|
197
211
|
|
198
212
|
# Sets the purpose for a private group.
|
@@ -205,11 +219,11 @@ module Slack
|
|
205
219
|
# The new purpose
|
206
220
|
#
|
207
221
|
# @see https://api.slack.com/methods/groups.setPurpose
|
208
|
-
def groups_set_purpose(params={})
|
209
|
-
|
210
|
-
|
211
|
-
response = @session.
|
212
|
-
Slack
|
222
|
+
def groups_set_purpose(params = {})
|
223
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
224
|
+
fail ArgumentError, "Required arguments 'pupose' missing" if params['purpos'].nil?
|
225
|
+
response = @session.do_post "#{SCOPE}.setPurpose", params
|
226
|
+
Slack.parse_response(response)
|
213
227
|
end
|
214
228
|
|
215
229
|
# Sets the topic for a private group.
|
@@ -222,11 +236,11 @@ module Slack
|
|
222
236
|
# The new topic
|
223
237
|
#
|
224
238
|
# @see https://api.slack.com/methods/groups.setTopic
|
225
|
-
def groups_set_topic(params={})
|
226
|
-
|
227
|
-
|
228
|
-
response = @session.
|
229
|
-
Slack
|
239
|
+
def groups_set_topic(params = {})
|
240
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
241
|
+
fail ArgumentError, "Required arguments 'topic' missing" if params['topic'].nil?
|
242
|
+
response = @session.do_post "#{SCOPE}.setTopic", params
|
243
|
+
Slack.parse_response(response)
|
230
244
|
end
|
231
245
|
|
232
246
|
# Unarchives a private group.
|
@@ -235,14 +249,13 @@ module Slack
|
|
235
249
|
# API call arguments
|
236
250
|
# @option params [group] 'channel'
|
237
251
|
# Group to unarchive
|
238
|
-
# @
|
252
|
+
# @fail [ArgumentError] if 'channel' is not present
|
239
253
|
# @see https://api.slack.com/methods/groups.unarchive
|
240
|
-
def groups_unarchive(params={})
|
241
|
-
|
242
|
-
response = @session.
|
243
|
-
Slack
|
254
|
+
def groups_unarchive(params = {})
|
255
|
+
fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
|
256
|
+
response = @session.do_post "#{SCOPE}.unarchive", params
|
257
|
+
Slack.parse_response(response)
|
244
258
|
end
|
245
|
-
|
246
259
|
end
|
247
260
|
end
|
248
261
|
end
|