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.
data/lib/slack/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
 
4
4
  module Slack
5
5
  # The current version of the wrapper.
6
- VERSION = '0.0.6'
6
+ VERSION = '0.1.0'.freeze
7
7
  end
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 = "api"
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.do_get "#{SCOPE}.test", params
23
- Slack::parse_response(response)
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
@@ -6,7 +6,7 @@ module Slack
6
6
  # Module for the auth methods.
7
7
  module Auth
8
8
  # Endpoint scope
9
- SCOPE = "auth"
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.do_get "#{SCOPE}.test", params
19
- Slack::parse_response(response)
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
@@ -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 = "channels"
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
23
- response = @session.do_get "#{SCOPE}.archive", params
24
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'name' missing") if params['name'].nil?
37
- response = @session.do_get "#{SCOPE}.create", params
38
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
59
- response = @session.do_get "#{SCOPE}.history", params
60
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
73
- response = @session.do_get "#{SCOPE}.info", params
74
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
89
- raise ArgumentError.new("Required arguments 'user' missing") if params['user'].nil?
90
- response = @session.do_get "#{SCOPE}.invite", params
91
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'name' missing") if params['name'].nil?
104
- response = @session.do_get "#{SCOPE}.join", params
105
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
120
- raise ArgumentError.new("Required arguments 'user' missing") if params['user'].nil?
121
- response = @session.do_get "#{SCOPE}.kick", params
122
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
134
- response = @session.do_get "#{SCOPE}.leave", params
135
- Slack::parse_response(response)
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.do_get "#{SCOPE}.list", params
148
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
163
- raise ArgumentError.new("Required arguments 'ts' missing") if params['ts'].nil?
164
- response = @session.do_get "#{SCOPE}.mark", params
165
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
180
- raise ArgumentError.new("Required arguments 'name' missing") if params['name'].nil?
181
- response = @session.do_get "#{SCOPE}.rename", params
182
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
197
- raise ArgumentError.new("Required arguments 'purpose' missing") if params['purpose'].nil?
198
- response = @session.do_get "#{SCOPE}.setPurpose", params
199
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
214
- raise ArgumentError.new("Required arguments 'topic' missing") if params['topic'].nil?
215
- response = @session.do_get "#{SCOPE}.setTopic", params
216
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
229
- response = @session.do_get "#{SCOPE}.unarchive", params
230
- Slack::parse_response(response)
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
@@ -7,7 +7,7 @@ module Slack
7
7
  # Post chat messages to Slack.
8
8
  module Chat
9
9
  # Endpoint scope
10
- SCOPE = "chat"
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
- raise ArgumentError.new("Required arguments 'ts' missing") if params['ts'].nil?
24
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
25
- response = @session.do_get "#{SCOPE}.delete", params
26
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
59
- raise ArgumentError.new("Required arguments 'text' missing") if params['text'].nil?
60
- response = @session.do_get "#{SCOPE}.postMessage", params
61
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'ts' missing") if params['ts'].nil?
78
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
79
- raise ArgumentError.new("Required arguments 'text' missing") if params['text'].nil?
80
- response = @session.do_get "#{SCOPE}.update", params
81
- Slack::parse_response(response)
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
@@ -6,7 +6,7 @@ module Slack
6
6
  # Module for the emoji methods.
7
7
  module Emoji
8
8
  # Endpoint scope
9
- SCOPE = "emoji"
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.do_get "#{SCOPE}.list", params
19
- Slack::parse_response(response)
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
@@ -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 = "files"
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
- raise ArgumentError.new("Required arguments 'file' missing") if params['file'].nil?
22
- response = @session.do_get "#{SCOPE}.delete", params
23
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments :file missing") if params['file'].nil
40
- response = @session.do_get "#{SCOPE}.info", params
41
- Slack::parse_response(response)
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.do_get "#{SCOPE}.list", params
74
- Slack::parse_response(response)
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 options [Object] 'title'
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.do_get "#{SCOPE}.upload", params
98
- Slack::parse_response(response)
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
@@ -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 = "groups"
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
22
- response = @session.do_get "#{SCOPE}.archive", params
23
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
36
- response = @session.do_get "#{SCOPE}.close", params
37
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'name' missing") if params['name'].nil?
50
- response = @session.do_get "#{SCOPE}.create", params
51
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
64
- response = @session.do_get "#{SCOPE}.createChild", params
65
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
86
- response = @session.do_get "#{SCOPE}.history", params
87
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
102
- raise ArgumentError.new("Required arguments 'user' missing") if params['user'].nil?
103
- response = @session.do_get "#{SCOPE}.invite", params
104
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
119
- raise ArgumentError.new("Required arguments 'user' missing") if params['user'].nil?
120
- response = @session.do_get "#{SCOPE}.kick", params
121
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
133
- response = @session.do_get "#{SCOPE}.leave", params
134
- Slack::parse_response(response)
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.do_get "#{SCOPE}.list", params
147
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
162
- raise ArgumentError.new("Required arguments 'ts' missing") if params['ts'].nil?
163
- response = @session.do_get "#{SCOPE}.mark", params
164
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
177
- response = @session.do_get "#{SCOPE}.open", params
178
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments 'channel' missing") if params['channel'].nil?
193
- raise ArgumentError.new("Required arguments 'name' missing") if params['name'].nil?
194
- response = @session.do_get "#{SCOPE}.rename", params
195
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments :channel missing") if params['channel'].nil?
210
- raise ArgumentError.new("Required arguments :pupose missing") if params['purpos'].nil?
211
- response = @session.do_get "#{SCOPE}.setPurpose", params
212
- Slack::parse_response(response)
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
- raise ArgumentError.new("Required arguments :channel missing") if params['channel'].nil?
227
- raise ArgumentError.new("Required arguments :topic missing") if params['topic'].nil?
228
- response = @session.do_get "#{SCOPE}.setTopic", params
229
- Slack::parse_response(response)
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
- # @raise [ArgumentError] if 'channel' is not present
252
+ # @fail [ArgumentError] if 'channel' is not present
239
253
  # @see https://api.slack.com/methods/groups.unarchive
240
- def groups_unarchive(params={})
241
- raise ArgumentError.new("Required arguments :channel missing") if params['channel'].nil?
242
- response = @session.do_get "#{SCOPE}.unarchive", params
243
- Slack::parse_response(response)
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