slack-api 1.4.0 → 1.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 571b107b642e75e3bfa7a194454566e68f03f792
4
- data.tar.gz: 97a0f11c6594fc6bb060e6cc4df77f34a81a4ec6
3
+ metadata.gz: 017d1be126fe1d0e7c4ae9a08ad1eeedf088580e
4
+ data.tar.gz: 8680353ff493994af9da9152bf2b45bceba7e3db
5
5
  SHA512:
6
- metadata.gz: d23bbac61b40e0210efaca05d6a7af3bac51719cb74631524a9ea94e3b6ed3779bec8a5e1dbecb4ff4dfa0e11c4d501e2b6da08fe8839059daf7c7bce20cb727
7
- data.tar.gz: ffec25a4593d5efe4951db4dab0072b5be1bd75f2e8091e6cd4a474ca4ff38281e3f7d2772e2697c3d00010554a09d56f0bd0b21c50191ef379b3d0d012acc5e
6
+ metadata.gz: 0895bc70fc8fc801123acbbaf0bb2dd5ab3dacbdb696de96bf0b1504d22a7ca39448f4a8827a37ed8528cce99294f13e3ce90a3f34b2fcd033d8d7530f0c2f4c
7
+ data.tar.gz: 13779cc2cfd9bce0ef574fa1b737b1b3c1ba55890e12821bf40e1a44d6c936e681b059351e89c499e08d4dd4926006c2c21e6b70815d8fbd6610af63a80be277
@@ -20,9 +20,15 @@ module Slack
20
20
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/<%= group %>.<%= name %>.json
21
21
  def <%= group %>_<%= name %>(options={})
22
22
  <% data["args"].reject{|k, v| k=="token"}.select{|k,v| v["required"]}.each do |arg_name, arg_v| %>
23
+ <% if group == "chat" && name == "postMessage" && arg_name == "text" %>
24
+ throw ArgumentError.new("Required arguments :text or :attachments missing") if options[:<%= arg_name %>].nil? && options[:attachments].nil?
25
+ <% next %>
26
+ <% end %>
23
27
  throw ArgumentError.new("Required arguments :<%= arg_name %> missing") if options[:<%= arg_name %>].nil?
24
28
  <% end %>
25
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
29
+ <% if data["args"].key? "attachments" %>
30
+ options[:attachments] = options[:attachments].to_json if options[:attachments].is_a?(Array) || options[:attachments].is_a?(Hash)
31
+ <% end %>
26
32
  post("<%= group %>.<%= name %>", options)
27
33
  end
28
34
 
@@ -23,8 +23,7 @@ module Slack
23
23
  include Endpoint
24
24
 
25
25
  def realtime
26
- url = post("rtm.start")["url"]
27
- RealTime::Client.new(url)
26
+ RealTime::Client.new(post("rtm.start"))
28
27
  end
29
28
  end
30
29
  end
@@ -14,7 +14,6 @@ module Slack
14
14
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/api.test.md
15
15
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/api.test.json
16
16
  def api_test(options={})
17
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
18
17
  post("api.test", options)
19
18
  end
20
19
 
@@ -12,7 +12,6 @@ module Slack
12
12
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/auth.revoke.md
13
13
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/auth.revoke.json
14
14
  def auth_revoke(options={})
15
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
16
15
  post("auth.revoke", options)
17
16
  end
18
17
 
@@ -23,7 +22,6 @@ module Slack
23
22
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/auth.test.md
24
23
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/auth.test.json
25
24
  def auth_test(options={})
26
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
27
25
  post("auth.test", options)
28
26
  end
29
27
 
@@ -12,7 +12,6 @@ module Slack
12
12
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/bots.info.md
13
13
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/bots.info.json
14
14
  def bots_info(options={})
15
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
16
15
  post("bots.info", options)
17
16
  end
18
17
 
@@ -13,7 +13,6 @@ module Slack
13
13
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.archive.json
14
14
  def channels_archive(options={})
15
15
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
16
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
17
16
  post("channels.archive", options)
18
17
  end
19
18
 
@@ -22,12 +21,13 @@ module Slack
22
21
  #
23
22
  # @option options [Object] :name
24
23
  # Name of channel to create
24
+ # @option options [Object] :validate
25
+ # Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.
25
26
  # @see https://api.slack.com/methods/channels.create
26
27
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.create.md
27
28
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.create.json
28
29
  def channels_create(options={})
29
30
  throw ArgumentError.new("Required arguments :name missing") if options[:name].nil?
30
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
31
31
  post("channels.create", options)
32
32
  end
33
33
 
