slack-api 1.2.4 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +18 -3
- data/examples/basic.rb +1 -1
- data/lib/slack/endpoint.rb +4 -0
- data/lib/slack/endpoint/channels.rb +17 -0
- data/lib/slack/endpoint/chat.rb +5 -1
- data/lib/slack/endpoint/discovery.rb +22 -0
- data/lib/slack/endpoint/groups.rb +17 -0
- data/lib/slack/endpoint/idpgroups.rb +21 -0
- data/lib/slack/endpoint/im.rb +17 -0
- data/lib/slack/endpoint/mpim.rb +17 -0
- data/lib/slack/endpoint/team.rb +2 -0
- data/lib/slack/endpoint/users.rb +32 -1
- data/lib/slack/version.rb +1 -1
- data/slack.gemspec +2 -2
- metadata +13 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d383afb0c1abcd350b4579ea8fd3d7e78efd950f
|
4
|
+
data.tar.gz: 70c96fa892c7bf9b13ecd29ec48cf91950a0037b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15a71f2251cbbea3ed9930a6304edf59e4c1c32ec66b8860c73e8d39ba564a86a03ba8cd42e2df7ac10ca8288d8696e0b61e6a516ab82f392492d9aa47e5445e
|
7
|
+
data.tar.gz: 740ecdbddba7332c5276a76ebb887a50ba7821107c842a36f4f1a75f4266edc170d2f4576371943f26130cefa0df6ffd0ab1d4ff3d827db329317a84854d1174
|
data/.travis.yml
CHANGED
@@ -1,11 +1,26 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
1
3
|
rvm:
|
2
4
|
- 2.1.10
|
3
|
-
- 2.2.
|
4
|
-
- 2.3.
|
5
|
-
-
|
5
|
+
- 2.2.6
|
6
|
+
- 2.3.3
|
7
|
+
- 2.4.0
|
8
|
+
- ruby-head
|
9
|
+
- jruby-9.1.7.0
|
10
|
+
- jruby-head
|
6
11
|
|
12
|
+
matrix:
|
13
|
+
allow_failures:
|
14
|
+
- rvm: ruby-head
|
15
|
+
- rvm: jruby-9.1.7.0
|
16
|
+
- rvm: jruby-head
|
7
17
|
git:
|
8
18
|
submodules: false
|
9
19
|
|
10
20
|
before_install:
|
21
|
+
- gem update --system
|
11
22
|
- gem update bundler
|
23
|
+
|
24
|
+
cache: bundler
|
25
|
+
|
26
|
+
sudo: false
|
data/examples/basic.rb
CHANGED
@@ -22,7 +22,7 @@ puts
|
|
22
22
|
channels.each do |c|
|
23
23
|
puts "- id: #{c["id"]}, name: #{c["name"]}"
|
24
24
|
|
25
|
-
# Get channel
|
25
|
+
# Get channel history
|
26
26
|
messages = client.channels_history(channel: "#{c["id"]}")["messages"]
|
27
27
|
messages.each do |message|
|
28
28
|
user_name = users[message["user"]]
|
data/lib/slack/endpoint.rb
CHANGED
@@ -5,10 +5,12 @@ require_relative 'endpoint/auth'
|
|
5
5
|
require_relative 'endpoint/bots'
|
6
6
|
require_relative 'endpoint/channels'
|
7
7
|
require_relative 'endpoint/chat'
|
8
|
+
require_relative 'endpoint/discovery'
|
8
9
|
require_relative 'endpoint/dnd'
|
9
10
|
require_relative 'endpoint/emoji'
|
10
11
|
require_relative 'endpoint/files'
|
11
12
|
require_relative 'endpoint/groups'
|
13
|
+
require_relative 'endpoint/idpgroups'
|
12
14
|
require_relative 'endpoint/im'
|
13
15
|
require_relative 'endpoint/mpim'
|
14
16
|
require_relative 'endpoint/oauth'
|
@@ -29,10 +31,12 @@ module Slack
|
|
29
31
|
include Bots
|
30
32
|
include Channels
|
31
33
|
include Chat
|
34
|
+
include Discovery
|
32
35
|
include Dnd
|
33
36
|
include Emoji
|
34
37
|
include Files
|
35
38
|
include Groups
|
39
|
+
include Idpgroups
|
36
40
|
include Im
|
37
41
|
include Mpim
|
38
42
|
include Oauth
|
@@ -179,6 +179,23 @@ module Slack
|
|
179
179
|
post("channels.rename", options)
|
180
180
|
end
|
181
181
|
|
182
|
+
#
|
183
|
+
# This method returns an entire thread (a message plus all the messages in reply to it).
|
184
|
+
#
|
185
|
+
# @option options [Object] :channel
|
186
|
+
# Channel to fetch thread from
|
187
|
+
# @option options [Object] :thread_ts
|
188
|
+
# Unique identifier of a thread's parent message
|
189
|
+
# @see https://api.slack.com/methods/channels.replies
|
190
|
+
# @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.replies.md
|
191
|
+
# @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.replies.json
|
192
|
+
def channels_replies(options={})
|
193
|
+
throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
|
194
|
+
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
|
+
post("channels.replies", options)
|
197
|
+
end
|
198
|
+
|
182
199
|
#
|
183
200
|
# This method is used to change the purpose of a channel. The calling user must be a member of the channel.
|
184
201
|
#
|
data/lib/slack/endpoint/chat.rb
CHANGED
@@ -63,7 +63,11 @@ module Slack
|
|
63
63
|
# @option options [Object] :icon_url
|
64
64
|
# URL to an image to use as the icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
|
65
65
|
# @option options [Object] :icon_emoji
|
66
|
-
#
|
66
|
+
# Emoji to use as the icon for this message. Overrides icon_url. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
|
67
|
+
# @option options [Object] :thread_ts
|
68
|
+
# Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead.
|
69
|
+
# @option options [Object] :reply_broadcast
|
70
|
+
# Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.
|
67
71
|
# @see https://api.slack.com/methods/chat.postMessage
|
68
72
|
# @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.postMessage.md
|
69
73
|
# @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.postMessage.json
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# This file was auto-generated by lib/generators/tasks/generate.rb
|
2
|
+
|
3
|
+
module Slack
|
4
|
+
module Endpoint
|
5
|
+
module Discovery
|
6
|
+
#
|
7
|
+
# There is no documentation for this method.
|
8
|
+
#
|
9
|
+
# @option options [Object] :file
|
10
|
+
# Specify a file by providing its ID.
|
11
|
+
# @see https://api.slack.com/methods/discovery.file
|
12
|
+
# @see https://github.com/aki017/slack-api-docs/blob/master/methods/discovery.file.md
|
13
|
+
# @see https://github.com/aki017/slack-api-docs/blob/master/methods/discovery.file.json
|
14
|
+
def discovery_file(options={})
|
15
|
+
throw ArgumentError.new("Required arguments :file missing") if options[:file].nil?
|
16
|
+
options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
|
17
|
+
post("discovery.file", options)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -209,6 +209,23 @@ module Slack
|
|
209
209
|
post("groups.rename", options)
|
210
210
|
end
|
211
211
|
|
212
|
+
#
|
213
|
+
# This method returns an entire thread (a message plus all the messages in reply to it).
|
214
|
+
#
|
215
|
+
# @option options [Object] :channel
|
216
|
+
# Private channel to fetch thread from
|
217
|
+
# @option options [Object] :thread_ts
|
218
|
+
# Unique identifier of a thread's parent message
|
219
|
+
# @see https://api.slack.com/methods/groups.replies
|
220
|
+
# @see https://github.com/aki017/slack-api-docs/blob/master/methods/groups.replies.md
|
221
|
+
# @see https://github.com/aki017/slack-api-docs/blob/master/methods/groups.replies.json
|
222
|
+
def groups_replies(options={})
|
223
|
+
throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
|
224
|
+
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
|
+
post("groups.replies", options)
|
227
|
+
end
|
228
|
+
|
212
229
|
#
|
213
230
|
# This method is used to change the purpose of a private channel. The calling user must be a member of the private channel.
|
214
231
|
#
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# This file was auto-generated by lib/generators/tasks/generate.rb
|
2
|
+
|
3
|
+
module Slack
|
4
|
+
module Endpoint
|
5
|
+
module Idpgroups
|
6
|
+
#
|
7
|
+
# There is no documentation for this method.
|
8
|
+
#
|
9
|
+
# @option options [Object] :include_users
|
10
|
+
# Include the list of users for each IDP Group.
|
11
|
+
# @see https://api.slack.com/methods/idpgroups.list
|
12
|
+
# @see https://github.com/aki017/slack-api-docs/blob/master/methods/idpgroups.list.md
|
13
|
+
# @see https://github.com/aki017/slack-api-docs/blob/master/methods/idpgroups.list.json
|
14
|
+
def idpgroups_list(options={})
|
15
|
+
options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
|
16
|
+
post("idpgroups.list", options)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/slack/endpoint/im.rb
CHANGED
@@ -87,6 +87,23 @@ module Slack
|
|
87
87
|
post("im.open", options)
|
88
88
|
end
|
89
89
|
|
90
|
+
#
|
91
|
+
# This method returns an entire thread (a message plus all the messages in reply to it).
|
92
|
+
#
|
93
|
+
# @option options [Object] :channel
|
94
|
+
# Direct message channel to fetch thread from
|
95
|
+
# @option options [Object] :thread_ts
|
96
|
+
# Unique identifier of a thread's parent message
|
97
|
+
# @see https://api.slack.com/methods/im.replies
|
98
|
+
# @see https://github.com/aki017/slack-api-docs/blob/master/methods/im.replies.md
|
99
|
+
# @see https://github.com/aki017/slack-api-docs/blob/master/methods/im.replies.json
|
100
|
+
def im_replies(options={})
|
101
|
+
throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
|
102
|
+
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
|
+
post("im.replies", options)
|
105
|
+
end
|
106
|
+
|
90
107
|
end
|
91
108
|
end
|
92
109
|
end
|
data/lib/slack/endpoint/mpim.rb
CHANGED
@@ -85,6 +85,23 @@ module Slack
|
|
85
85
|
post("mpim.open", options)
|
86
86
|
end
|
87
87
|
|
88
|
+
#
|
89
|
+
# This method returns an entire thread (a message plus all the messages in reply to it).
|
90
|
+
#
|
91
|
+
# @option options [Object] :channel
|
92
|
+
# Multiparty direct message channel to fetch thread from.
|
93
|
+
# @option options [Object] :thread_ts
|
94
|
+
# Unique identifier of a thread's parent message.
|
95
|
+
# @see https://api.slack.com/methods/mpim.replies
|
96
|
+
# @see https://github.com/aki017/slack-api-docs/blob/master/methods/mpim.replies.md
|
97
|
+
# @see https://github.com/aki017/slack-api-docs/blob/master/methods/mpim.replies.json
|
98
|
+
def mpim_replies(options={})
|
99
|
+
throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
|
100
|
+
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
|
+
post("mpim.replies", options)
|
103
|
+
end
|
104
|
+
|
88
105
|
end
|
89
106
|
end
|
90
107
|
end
|
data/lib/slack/endpoint/team.rb
CHANGED
@@ -10,6 +10,8 @@ module Slack
|
|
10
10
|
# Number of items to return per page.
|
11
11
|
# @option options [Object] :page
|
12
12
|
# Page number of results to return.
|
13
|
+
# @option options [Object] :before
|
14
|
+
# End of time range of logs to include in results (inclusive).
|
13
15
|
# @see https://api.slack.com/methods/team.accessLogs
|
14
16
|
# @see https://github.com/aki017/slack-api-docs/blob/master/methods/team.accessLogs.md
|
15
17
|
# @see https://github.com/aki017/slack-api-docs/blob/master/methods/team.accessLogs.json
|
data/lib/slack/endpoint/users.rb
CHANGED
@@ -3,6 +3,17 @@
|
|
3
3
|
module Slack
|
4
4
|
module Endpoint
|
5
5
|
module Users
|
6
|
+
#
|
7
|
+
# This method allows the user to delete their profile image. It will clear whatever image is currently set.
|
8
|
+
#
|
9
|
+
# @see https://api.slack.com/methods/users.deletePhoto
|
10
|
+
# @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.deletePhoto.md
|
11
|
+
# @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.deletePhoto.json
|
12
|
+
def users_deletePhoto(options={})
|
13
|
+
options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
|
14
|
+
post("users.deletePhoto", options)
|
15
|
+
end
|
16
|
+
|
6
17
|
#
|
7
18
|
# This method lets you find out information about a user's presence.
|
8
19
|
# Consult the presence documentation for more details.
|
@@ -60,7 +71,7 @@ module Slack
|
|
60
71
|
# This method is used to set the profile information for a user.
|
61
72
|
#
|
62
73
|
# @option options [Object] :user
|
63
|
-
# ID of user to change. This argument may only be specified by team admins.
|
74
|
+
# ID of user to change. This argument may only be specified by team admins on paid teams.
|
64
75
|
# @option options [Object] :profile
|
65
76
|
# Collection of key:value pairs presented as a URL-encoded JSON hash.
|
66
77
|
# @option options [Object] :name
|
@@ -88,6 +99,26 @@ module Slack
|
|
88
99
|
post("users.setActive", options)
|
89
100
|
end
|
90
101
|
|
102
|
+
#
|
103
|
+
# This method allows the user to set their profile image. The caller can pass image data via image.
|
104
|
+
#
|
105
|
+
# @option options [Object] :image
|
106
|
+
# File contents via multipart/form-data.
|
107
|
+
# @option options [Object] :crop_x
|
108
|
+
# X coordinate of top-left corner of crop box
|
109
|
+
# @option options [Object] :crop_y
|
110
|
+
# Y coordinate of top-left corner of crop box
|
111
|
+
# @option options [Object] :crop_w
|
112
|
+
# Width/height of crop box (always square)
|
113
|
+
# @see https://api.slack.com/methods/users.setPhoto
|
114
|
+
# @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.setPhoto.md
|
115
|
+
# @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.setPhoto.json
|
116
|
+
def users_setPhoto(options={})
|
117
|
+
throw ArgumentError.new("Required arguments :image missing") if options[:image].nil?
|
118
|
+
options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
|
119
|
+
post("users.setPhoto", options)
|
120
|
+
end
|
121
|
+
|
91
122
|
#
|
92
123
|
# This method lets you set the calling user's manual presence.
|
93
124
|
# Consult the presence documentation for more details.
|
data/lib/slack/version.rb
CHANGED
data/slack.gemspec
CHANGED
@@ -31,8 +31,8 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_development_dependency "json-schema"
|
32
32
|
spec.add_development_dependency "pry"
|
33
33
|
|
34
|
-
spec.add_runtime_dependency "faraday",
|
35
|
-
spec.add_runtime_dependency "faraday_middleware", "
|
34
|
+
spec.add_runtime_dependency "faraday", "~> 0.11"
|
35
|
+
spec.add_runtime_dependency "faraday_middleware", "0.10.1"
|
36
36
|
spec.add_runtime_dependency "multi_json", ">= 1.0.3", "~> 1.0"
|
37
37
|
spec.add_runtime_dependency "faye-websocket", "~> 0.9.2"
|
38
38
|
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
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aki017
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -182,36 +182,30 @@ dependencies:
|
|
182
182
|
name: faraday
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- - "
|
186
|
-
- !ruby/object:Gem::Version
|
187
|
-
version: '0.7'
|
188
|
-
- - "<"
|
185
|
+
- - "~>"
|
189
186
|
- !ruby/object:Gem::Version
|
190
|
-
version: '0.
|
187
|
+
version: '0.11'
|
191
188
|
type: :runtime
|
192
189
|
prerelease: false
|
193
190
|
version_requirements: !ruby/object:Gem::Requirement
|
194
191
|
requirements:
|
195
|
-
- - "
|
196
|
-
- !ruby/object:Gem::Version
|
197
|
-
version: '0.7'
|
198
|
-
- - "<"
|
192
|
+
- - "~>"
|
199
193
|
- !ruby/object:Gem::Version
|
200
|
-
version: '0.
|
194
|
+
version: '0.11'
|
201
195
|
- !ruby/object:Gem::Dependency
|
202
196
|
name: faraday_middleware
|
203
197
|
requirement: !ruby/object:Gem::Requirement
|
204
198
|
requirements:
|
205
|
-
- -
|
199
|
+
- - '='
|
206
200
|
- !ruby/object:Gem::Version
|
207
|
-
version:
|
201
|
+
version: 0.10.1
|
208
202
|
type: :runtime
|
209
203
|
prerelease: false
|
210
204
|
version_requirements: !ruby/object:Gem::Requirement
|
211
205
|
requirements:
|
212
|
-
- -
|
206
|
+
- - '='
|
213
207
|
- !ruby/object:Gem::Version
|
214
|
-
version:
|
208
|
+
version: 0.10.1
|
215
209
|
- !ruby/object:Gem::Dependency
|
216
210
|
name: multi_json
|
217
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -280,10 +274,12 @@ files:
|
|
280
274
|
- lib/slack/endpoint/bots.rb
|
281
275
|
- lib/slack/endpoint/channels.rb
|
282
276
|
- lib/slack/endpoint/chat.rb
|
277
|
+
- lib/slack/endpoint/discovery.rb
|
283
278
|
- lib/slack/endpoint/dnd.rb
|
284
279
|
- lib/slack/endpoint/emoji.rb
|
285
280
|
- lib/slack/endpoint/files.rb
|
286
281
|
- lib/slack/endpoint/groups.rb
|
282
|
+
- lib/slack/endpoint/idpgroups.rb
|
287
283
|
- lib/slack/endpoint/im.rb
|
288
284
|
- lib/slack/endpoint/mpim.rb
|
289
285
|
- lib/slack/endpoint/oauth.rb
|
@@ -345,7 +341,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
345
341
|
version: '0'
|
346
342
|
requirements: []
|
347
343
|
rubyforge_project:
|
348
|
-
rubygems_version: 2.
|
344
|
+
rubygems_version: 2.6.9
|
349
345
|
signing_key:
|
350
346
|
specification_version: 4
|
351
347
|
summary: A Ruby wrapper for the Slack API
|