slack-ruby-client 0.7.9 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +28 -3
- data/UPGRADING.md +22 -0
- data/bin/commands/channels.rb +3 -0
- data/bin/commands/files_comments.rb +0 -1
- data/bin/commands/groups.rb +2 -0
- data/bin/commands/search.rb +3 -3
- data/lib/slack/real_time/concurrency/celluloid.rb +1 -1
- data/lib/slack/real_time/config.rb +1 -1
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints/channels.rb +6 -0
- data/lib/slack/web/api/endpoints/files_comments.rb +0 -3
- data/lib/slack/web/api/endpoints/groups.rb +4 -0
- data/lib/slack/web/api/endpoints/search.rb +3 -3
- data/lib/slack/web/config.rb +5 -1
- data/lib/slack/web/faraday/connection.rb +5 -0
- data/lib/slack/web/faraday/request.rb +1 -0
- data/spec/slack/real_time/client_spec.rb +1 -1
- data/spec/slack/web/client_spec.rb +40 -0
- data/spec/support/vcr.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c6d144362dda5a6aeaa3beeb8ec0e1885061898
|
4
|
+
data.tar.gz: e6d9ec22b44554a6f5d89fdbcc794effcef152a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f5e30d233a1cd645a672715856bbf3300533e473c1c51f6b3181def7ee6614dfc3ea46f3dcf721614a78f1a6c4720c852f934a0ace4462f07dd20dae1ddebb8
|
7
|
+
data.tar.gz: bbf97b47897ba11828defcba59189fb84a9824b3f8e39556b42d0c6da9313c85f89dad822fc6fb329a4a59efe4ce850fe11f69b8a60ba5a00a180a8d7f770d59
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
### 0.8.0 (3/12/2017)
|
2
|
+
|
3
|
+
* [#135](https://github.com/slack-ruby/slack-ruby-client/issues/135): Added `timeout` and `open_timeout` options to Web API - [@dblock](https://github.com/dblock).
|
4
|
+
* [#134](https://github.com/slack-ruby/slack-ruby-client/issues/134): Set `start_options[:request][:timeout]`, used with `rtm.start` in `Slack::RealTime::Client`, to 180 seconds - [@dblock](https://github.com/dblock).
|
5
|
+
* [#136](https://github.com/slack-ruby/slack-ruby-client/pull/136): Pass request options in web client calls - [@dblock](https://github.com/dblock).
|
6
|
+
* [#121](https://github.com/slack-ruby/slack-ruby-client/pull/121): Fix: check that the current Celluloid actor is running before calling `terminate` - [@newdark](https://github.com/newdark).
|
7
|
+
* [#138](https://github.com/slack-ruby/slack-ruby-client/pull/138): Added `validate` option to `channels_create`, `channels_join`, `channels_rename`, `groups_create` and `groups_rename` Web APIs - [@dblock](https://github.com/dblock).
|
8
|
+
* [#138](https://github.com/slack-ruby/slack-ruby-client/pull/138): Removed `channel` option from `files_comments_add` Web API - [@dblock](https://github.com/dblock).
|
9
|
+
|
1
10
|
### 0.7.9 (2/9/2017)
|
2
11
|
|
3
12
|
* [#132](https://github.com/slack-ruby/slack-ruby-client/issues/132): Fix: you are setting a key that conflicts with a built-in method Slack::Messages::Message#presence - [@dblock](https://github.com/dblock).
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ A Ruby client for the Slack [Web](https://api.slack.com/web) and [RealTime Messa
|
|
18
18
|
|
19
19
|
## Stable Release
|
20
20
|
|
21
|
-
You're reading the documentation for the **stable** release of slack-ruby-client, 0.
|
21
|
+
You're reading the documentation for the **stable** release of slack-ruby-client, 0.8.0. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
|
22
22
|
|
23
23
|
## Installation
|
24
24
|
|
@@ -173,6 +173,14 @@ ca_path | Optional SSL certificates path.
|
|
173
173
|
ca_file | Optional SSL certificates file.
|
174
174
|
endpoint | Slack endpoint, default is _https://slack.com/api_.
|
175
175
|
logger | Optional `Logger` instance that logs HTTP requests.
|
176
|
+
timeout | Optional open/read timeout in seconds.
|
177
|
+
open_timeout | Optional connection open timeout in seconds.
|
178
|
+
|
179
|
+
You can also pass request options, including `timeout` and `open_timeout` into individual calls.
|
180
|
+
|
181
|
+
```ruby
|
182
|
+
client.channels_list(request: { timeout: 180 })
|
183
|
+
```
|
176
184
|
|
177
185
|
### RealTime Client
|
178
186
|
|
@@ -264,7 +272,7 @@ token | Slack API token.
|
|
264
272
|
websocket_ping | The number of seconds that indicates how often the WebSocket should send ping frames, default is 30.
|
265
273
|
websocket_proxy | Connect via proxy, include `:origin` and `:headers`.
|
266
274
|
store_class | Local store class name, default is an in-memory `Slack::RealTime::Stores::Store`.
|
267
|
-
start_options | Options to pass into `rtm.start`, default is `{}`.
|
275
|
+
start_options | Options to pass into `rtm.start`, default is `{ request: { timeout: 180 } }`.
|
268
276
|
logger | Optional `Logger` instance that logs RealTime requests and socket data.
|
269
277
|
|
270
278
|
Note that the RealTime client uses a Web client to obtain the WebSocket URL via [rtm.start](https://api.slack.com/methods/rtm.start). While `token` and `logger` options are passed down from the RealTime client, you may also configure Web client options via `Slack::Web::Client.configure` as described above.
|
@@ -292,10 +300,27 @@ end
|
|
292
300
|
client.start!
|
293
301
|
```
|
294
302
|
|
295
|
-
See a
|
303
|
+
See a fully working example in [examples/hi_real_time_and_web](examples/hi_real_time_and_web/hi.rb).
|
296
304
|
|
297
305
|
![](examples/hi_real_time_and_web/hi.gif)
|
298
306
|
|
307
|
+
### Large Team Considerations
|
308
|
+
|
309
|
+
The `rtm.start` call downloads a large amount of data. For large teams, consider reducing the amount of unnecessary data downloaded with `start_options`. You may also want to increase the default timeout of 180 seconds.
|
310
|
+
|
311
|
+
```ruby
|
312
|
+
Slack::RealTime::Client.config do |config|
|
313
|
+
# Return timestamp only for latest message object of each channel.
|
314
|
+
config.start_options[:simple_latest] = true
|
315
|
+
# Skip unread counts for each channel.
|
316
|
+
config.start_options[:no_unreads] = true
|
317
|
+
# Increase request timeout to 6 minutes.
|
318
|
+
config.start_options[:request][:timeout] = 360
|
319
|
+
end
|
320
|
+
```
|
321
|
+
|
322
|
+
See [#134](https://github.com/slack-ruby/slack-ruby-client/issues/134) for a discussion on this topic.
|
323
|
+
|
299
324
|
#### Concurrency
|
300
325
|
|
301
326
|
`Slack::RealTime::Client` needs help from a concurrency library and supports [Faye::WebSocket](https://github.com/faye/faye-websocket-ruby) with [Eventmachine](https://github.com/eventmachine/eventmachine) and [Celluloid](https://github.com/celluloid/celluloid). It will auto-detect one or the other depending on the gems in your Gemfile, but you can also set concurrency explicitly.
|
data/UPGRADING.md
CHANGED
@@ -1,6 +1,28 @@
|
|
1
1
|
Upgrading Slack-Ruby-Client
|
2
2
|
===========================
|
3
3
|
|
4
|
+
### Upgrading to >= 0.8.0
|
5
|
+
|
6
|
+
The default timeout for `rtm.start` has been increased from 60 to 180 seconds via `Slack::RealTime::Client.config.start_options[:request][:timeout]`. If you're explicitly setting `start_options` in your application, preserve the value by merging settings instead of replacing the entire `start_options` value.
|
7
|
+
|
8
|
+
Before:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
Slack::RealTime::Client.config do |config|
|
12
|
+
config.start_options = { no_unreads: true }
|
13
|
+
end
|
14
|
+
```
|
15
|
+
|
16
|
+
After:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
Slack::RealTime::Client.config do |config|
|
20
|
+
config.start_options[:no_unreads] = true # keeps config.start_options[:request] intact
|
21
|
+
end
|
22
|
+
```
|
23
|
+
|
24
|
+
See [#136](https://github.com/slack-ruby/slack-ruby-client/pull/136) for more details.
|
25
|
+
|
4
26
|
### Upgrading to >= 0.6.0
|
5
27
|
|
6
28
|
#### Changes to API Response Data
|
data/bin/commands/channels.rb
CHANGED
@@ -15,6 +15,7 @@ command 'channels' do |g|
|
|
15
15
|
g.long_desc %( This method is used to create a channel. )
|
16
16
|
g.command 'create' do |c|
|
17
17
|
c.flag 'name', desc: 'Name of channel to create.'
|
18
|
+
c.flag 'validate', desc: 'Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.'
|
18
19
|
c.action do |_global_options, options, _args|
|
19
20
|
puts JSON.dump($client.channels_create(options))
|
20
21
|
end
|
@@ -56,6 +57,7 @@ command 'channels' do |g|
|
|
56
57
|
g.long_desc %( This method is used to join a channel. If the channel does not exist, it is created. )
|
57
58
|
g.command 'join' do |c|
|
58
59
|
c.flag 'name', desc: 'Name of channel to join.'
|
60
|
+
c.flag 'validate', desc: 'Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.'
|
59
61
|
c.action do |_global_options, options, _args|
|
60
62
|
puts JSON.dump($client.channels_join(options))
|
61
63
|
end
|
@@ -104,6 +106,7 @@ command 'channels' do |g|
|
|
104
106
|
g.command 'rename' do |c|
|
105
107
|
c.flag 'channel', desc: 'Channel to rename.'
|
106
108
|
c.flag 'name', desc: 'New name for channel.'
|
109
|
+
c.flag 'validate', desc: 'Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.'
|
107
110
|
c.action do |_global_options, options, _args|
|
108
111
|
puts JSON.dump($client.channels_rename(options))
|
109
112
|
end
|
@@ -7,7 +7,6 @@ command 'files_comments' do |g|
|
|
7
7
|
g.command 'add' do |c|
|
8
8
|
c.flag 'file', desc: 'File to add a comment to.'
|
9
9
|
c.flag 'comment', desc: 'Text of the comment to add.'
|
10
|
-
c.flag 'channel', desc: 'Channel id (encoded) of which location to associate with the new comment.'
|
11
10
|
c.action do |_global_options, options, _args|
|
12
11
|
puts JSON.dump($client.files_comments_add(options))
|
13
12
|
end
|
data/bin/commands/groups.rb
CHANGED
@@ -24,6 +24,7 @@ command 'groups' do |g|
|
|
24
24
|
g.long_desc %( This method creates a private channel. )
|
25
25
|
g.command 'create' do |c|
|
26
26
|
c.flag 'name', desc: 'Name of private channel to create.'
|
27
|
+
c.flag 'validate', desc: 'Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.'
|
27
28
|
c.action do |_global_options, options, _args|
|
28
29
|
puts JSON.dump($client.groups_create(options))
|
29
30
|
end
|
@@ -122,6 +123,7 @@ command 'groups' do |g|
|
|
122
123
|
g.command 'rename' do |c|
|
123
124
|
c.flag 'channel', desc: 'Private channel to rename.'
|
124
125
|
c.flag 'name', desc: 'New name for private channel.'
|
126
|
+
c.flag 'validate', desc: 'Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.'
|
125
127
|
c.action do |_global_options, options, _args|
|
126
128
|
puts JSON.dump($client.groups_rename(options))
|
127
129
|
end
|
data/bin/commands/search.rb
CHANGED
@@ -8,7 +8,7 @@ command 'search' do |g|
|
|
8
8
|
c.flag 'query', desc: 'Search query. May contains booleans, etc.'
|
9
9
|
c.flag 'sort', desc: 'Return matches sorted by either score or timestamp.'
|
10
10
|
c.flag 'sort_dir', desc: 'Change sort direction to ascending (asc) or descending (desc).'
|
11
|
-
c.flag 'highlight', desc: 'Pass a value of
|
11
|
+
c.flag 'highlight', desc: 'Pass a value of true to enable query highlight markers (see below).'
|
12
12
|
c.action do |_global_options, options, _args|
|
13
13
|
puts JSON.dump($client.search_all(options))
|
14
14
|
end
|
@@ -20,7 +20,7 @@ command 'search' do |g|
|
|
20
20
|
c.flag 'query', desc: 'Search query. May contain booleans, etc.'
|
21
21
|
c.flag 'sort', desc: 'Return matches sorted by either score or timestamp.'
|
22
22
|
c.flag 'sort_dir', desc: 'Change sort direction to ascending (asc) or descending (desc).'
|
23
|
-
c.flag 'highlight', desc: 'Pass a value of
|
23
|
+
c.flag 'highlight', desc: 'Pass a value of true to enable query highlight markers (see below).'
|
24
24
|
c.action do |_global_options, options, _args|
|
25
25
|
puts JSON.dump($client.search_files(options))
|
26
26
|
end
|
@@ -32,7 +32,7 @@ command 'search' do |g|
|
|
32
32
|
c.flag 'query', desc: 'Search query. May contains booleans, etc.'
|
33
33
|
c.flag 'sort', desc: 'Return matches sorted by either score or timestamp.'
|
34
34
|
c.flag 'sort_dir', desc: 'Change sort direction to ascending (asc) or descending (desc).'
|
35
|
-
c.flag 'highlight', desc: 'Pass a value of
|
35
|
+
c.flag 'highlight', desc: 'Pass a value of true to enable query highlight markers (see below).'
|
36
36
|
c.action do |_global_options, options, _args|
|
37
37
|
puts JSON.dump($client.search_messages(options))
|
38
38
|
end
|
@@ -38,7 +38,7 @@ module Slack
|
|
38
38
|
logger.debug("#{self.class}##{__method__}") { e }
|
39
39
|
driver.emit(:close, WebSocket::Driver::CloseEvent.new(1001, 'server closed connection')) unless @closing
|
40
40
|
ensure
|
41
|
-
current_actor.terminate if current_actor.alive?
|
41
|
+
current_actor.terminate if current_actor.alive? && current_actor.running?
|
42
42
|
end
|
43
43
|
|
44
44
|
def close
|
@@ -22,7 +22,7 @@ module Slack
|
|
22
22
|
self.websocket_proxy = nil
|
23
23
|
self.token = nil
|
24
24
|
self.concurrency = method(:detect_concurrency)
|
25
|
-
self.start_options = {}
|
25
|
+
self.start_options = { request: { timeout: 180 } }
|
26
26
|
self.store_class = Slack::RealTime::Store
|
27
27
|
self.logger = nil
|
28
28
|
end
|
data/lib/slack/version.rb
CHANGED
@@ -23,6 +23,8 @@ module Slack
|
|
23
23
|
#
|
24
24
|
# @option options [Object] :name
|
25
25
|
# Name of channel to create.
|
26
|
+
# @option options [Object] :validate
|
27
|
+
# Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.
|
26
28
|
# @see https://api.slack.com/methods/channels.create
|
27
29
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels/channels.create.json
|
28
30
|
def channels_create(options = {})
|
@@ -87,6 +89,8 @@ module Slack
|
|
87
89
|
#
|
88
90
|
# @option options [Object] :name
|
89
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.
|
90
94
|
# @see https://api.slack.com/methods/channels.join
|
91
95
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels/channels.join.json
|
92
96
|
def channels_join(options = {})
|
@@ -158,6 +162,8 @@ module Slack
|
|
158
162
|
# Channel to rename.
|
159
163
|
# @option options [Object] :name
|
160
164
|
# New name for channel.
|
165
|
+
# @option options [Object] :validate
|
166
|
+
# Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.
|
161
167
|
# @see https://api.slack.com/methods/channels.rename
|
162
168
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels/channels.rename.json
|
163
169
|
def channels_rename(options = {})
|
@@ -12,14 +12,11 @@ module Slack
|
|
12
12
|
# File to add a comment to.
|
13
13
|
# @option options [Object] :comment
|
14
14
|
# Text of the comment to add.
|
15
|
-
# @option options [channel] :channel
|
16
|
-
# Channel id (encoded) of which location to associate with the new comment.
|
17
15
|
# @see https://api.slack.com/methods/files.comments.add
|
18
16
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/files.comments/files.comments.add.json
|
19
17
|
def files_comments_add(options = {})
|
20
18
|
throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
|
21
19
|
throw ArgumentError.new('Required arguments :comment missing') if options[:comment].nil?
|
22
|
-
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
23
20
|
post('files.comments.add', options)
|
24
21
|
end
|
25
22
|
|
@@ -36,6 +36,8 @@ module Slack
|
|
36
36
|
#
|
37
37
|
# @option options [Object] :name
|
38
38
|
# Name of private channel to create.
|
39
|
+
# @option options [Object] :validate
|
40
|
+
# Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.
|
39
41
|
# @see https://api.slack.com/methods/groups.create
|
40
42
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups/groups.create.json
|
41
43
|
def groups_create(options = {})
|
@@ -187,6 +189,8 @@ module Slack
|
|
187
189
|
# Private channel to rename.
|
188
190
|
# @option options [Object] :name
|
189
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.
|
190
194
|
# @see https://api.slack.com/methods/groups.rename
|
191
195
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups/groups.rename.json
|
192
196
|
def groups_rename(options = {})
|
@@ -15,7 +15,7 @@ module Slack
|
|
15
15
|
# @option options [Object] :sort_dir
|
16
16
|
# Change sort direction to ascending (asc) or descending (desc).
|
17
17
|
# @option options [Object] :highlight
|
18
|
-
# Pass a value of
|
18
|
+
# Pass a value of true to enable query highlight markers (see below).
|
19
19
|
# @see https://api.slack.com/methods/search.all
|
20
20
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/search/search.all.json
|
21
21
|
def search_all(options = {})
|
@@ -33,7 +33,7 @@ module Slack
|
|
33
33
|
# @option options [Object] :sort_dir
|
34
34
|
# Change sort direction to ascending (asc) or descending (desc).
|
35
35
|
# @option options [Object] :highlight
|
36
|
-
# Pass a value of
|
36
|
+
# Pass a value of true to enable query highlight markers (see below).
|
37
37
|
# @see https://api.slack.com/methods/search.files
|
38
38
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/search/search.files.json
|
39
39
|
def search_files(options = {})
|
@@ -51,7 +51,7 @@ module Slack
|
|
51
51
|
# @option options [Object] :sort_dir
|
52
52
|
# Change sort direction to ascending (asc) or descending (desc).
|
53
53
|
# @option options [Object] :highlight
|
54
|
-
# Pass a value of
|
54
|
+
# Pass a value of true to enable query highlight markers (see below).
|
55
55
|
# @see https://api.slack.com/methods/search.messages
|
56
56
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/search/search.messages.json
|
57
57
|
def search_messages(options = {})
|
data/lib/slack/web/config.rb
CHANGED
@@ -10,7 +10,9 @@ module Slack
|
|
10
10
|
:ca_file,
|
11
11
|
:logger,
|
12
12
|
:endpoint,
|
13
|
-
:token
|
13
|
+
:token,
|
14
|
+
:timeout,
|
15
|
+
:open_timeout
|
14
16
|
].freeze
|
15
17
|
|
16
18
|
attr_accessor(*Config::ATTRIBUTES)
|
@@ -23,6 +25,8 @@ module Slack
|
|
23
25
|
self.token = nil
|
24
26
|
self.proxy = nil
|
25
27
|
self.logger = nil
|
28
|
+
self.timeout = nil
|
29
|
+
self.open_timeout = nil
|
26
30
|
end
|
27
31
|
end
|
28
32
|
|
@@ -13,6 +13,11 @@ module Slack
|
|
13
13
|
options[:proxy] = proxy if proxy
|
14
14
|
options[:ssl] = { ca_path: ca_path, ca_file: ca_file }
|
15
15
|
|
16
|
+
request_options = {}
|
17
|
+
request_options[:timeout] = timeout if timeout
|
18
|
+
request_options[:open_timeout] = open_timeout if open_timeout
|
19
|
+
options[:request] = request_options if request_options.any?
|
20
|
+
|
16
21
|
::Faraday::Connection.new(endpoint, options) do |connection|
|
17
22
|
connection.use ::Faraday::Request::Multipart
|
18
23
|
connection.use ::Faraday::Request::UrlEncoded
|
@@ -206,7 +206,7 @@ RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/rtm_start' }
|
|
206
206
|
client.start!
|
207
207
|
end
|
208
208
|
it 'sets start_options' do
|
209
|
-
expect(client.start_options).to eq({})
|
209
|
+
expect(client.start_options).to eq(request: { timeout: 180 })
|
210
210
|
end
|
211
211
|
end
|
212
212
|
end
|
@@ -130,5 +130,45 @@ RSpec.describe Slack::Web::Client do
|
|
130
130
|
end
|
131
131
|
end
|
132
132
|
end
|
133
|
+
context 'timeout options' do
|
134
|
+
before do
|
135
|
+
Slack::Web::Client.configure do |config|
|
136
|
+
config.timeout = 10
|
137
|
+
config.open_timeout = 15
|
138
|
+
end
|
139
|
+
end
|
140
|
+
describe '#initialize' do
|
141
|
+
it 'sets timeout and open_timeout' do
|
142
|
+
expect(client.timeout).to eq 10
|
143
|
+
expect(client.open_timeout).to eq 15
|
144
|
+
end
|
145
|
+
it 'creates a connection with timeout options' do
|
146
|
+
conn = client.send(:connection)
|
147
|
+
expect(conn.options.timeout).to eq 10
|
148
|
+
expect(conn.options.open_timeout).to eq 15
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
context 'per-request options' do
|
153
|
+
it 'applies timeout', vcr: { cassette_name: 'web/rtm_start', allow_playback_repeats: true } do
|
154
|
+
# reuse the same connection for the test, otherwise it creates a new one every time
|
155
|
+
conn = client.send(:connection)
|
156
|
+
expect(client).to receive(:connection).and_return(conn)
|
157
|
+
|
158
|
+
# get the yielded request to reuse in the next call to rtm_start so that we can examine request.options later
|
159
|
+
request = nil
|
160
|
+
response = conn.post do |r|
|
161
|
+
r.path = 'rtm.start'
|
162
|
+
r.body = { token: 'token' }
|
163
|
+
request = r
|
164
|
+
end
|
165
|
+
|
166
|
+
expect(conn).to receive(:post).and_yield(request).and_return(response)
|
167
|
+
|
168
|
+
client.rtm_start(request: { timeout: 3 })
|
169
|
+
|
170
|
+
expect(request.options.timeout).to eq 3
|
171
|
+
end
|
172
|
+
end
|
133
173
|
end
|
134
174
|
end
|
data/spec/support/vcr.rb
CHANGED
@@ -4,6 +4,6 @@ require 'webmock/rspec'
|
|
4
4
|
VCR.configure do |config|
|
5
5
|
config.cassette_library_dir = 'spec/fixtures/slack'
|
6
6
|
config.hook_into :webmock
|
7
|
-
config.default_cassette_options = { record: :new_episodes }
|
7
|
+
# config.default_cassette_options = { record: :new_episodes }
|
8
8
|
config.configure_rspec_metadata!
|
9
9
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Doubrovkine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|