@@ -51,7 +51,6 @@ module Slack
51
51
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.history.json
52
52
  def channels_history(options={})
53
53
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
54
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
55
54
  post("channels.history", options)
56
55
  end
57
56
 
@@ -65,7 +64,6 @@ module Slack
65
64
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.info.json
66
65
  def channels_info(options={})
67
66
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
68
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
69
67
  post("channels.info", options)
70
68
  end
71
69
 
@@ -82,7 +80,6 @@ module Slack
82
80
  def channels_invite(options={})
83
81
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
84
82
  throw ArgumentError.new("Required arguments :user missing") if options[:user].nil?
85
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
86
83
  post("channels.invite", options)
87
84
  end
88
85
 
@@ -92,12 +89,13 @@ module Slack
92
89
  #
93
90
  # @option options [Object] :name
94
91
  # Name of channel to join
92
+ # @option options [Object] :validate
93
+ # Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.
95
94
  # @see https://api.slack.com/methods/channels.join
96
95
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.join.md
97
96
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.join.json
98
97
  def channels_join(options={})
99
98
  throw ArgumentError.new("Required arguments :name missing") if options[:name].nil?
100
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
101
99
  post("channels.join", options)
102
100
  end
103
101
 
@@ -114,7 +112,6 @@ module Slack
114
112
  def channels_kick(options={})
115
113
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
116
114
  throw ArgumentError.new("Required arguments :user missing") if options[:user].nil?
117
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
118
115
  post("channels.kick", options)
119
116
  end
120
117
 
@@ -128,7 +125,6 @@ module Slack
128
125
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.leave.json
129
126
  def channels_leave(options={})
130
127
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
131
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
132
128
  post("channels.leave", options)
133
129
  end
134
130
 
@@ -141,7 +137,6 @@ module Slack
141
137
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.list.md
142
138
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.list.json
143
139
  def channels_list(options={})
144
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
145
140
  post("channels.list", options)
146
141
  end
147
142
 
@@ -158,7 +153,6 @@ module Slack
158
153
  def channels_mark(options={})
159
154
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
160
155
  throw ArgumentError.new("Required arguments :ts missing") if options[:ts].nil?
161
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
162
156
  post("channels.mark", options)
163
157
  end
164
158
 
@@ -169,13 +163,14 @@ module Slack
169
163
  # Channel to rename
170
164
  # @option options [Object] :name
171
165
  # New name for channel.
166
+ # @option options [Object] :validate
167
+ # Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.
172
168
  # @see https://api.slack.com/methods/channels.rename
173
169
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.rename.md
174
170
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.rename.json
175
171
  def channels_rename(options={})
176
172
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
177
173
  throw ArgumentError.new("Required arguments :name missing") if options[:name].nil?
178
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
179
174
  post("channels.rename", options)
180
175
  end
181
176
 
@@ -192,7 +187,6 @@ module Slack
192
187
  def channels_replies(options={})
193
188
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
194
189
  throw ArgumentError.new("Required arguments :thread_ts missing") if options[:thread_ts].nil?
195
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
196
190
  post("channels.replies", options)
197
191
  end
198
192
 
@@ -209,7 +203,6 @@ module Slack
209
203
  def channels_setPurpose(options={})
210
204
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
211
205
  throw ArgumentError.new("Required arguments :purpose missing") if options[:purpose].nil?
212
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
213
206
  post("channels.setPurpose", options)
214
207
  end
215
208
 
@@ -226,7 +219,6 @@ module Slack
226
219
  def channels_setTopic(options={})
227
220
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
228
221
  throw ArgumentError.new("Required arguments :topic missing") if options[:topic].nil?
229
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
230
222
  post("channels.setTopic", options)
231
223
  end
232
224
 
@@ -240,7 +232,6 @@ module Slack
240
232
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.unarchive.json
241
233
  def channels_unarchive(options={})
242
234
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
243
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
244
235
  post("channels.unarchive", options)
245
236
  end
246
237
 
@@ -18,7 +18,6 @@ module Slack
18
18
  def chat_delete(options={})
19
19
  throw ArgumentError.new("Required arguments :ts missing") if options[:ts].nil?
20
20
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
21
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
22
21
  post("chat.delete", options)
23
22
  end
24
23
 
@@ -35,7 +34,6 @@ module Slack
35
34
  def chat_meMessage(options={})
36
35
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
37
36
  throw ArgumentError.new("Required arguments :text missing") if options[:text].nil?
38
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
39
37
  post("chat.meMessage", options)
40
38
  end
41
39
 
@@ -73,11 +71,32 @@ module Slack
73
71
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.postMessage.json
74
72
  def chat_postMessage(options={})
75
73
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
76
- throw ArgumentError.new("Required arguments :text missing") if options[:text].nil?
77
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
74
+ throw ArgumentError.new("Required arguments :text or :attachments missing") if options[:text].nil? && options[:attachments].nil?
75
+ options[:attachments] = options[:attachments].to_json if options[:attachments].is_a?(Array) || options[:attachments].is_a?(Hash)
78
76
  post("chat.postMessage", options)
79
77
  end
80
78
 
79
+ #
80
+ # This method attaches Slack app unfurl behavior to a specified and relevant message. A user token is required as this method does not support bot user tokens.
81
+ #
82
+ # @option options [Object] :channel
83
+ # Channel ID of the message
84
+ # @option options [Object] :ts
85
+ # Timestamp of the message to add unfurl behavior to
86
+ # @option options [Object] :unfurls
87
+ # JSON mapping a set of URLs from the message to their unfurl attachments
88
+ # @option options [Object] :user_auth_required
89
+ # Set to true or 1 to indicate the user must install your Slack app to trigger unfurls for this domain
90
+ # @see https://api.slack.com/methods/chat.unfurl
91
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.unfurl.md
92
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.unfurl.json
93
+ def chat_unfurl(options={})
94
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
95
+ throw ArgumentError.new("Required arguments :ts missing") if options[:ts].nil?
96
+ throw ArgumentError.new("Required arguments :unfurls missing") if options[:unfurls].nil?
97
+ post("chat.unfurl", options)
98
+ end
99
+
81
100
  #
82
101
  # This method updates a message in a channel. Though related to chat.postMessage, some parameters of chat.update are handled differently.
83
102
  #
@@ -102,7 +121,7 @@ module Slack
102
121
  throw ArgumentError.new("Required arguments :ts missing") if options[:ts].nil?
103
122
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
104
123
  throw ArgumentError.new("Required arguments :text missing") if options[:text].nil?
105
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
124
+ options[:attachments] = options[:attachments].to_json if options[:attachments].is_a?(Array) || options[:attachments].is_a?(Hash)
106
125
  post("chat.update", options)
107
126
  end
108
127
 
@@ -13,7 +13,6 @@ module Slack
13
13
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/discovery.file.json
14
14
  def discovery_file(options={})
15
15
  throw ArgumentError.new("Required arguments :file missing") if options[:file].nil?
16
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
17
16
  post("discovery.file", options)
18
17
  end
19
18
 
@@ -10,7 +10,6 @@ module Slack
10
10
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/dnd.endDnd.md
11
11
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/dnd.endDnd.json
12
12
  def dnd_endDnd(options={})
13
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
14
13
  post("dnd.endDnd", options)
15
14
  end
16
15
 
@@ -21,7 +20,6 @@ module Slack
21
20
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/dnd.endSnooze.md
22
21
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/dnd.endSnooze.json
23
22
  def dnd_endSnooze(options={})
24
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
25
23
  post("dnd.endSnooze", options)
26
24
  end
27
25
 
@@ -34,7 +32,6 @@ module Slack
34
32
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/dnd.info.md
35
33
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/dnd.info.json
36
34
  def dnd_info(options={})
37
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
38
35
  post("dnd.info", options)
39
36
  end
40
37
 
@@ -48,7 +45,6 @@ module Slack
48
45
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/dnd.setSnooze.json
49
46
  def dnd_setSnooze(options={})
50
47
  throw ArgumentError.new("Required arguments :num_minutes missing") if options[:num_minutes].nil?
51
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
52
48
  post("dnd.setSnooze", options)
53
49
  end
54
50
 
@@ -61,7 +57,6 @@ module Slack
61
57
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/dnd.teamInfo.md
62
58
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/dnd.teamInfo.json
63
59
  def dnd_teamInfo(options={})
64
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
65
60
  post("dnd.teamInfo", options)
66
61
  end
67
62
 
@@ -10,7 +10,6 @@ module Slack
10
10
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/emoji.list.md
11
11
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/emoji.list.json
12
12
  def emoji_list(options={})
13
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
14
13
  post("emoji.list", options)
15
14
  end
16
15
 
@@ -19,7 +19,6 @@ module Slack
19
19
  throw ArgumentError.new("Required arguments :file missing") if options[:file].nil?
20
20
  throw ArgumentError.new("Required arguments :id missing") if options[:id].nil?
21
21
  throw ArgumentError.new("Required arguments :comment missing") if options[:comment].nil?
22
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
23
22
  post("files.comments", options)
24
23
  end
25
24
 
@@ -33,7 +32,6 @@ module Slack
33
32
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/files.delete.json
34
33
  def files_delete(options={})
35
34
  throw ArgumentError.new("Required arguments :file missing") if options[:file].nil?
36
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
37
35
  post("files.delete", options)
38
36
  end
39
37
 
@@ -51,7 +49,6 @@ module Slack
51
49
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/files.info.json
52
50
  def files_info(options={})
53
51
  throw ArgumentError.new("Required arguments :file missing") if options[:file].nil?
54
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
55
52
  post("files.info", options)
56
53
  end
57
54
 
@@ -88,7 +85,6 @@ module Slack
88
85
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/files.list.md
89
86
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/files.list.json
90
87
  def files_list(options={})
91
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
92
88
  post("files.list", options)
93
89
  end
94
90
 
@@ -102,7 +98,6 @@ module Slack
102
98
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/files.revokePublicURL.json
103
99
  def files_revokePublicURL(options={})
104
100
  throw ArgumentError.new("Required arguments :file missing") if options[:file].nil?
105
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
106
101
  post("files.revokePublicURL", options)
107
102
  end
108
103
 
@@ -116,7 +111,6 @@ module Slack
116
111
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/files.sharedPublicURL.json
117
112
  def files_sharedPublicURL(options={})
118
113
  throw ArgumentError.new("Required arguments :file missing") if options[:file].nil?
119
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
120
114
  post("files.sharedPublicURL", options)
121
115
  end
122
116
 
@@ -130,7 +124,6 @@ module Slack
130
124
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/files.startPartialUpload.md
131
125
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/files.startPartialUpload.json
132
126
  def files_startPartialUpload(options={})
133
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
134
127
  post("files.startPartialUpload", options)
135
128
  end
136
129
 
@@ -156,7 +149,6 @@ module Slack
156
149
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/files.upload.json
157
150
  def files_upload(options={})
158
151
  throw ArgumentError.new("Required arguments :filename missing") if options[:filename].nil?
159
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
160
152
  post("files.upload", options)
161
153
  end
162
154
 
@@ -13,7 +13,6 @@ module Slack
13
13
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/groups.archive.json
14
14
  def groups_archive(options={})
15
15
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
16
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
17
16
  post("groups.archive", options)
18
17
  end
19
18
 
@@ -27,7 +26,6 @@ module Slack
27
26
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/groups.close.json
28
27
  def groups_close(options={})
29
28
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
30
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
31
29
  post("groups.close", options)
32
30
  end
33
31
 
@@ -36,12 +34,13 @@ module Slack
36
34
  #
37
35
  # @option options [Object] :name
38
36
  # Name of private channel to create
37
+ # @option options [Object] :validate
38
+ # Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.
39
39
  # @see https://api.slack.com/methods/groups.create
40
40
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/groups.create.md
41
41
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/groups.create.json
42
42
  def groups_create(options={})
43
43
  throw ArgumentError.new("Required arguments :name missing") if options[:name].nil?
44
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
45
44
  post("groups.create", options)
46
45
  end
47
46
 
@@ -55,7 +54,6 @@ module Slack
55
54
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/groups.createChild.json
56
55
  def groups_createChild(options={})
57
56
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
58
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
59
57
  post("groups.createChild", options)
60
58
  end
61
59
 
@@ -81,7 +79,6 @@ module Slack
81
79
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/groups.history.json
82
80
  def groups_history(options={})
83
81
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
84
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
85
82
  post("groups.history", options)
86
83
  end
87
84
 
@@ -95,7 +92,6 @@ module Slack
95
92
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/groups.info.json
96
93
  def groups_info(options={})
97
94
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
98
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
99
95
  post("groups.info", options)
100
96
  end
101
97
 
@@ -112,7 +108,6 @@ module Slack
112
108
  def groups_invite(options={})
113
109
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
114
110
  throw ArgumentError.new("Required arguments :user missing") if options[:user].nil?
115
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
116
111
  post("groups.invite", options)
117
112
  end
118
113
 
@@ -129,7 +124,6 @@ module Slack
129
124
  def groups_kick(options={})
130
125
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
131
126
  throw ArgumentError.new("Required arguments :user missing") if options[:user].nil?
132
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
133
127
  post("groups.kick", options)
134
128
  end
135
129
 
@@ -143,7 +137,6 @@ module Slack
143
137
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/groups.leave.json
144
138
  def groups_leave(options={})
145
139
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
146
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
147
140
  post("groups.leave", options)
148
141
  end
149
142
 
@@ -157,7 +150,6 @@ module Slack
157
150
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/groups.list.md
158
151
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/groups.list.json
159
152
  def groups_list(options={})
160
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
161
153
  post("groups.list", options)
162
154
  end
163
155
 
@@ -174,7 +166,6 @@ module Slack
174
166
  def groups_mark(options={})
175
167
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
176
168
  throw ArgumentError.new("Required arguments :ts missing") if options[:ts].nil?
177
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
178
169
  post("groups.mark", options)
179
170
  end
180
171
 
@@ -188,7 +179,6 @@ module Slack
188
179
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/groups.open.json
189
180
  def groups_open(options={})
190
181
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
191
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
192
182
  post("groups.open", options)
193
183
  end
194
184
 
@@ -199,13 +189,14 @@ module Slack
199
189
  # Private channel to rename
200
190
  # @option options [Object] :name
201
191
  # New name for private channel.
192
+ # @option options [Object] :validate
193
+ # Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.
202
194
  # @see https://api.slack.com/methods/groups.rename
203
195
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/groups.rename.md
204
196
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/groups.rename.json
205
197
  def groups_rename(options={})
206
198
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
207
199
  throw ArgumentError.new("Required arguments :name missing") if options[:name].nil?
208
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
209
200
  post("groups.rename", options)
210
201
  end
211
202
 
@@ -222,7 +213,6 @@ module Slack
222
213
  def groups_replies(options={})
223
214
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
224
215
  throw ArgumentError.new("Required arguments :thread_ts missing") if options[:thread_ts].nil?
225
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
226
216
  post("groups.replies", options)
227
217
  end
228
218
 
@@ -239,7 +229,6 @@ module Slack
239
229
  def groups_setPurpose(options={})
240
230
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
241
231
  throw ArgumentError.new("Required arguments :purpose missing") if options[:purpose].nil?
242
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
243
232
  post("groups.setPurpose", options)
244
233
  end
245
234
 
@@ -256,7 +245,6 @@ module Slack
256
245
  def groups_setTopic(options={})
257
246
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
258
247
  throw ArgumentError.new("Required arguments :topic missing") if options[:topic].nil?
259
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
260
248
  post("groups.setTopic", options)
261
249
  end
262
250
 
@@ -270,7 +258,6 @@ module Slack
270
258
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/groups.unarchive.json
271
259
  def groups_unarchive(options={})
272
260
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
273
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
274
261
  post("groups.unarchive", options)
275
262
  end
276
263
 
@@ -12,7 +12,6 @@ module Slack
12
12
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/idpgroups.list.md
13
13
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/idpgroups.list.json
14
14
  def idpgroups_list(options={})
15
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
16
15
  post("idpgroups.list", options)
17
16
  end
18
17
 
@@ -13,7 +13,6 @@ module Slack
13
13
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/im.close.json
14
14
  def im_close(options={})
15
15
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
16
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
17
16
  post("im.close", options)
18
17
  end
19
18
 
@@ -39,7 +38,6 @@ module Slack
39
38
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/im.history.json
40
39
  def im_history(options={})
41
40
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
42
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
43
41
  post("im.history", options)
44
42
  end
45
43
 
@@ -50,7 +48,6 @@ module Slack
50
48
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/im.list.md
51
49
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/im.list.json
52
50
  def im_list(options={})
53
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
54
51
  post("im.list", options)
55
52
  end
56
53
 
@@ -67,7 +64,6 @@ module Slack
67
64
  def im_mark(options={})
68
65
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
69
66
  throw ArgumentError.new("Required arguments :ts missing") if options[:ts].nil?
70
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
71
67
  post("im.mark", options)
72
68
  end
73
69
 
@@ -83,7 +79,6 @@ module Slack
83
79
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/im.open.json
84
80
  def im_open(options={})
85
81
  throw ArgumentError.new("Required arguments :user missing") if options[:user].nil?
86
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
87
82
  post("im.open", options)
88
83
  end
89
84
 
@@ -100,7 +95,6 @@ module Slack
100
95
  def im_replies(options={})
101
96
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
102
97
  throw ArgumentError.new("Required arguments :thread_ts missing") if options[:thread_ts].nil?
103
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
104
98
  post("im.replies", options)
105
99
  end
106
100
 
@@ -13,7 +13,6 @@ module Slack
13
13
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/mpim.close.json
14
14
  def mpim_close(options={})
15
15
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
16
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
17
16
  post("mpim.close", options)
18
17
  end
19
18
 
@@ -39,7 +38,6 @@ module Slack
39
38
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/mpim.history.json
40
39
  def mpim_history(options={})
41
40
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
42
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
43
41
  post("mpim.history", options)
44
42
  end
45
43
 
@@ -50,7 +48,6 @@ module Slack
50
48
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/mpim.list.md
51
49
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/mpim.list.json
52
50
  def mpim_list(options={})
53
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
54
51
  post("mpim.list", options)
55
52
  end
56
53
 
@@ -67,7 +64,6 @@ module Slack
67
64
  def mpim_mark(options={})
68
65
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
69
66
  throw ArgumentError.new("Required arguments :ts missing") if options[:ts].nil?
70
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
71
67
  post("mpim.mark", options)
72
68
  end
73
69
 
@@ -81,7 +77,6 @@ module Slack
81
77
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/mpim.open.json
82
78
  def mpim_open(options={})
83
79
  throw ArgumentError.new("Required arguments :users missing") if options[:users].nil?
84
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
85
80
  post("mpim.open", options)
86
81
  end
87
82
 
@@ -98,7 +93,6 @@ module Slack
98
93
  def mpim_replies(options={})
99
94
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
100
95
  throw ArgumentError.new("Required arguments :thread_ts missing") if options[:thread_ts].nil?
101
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
102
96
  post("mpim.replies", options)
103
97
  end
104
98
 
@@ -22,7 +22,6 @@ module Slack
22
22
  throw ArgumentError.new("Required arguments :client_id missing") if options[:client_id].nil?
23
23
  throw ArgumentError.new("Required arguments :client_secret missing") if options[:client_secret].nil?
24
24
  throw ArgumentError.new("Required arguments :code missing") if options[:code].nil?
25
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
26
25
  post("oauth.access", options)
27
26
  end
28
27
 
@@ -20,7 +20,6 @@ module Slack
20
20
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/pins.add.json
21
21
  def pins_add(options={})
22
22
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
23
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
24
23
  post("pins.add", options)
25
24
  end
26
25
 
@@ -34,7 +33,6 @@ module Slack
34
33
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/pins.list.json
35
34
  def pins_list(options={})
36
35
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
37
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
38
36
  post("pins.list", options)
39
37
  end
40
38
 
@@ -55,7 +53,6 @@ module Slack
55
53
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/pins.remove.json
56
54
  def pins_remove(options={})
57
55
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
58
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
59
56
  post("pins.remove", options)
60
57
  end
61
58
 
@@ -13,7 +13,6 @@ module Slack
13
13
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/presence.set.json
14
14
  def presence_set(options={})
15
15
  throw ArgumentError.new("Required arguments :presence missing") if options[:presence].nil?
16
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
17
16
  post("presence.set", options)
18
17
  end
19
18
 
@@ -22,7 +22,6 @@ module Slack
22
22
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/reactions.add.json
23
23
  def reactions_add(options={})
24
24
  throw ArgumentError.new("Required arguments :name missing") if options[:name].nil?
25
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
26
25
  post("reactions.add", options)
27
26
  end
28
27
 
@@ -43,7 +42,6 @@ module Slack
43
42
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/reactions.get.md
44
43
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/reactions.get.json
45
44
  def reactions_get(options={})
46
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
47
45
  post("reactions.get", options)
48
46
  end
49
47
 
@@ -62,7 +60,6 @@ module Slack
62
60
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/reactions.list.md
63
61
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/reactions.list.json
64
62
  def reactions_list(options={})
65
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
66
63
  post("reactions.list", options)
67
64
  end
68
65
 
@@ -85,7 +82,6 @@ module Slack
85
82
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/reactions.remove.json
86
83
  def reactions_remove(options={})
87
84
  throw ArgumentError.new("Required arguments :name missing") if options[:name].nil?
88
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
89
85
  post("reactions.remove", options)
90
86
  end
91
87
 
@@ -18,7 +18,6 @@ module Slack
18
18
  def reminders_add(options={})
19
19
  throw ArgumentError.new("Required arguments :text missing") if options[:text].nil?
20
20
  throw ArgumentError.new("Required arguments :time missing") if options[:time].nil?
21
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
22
21
  post("reminders.add", options)
23
22
  end
24
23
 
@@ -32,7 +31,6 @@ module Slack
32
31
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/reminders.complete.json
33
32
  def reminders_complete(options={})
34
33
  throw ArgumentError.new("Required arguments :reminder missing") if options[:reminder].nil?
35
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
36
34
  post("reminders.complete", options)
37
35
  end
38
36
 
@@ -46,7 +44,6 @@ module Slack
46
44
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/reminders.delete.json
47
45
  def reminders_delete(options={})
48
46
  throw ArgumentError.new("Required arguments :reminder missing") if options[:reminder].nil?
49
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
50
47
  post("reminders.delete", options)
51
48
  end
52
49
 
@@ -60,7 +57,6 @@ module Slack
60
57
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/reminders.info.json
61
58
  def reminders_info(options={})
62
59
  throw ArgumentError.new("Required arguments :reminder missing") if options[:reminder].nil?
63
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
64
60
  post("reminders.info", options)
65
61
  end
66
62
 
@@ -71,7 +67,6 @@ module Slack
71
67
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/reminders.list.md
72
68
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/reminders.list.json
73
69
  def reminders_list(options={})
74
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
75
70
  post("reminders.list", options)
76
71
  end
77
72
 
@@ -23,7 +23,6 @@ module Slack
23
23
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/search.all.json
24
24
  def search_all(options={})
25
25
  throw ArgumentError.new("Required arguments :query missing") if options[:query].nil?
26
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
27
26
  post("search.all", options)
28
27
  end
29
28
 
@@ -47,7 +46,6 @@ module Slack
47
46
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/search.files.json
48
47
  def search_files(options={})
49
48
  throw ArgumentError.new("Required arguments :query missing") if options[:query].nil?
50
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
51
49
  post("search.files", options)
52
50
  end
53
51
 
@@ -71,7 +69,6 @@ module Slack
71
69
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/search.messages.json
72
70
  def search_messages(options={})
73
71
  throw ArgumentError.new("Required arguments :query missing") if options[:query].nil?
74
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
75
72
  post("search.messages", options)
76
73
  end
77
74
 
@@ -19,7 +19,6 @@ module Slack
19
19
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/stars.add.md
20
20
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/stars.add.json
21
21
  def stars_add(options={})
22
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
23
22
  post("stars.add", options)
24
23
  end
25
24
 
@@ -34,7 +33,6 @@ module Slack
34
33
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/stars.list.md
35
34
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/stars.list.json
36
35
  def stars_list(options={})
37
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
38
36
  post("stars.list", options)
39
37
  end
40
38
 
@@ -54,7 +52,6 @@ module Slack
54
52
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/stars.remove.md
55
53
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/stars.remove.json
56
54
  def stars_remove(options={})
57
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
58
55
  post("stars.remove", options)
59
56
  end
60
57
 
@@ -16,7 +16,6 @@ module Slack
16
16
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/team.accessLogs.md
17
17
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/team.accessLogs.json
18
18
  def team_accessLogs(options={})
19
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
20
19
  post("team.accessLogs", options)
21
20
  end
22
21
 
@@ -30,7 +29,6 @@ module Slack
30
29
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/team.billableInfo.md
31
30
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/team.billableInfo.json
32
31
  def team_billableInfo(options={})
33
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
34
32
  post("team.billableInfo", options)
35
33
  end
36
34
 
@@ -41,7 +39,6 @@ module Slack
41
39
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/team.info.md
42
40
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/team.info.json
43
41
  def team_info(options={})
44
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
45
42
  post("team.info", options)
46
43
  end
47
44
 
@@ -64,7 +61,6 @@ module Slack
64
61
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/team.integrationLogs.md
65
62
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/team.integrationLogs.json
66
63
  def team_integrationLogs(options={})
67
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
68
64
  post("team.integrationLogs", options)
69
65
  end
70
66
 
@@ -77,7 +73,6 @@ module Slack
77
73
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/team.profile.md
78
74
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/team.profile.json
79
75
  def team_profile(options={})
80
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
81
76
  post("team.profile", options)
82
77
  end
83
78
 
@@ -21,7 +21,6 @@ module Slack
21
21
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/usergroups.create.json
22
22
  def usergroups_create(options={})
23
23
  throw ArgumentError.new("Required arguments :name missing") if options[:name].nil?
24
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
25
24
  post("usergroups.create", options)
26
25
  end
27
26
 
@@ -37,7 +36,6 @@ module Slack
37
36
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/usergroups.disable.json
38
37
  def usergroups_disable(options={})
39
38
  throw ArgumentError.new("Required arguments :usergroup missing") if options[:usergroup].nil?
40
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
41
39
  post("usergroups.disable", options)
42
40
  end
43
41
 
@@ -53,7 +51,6 @@ module Slack
53
51
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/usergroups.enable.json
54
52
  def usergroups_enable(options={})
55
53
  throw ArgumentError.new("Required arguments :usergroup missing") if options[:usergroup].nil?
56
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
57
54
  post("usergroups.enable", options)
58
55
  end
59
56
 
@@ -70,7 +67,6 @@ module Slack
70
67
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/usergroups.list.md
71
68
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/usergroups.list.json
72
69
  def usergroups_list(options={})
73
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
74
70
  post("usergroups.list", options)
75
71
  end
76
72
 
@@ -94,7 +90,6 @@ module Slack
94
90
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/usergroups.update.json
95
91
  def usergroups_update(options={})
96
92
  throw ArgumentError.new("Required arguments :usergroup missing") if options[:usergroup].nil?
97
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
98
93
  post("usergroups.update", options)
99
94
  end
100
95
 
@@ -113,7 +108,6 @@ module Slack
113
108
  def usergroups_users(options={})
114
109
  throw ArgumentError.new("Required arguments :usergroup missing") if options[:usergroup].nil?
115
110
  throw ArgumentError.new("Required arguments :users missing") if options[:users].nil?
116
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
117
111
  post("usergroups.users", options)
118
112
  end
119
113
 
@@ -10,7 +10,6 @@ module Slack
10
10
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.deletePhoto.md
11
11
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.deletePhoto.json
12
12
  def users_deletePhoto(options={})
13
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
14
13
  post("users.deletePhoto", options)
15
14
  end
16
15
 
@@ -25,7 +24,6 @@ module Slack
25
24
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.getPresence.json
26
25
  def users_getPresence(options={})
27
26
  throw ArgumentError.new("Required arguments :user missing") if options[:user].nil?
28
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
29
27
  post("users.getPresence", options)
30
28
  end
31
29
 
@@ -36,7 +34,6 @@ module Slack
36
34
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.identity.md
37
35
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.identity.json
38
36
  def users_identity(options={})
39
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
40
37
  post("users.identity", options)
41
38
  end
42
39
 
@@ -50,7 +47,6 @@ module Slack
50
47
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.info.json
51
48
  def users_info(options={})
52
49
  throw ArgumentError.new("Required arguments :user missing") if options[:user].nil?
53
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
54
50
  post("users.info", options)
55
51
  end
56
52
 
@@ -63,7 +59,6 @@ module Slack
63
59
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.list.md
64
60
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.list.json
65
61
  def users_list(options={})
66
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
67
62
  post("users.list", options)
68
63
  end
69
64
 
@@ -82,7 +77,6 @@ module Slack
82
77
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.profile.md
83
78
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.profile.json
84
79
  def users_profile(options={})
85
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
86
80
  post("users.profile", options)
87
81
  end
88
82
 
@@ -95,7 +89,6 @@ module Slack
95
89
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.setActive.md
96
90
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.setActive.json
97
91
  def users_setActive(options={})
98
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
99
92
  post("users.setActive", options)
100
93
  end
101
94
 
@@ -115,7 +108,6 @@ module Slack
115
108
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.setPhoto.json
116
109
  def users_setPhoto(options={})
117
110
  throw ArgumentError.new("Required arguments :image missing") if options[:image].nil?
118
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
119
111
  post("users.setPhoto", options)
120
112
  end
121
113
 
@@ -130,7 +122,6 @@ module Slack
130
122
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.setPresence.json
131
123
  def users_setPresence(options={})
132
124
  throw ArgumentError.new("Required arguments :presence missing") if options[:presence].nil?
133
- options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
134
125
  post("users.setPresence", options)
135
126
  end
136
127
 
@@ -4,8 +4,9 @@ require 'eventmachine'
4
4
  module Slack
5
5
  module RealTime
6
6
  class Client
7
- def initialize(url)
8
- @url = url
7
+ def initialize(rtm_start_response)
8
+ @response = rtm_start_response
9
+ @url = rtm_start_response["url"]
9
10
  @callbacks ||= {}
10
11
  end
11
12
 
@@ -36,6 +37,16 @@ module Slack
36
37
  end
37
38
  end
38
39
  end
40
+
41
+ def method_missing(method, *args, &block)
42
+ return super if @response[method.to_s].nil?
43
+ @response[method.to_s]
44
+ end
45
+
46
+ # Delegate to Slack::Client
47
+ def respond_to?(method, include_all=false)
48
+ return !@response[method.to_s].nil? || super
49
+ end
39
50
  end
40
51
  end
41
52
  end
@@ -1,3 +1,3 @@
1
1
  module Slack
2
- VERSION = "1.4.0"
2
+ VERSION = "1.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - aki017
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-16 00:00:00.000000000 Z
11
+ date: 2017-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -342,7 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
342
342
  version: '0'
343
343
  requirements: []
344
344
  rubyforge_project:
345
- rubygems_version: 2.6.9
345
+ rubygems_version: 2.5.1
346
346
  signing_key:
347
347
  specification_version: 4
348
348
  summary: A Ruby wrapper for the Slack API