slack-ruby-client 0.14.1 → 0.14.2
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 +4 -4
- data/.gitignore +1 -0
- data/.rubocop_todo.yml +15 -4
- data/CHANGELOG.md +7 -0
- data/README.md +8 -1
- data/Rakefile +1 -1
- data/bin/commands.rb +1 -0
- data/bin/commands/api.rb +2 -2
- data/bin/commands/apps.rb +2 -2
- data/bin/commands/apps_permissions.rb +4 -4
- data/bin/commands/apps_permissions_resources.rb +2 -2
- data/bin/commands/apps_permissions_scopes.rb +2 -2
- data/bin/commands/apps_permissions_users.rb +4 -4
- data/bin/commands/auth.rb +4 -4
- data/bin/commands/bots.rb +2 -2
- data/bin/commands/channels.rb +32 -31
- data/bin/commands/chat.rb +48 -17
- data/bin/commands/chat_scheduledMessages.rb +17 -0
- data/bin/commands/conversations.rb +35 -35
- data/bin/commands/dialog.rb +2 -2
- data/bin/commands/dnd.rb +9 -9
- data/bin/commands/emoji.rb +2 -2
- data/bin/commands/files.rb +14 -25
- data/bin/commands/files_comments.rb +2 -23
- data/bin/commands/groups.rb +33 -33
- data/bin/commands/im.rb +13 -13
- data/bin/commands/migration.rb +2 -2
- data/bin/commands/mpim.rb +11 -11
- data/bin/commands/oauth.rb +4 -4
- data/bin/commands/pins.rb +6 -6
- data/bin/commands/reactions.rb +8 -8
- data/bin/commands/reminders.rb +10 -10
- data/bin/commands/rtm.rb +4 -4
- data/bin/commands/search.rb +7 -7
- data/bin/commands/stars.rb +6 -6
- data/bin/commands/team.rb +8 -8
- data/bin/commands/team_profile.rb +2 -2
- data/bin/commands/usergroups.rb +11 -11
- data/bin/commands/usergroups_users.rb +4 -4
- data/bin/commands/users.rb +21 -22
- data/bin/commands/users_profile.rb +4 -4
- data/lib/slack/events/request.rb +9 -5
- data/lib/slack/real_time/client.rb +23 -6
- data/lib/slack/real_time/concurrency/async.rb +55 -23
- data/lib/slack/real_time/concurrency/celluloid.rb +0 -1
- data/lib/slack/real_time/concurrency/eventmachine.rb +0 -5
- data/lib/slack/real_time/socket.rb +16 -9
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints.rb +2 -0
- data/lib/slack/web/api/endpoints/api.rb +1 -1
- data/lib/slack/web/api/endpoints/apps.rb +1 -1
- data/lib/slack/web/api/endpoints/apps_permissions.rb +2 -2
- data/lib/slack/web/api/endpoints/apps_permissions_resources.rb +1 -1
- data/lib/slack/web/api/endpoints/apps_permissions_scopes.rb +1 -1
- data/lib/slack/web/api/endpoints/apps_permissions_users.rb +2 -2
- data/lib/slack/web/api/endpoints/auth.rb +2 -2
- data/lib/slack/web/api/endpoints/bots.rb +1 -1
- data/lib/slack/web/api/endpoints/channels.rb +18 -15
- data/lib/slack/web/api/endpoints/chat.rb +63 -9
- data/lib/slack/web/api/endpoints/chat_scheduledMessages.rb +37 -0
- data/lib/slack/web/api/endpoints/conversations.rb +17 -17
- data/lib/slack/web/api/endpoints/dialog.rb +1 -1
- data/lib/slack/web/api/endpoints/dnd.rb +4 -4
- data/lib/slack/web/api/endpoints/emoji.rb +1 -1
- data/lib/slack/web/api/endpoints/files.rb +7 -18
- data/lib/slack/web/api/endpoints/files_comments.rb +1 -34
- data/lib/slack/web/api/endpoints/groups.rb +18 -16
- data/lib/slack/web/api/endpoints/im.rb +8 -6
- data/lib/slack/web/api/endpoints/migration.rb +1 -1
- data/lib/slack/web/api/endpoints/mpim.rb +7 -5
- data/lib/slack/web/api/endpoints/oauth.rb +2 -2
- data/lib/slack/web/api/endpoints/pins.rb +5 -3
- data/lib/slack/web/api/endpoints/reactions.rb +6 -4
- data/lib/slack/web/api/endpoints/reminders.rb +5 -5
- data/lib/slack/web/api/endpoints/rtm.rb +2 -2
- data/lib/slack/web/api/endpoints/search.rb +3 -3
- data/lib/slack/web/api/endpoints/stars.rb +5 -3
- data/lib/slack/web/api/endpoints/team.rb +5 -4
- data/lib/slack/web/api/endpoints/team_profile.rb +1 -1
- data/lib/slack/web/api/endpoints/usergroups.rb +5 -5
- data/lib/slack/web/api/endpoints/usergroups_users.rb +2 -2
- data/lib/slack/web/api/endpoints/users.rb +12 -12
- data/lib/slack/web/api/endpoints/users_profile.rb +2 -2
- data/spec/integration/integration_spec.rb +43 -36
- data/spec/slack/events/request_spec.rb +29 -1
- data/spec/slack/real_time/concurrency/celluloid_spec.rb +5 -0
- data/spec/slack/real_time/concurrency/eventmachine_spec.rb +1 -0
- data/spec/slack/web/api/endpoints/chat_scheduledMessages_spec.rb +7 -0
- data/spec/slack/web/api/endpoints/files_comments_spec.rb +0 -19
- data/spec/spec_helper.rb +5 -0
- metadata +6 -2
@@ -3,10 +3,11 @@ require 'spec_helper'
|
|
3
3
|
RSpec.describe Slack::Events::Request do
|
4
4
|
before do
|
5
5
|
Slack::Events.configure do |config|
|
6
|
-
config.signing_secret =
|
6
|
+
config.signing_secret = signing_secret
|
7
7
|
config.signature_expires_in = 30
|
8
8
|
end
|
9
9
|
end
|
10
|
+
let(:signing_secret) { 'ade6ca762ade4db0e7d31484cd616b9c' }
|
10
11
|
let(:signature) { 'v0=91177eea054d65de0fc0f9b4ec57714307bc0ce2c5f3bf0d28b1b720c8f92ba2' }
|
11
12
|
let(:timestamp) { '1547933148' }
|
12
13
|
let(:body) { '{"token":"X34FAqCu8tmGEkEEpoDncnja","challenge":"P7sFXA4o3HV2hTx4zb4zcQ9yrvuQs8pDh6EacOxmMRj0tJaXfQFF","type":"url_verification"}' }
|
@@ -115,6 +116,33 @@ RSpec.describe Slack::Events::Request do
|
|
115
116
|
end
|
116
117
|
end
|
117
118
|
end
|
119
|
+
context 'without global config' do
|
120
|
+
before do
|
121
|
+
Slack::Events.config.reset
|
122
|
+
end
|
123
|
+
context 'without a signing secret parameter' do
|
124
|
+
subject do
|
125
|
+
Slack::Events::Request.new(http_request)
|
126
|
+
end
|
127
|
+
it 'raises MissingSigningSecret' do
|
128
|
+
expect { subject.valid? }.to raise_error Slack::Events::Request::MissingSigningSecret
|
129
|
+
end
|
130
|
+
end
|
131
|
+
context 'with a signing secret parameter' do
|
132
|
+
subject do
|
133
|
+
Slack::Events::Request.new(http_request,
|
134
|
+
signing_secret: signing_secret,
|
135
|
+
signature_expires_in: 30)
|
136
|
+
end
|
137
|
+
before do
|
138
|
+
Timecop.freeze(Time.at(timestamp.to_i))
|
139
|
+
end
|
140
|
+
it 'is valid and not expired' do
|
141
|
+
expect(subject).to be_valid
|
142
|
+
expect(subject).to_not be_expired
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
118
146
|
after do
|
119
147
|
Slack::Events.config.reset
|
120
148
|
end
|
@@ -78,12 +78,17 @@ begin
|
|
78
78
|
|
79
79
|
describe '#disconnect!' do
|
80
80
|
it 'closes and nils the websocket' do
|
81
|
+
expect(ws).to receive(:emit)
|
81
82
|
expect(ws).to receive(:close)
|
82
83
|
socket.disconnect!
|
83
84
|
end
|
84
85
|
end
|
85
86
|
|
86
87
|
context 'consumes data' do
|
88
|
+
let(:tcp_socket) { double(::Celluloid::IO::SSLSocket, connect: true) }
|
89
|
+
before do
|
90
|
+
allow_any_instance_of(described_class).to receive(:build_socket).and_return(tcp_socket)
|
91
|
+
end
|
87
92
|
it 'runs' do
|
88
93
|
expect(ws).to receive(:emit)
|
89
94
|
expect(ws).to receive(:start)
|
@@ -4,14 +4,6 @@ require 'spec_helper'
|
|
4
4
|
|
5
5
|
RSpec.describe Slack::Web::Api::Endpoints::FilesComments do
|
6
6
|
let(:client) { Slack::Web::Client.new }
|
7
|
-
context 'files.comments_add' do
|
8
|
-
it 'requires comment' do
|
9
|
-
expect { client.files_comments_add(file: 'F1234467890') }.to raise_error ArgumentError, /Required arguments :comment missing/
|
10
|
-
end
|
11
|
-
it 'requires file' do
|
12
|
-
expect { client.files_comments_add(comment: 'Everyone should take a moment to read this file.') }.to raise_error ArgumentError, /Required arguments :file missing/
|
13
|
-
end
|
14
|
-
end
|
15
7
|
context 'files.comments_delete' do
|
16
8
|
it 'requires file' do
|
17
9
|
expect { client.files_comments_delete(id: 'Fc1234567890') }.to raise_error ArgumentError, /Required arguments :file missing/
|
@@ -20,15 +12,4 @@ RSpec.describe Slack::Web::Api::Endpoints::FilesComments do
|
|
20
12
|
expect { client.files_comments_delete(file: 'F1234567890') }.to raise_error ArgumentError, /Required arguments :id missing/
|
21
13
|
end
|
22
14
|
end
|
23
|
-
context 'files.comments_edit' do
|
24
|
-
it 'requires comment' do
|
25
|
-
expect { client.files_comments_edit(file: 'F1234567890', id: 'Fc1234567890') }.to raise_error ArgumentError, /Required arguments :comment missing/
|
26
|
-
end
|
27
|
-
it 'requires file' do
|
28
|
-
expect { client.files_comments_edit(comment: 'Everyone should take a moment to read this file, seriously.', id: 'Fc1234567890') }.to raise_error ArgumentError, /Required arguments :file missing/
|
29
|
-
end
|
30
|
-
it 'requires id' do
|
31
|
-
expect { client.files_comments_edit(comment: 'Everyone should take a moment to read this file, seriously.', file: 'F1234567890') }.to raise_error ArgumentError, /Required arguments :id missing/
|
32
|
-
end
|
33
|
-
end
|
34
15
|
end
|
data/spec/spec_helper.rb
CHANGED
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.14.
|
4
|
+
version: 0.14.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Doubrovkine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -239,6 +239,7 @@ files:
|
|
239
239
|
- bin/commands/bots.rb
|
240
240
|
- bin/commands/channels.rb
|
241
241
|
- bin/commands/chat.rb
|
242
|
+
- bin/commands/chat_scheduledMessages.rb
|
242
243
|
- bin/commands/conversations.rb
|
243
244
|
- bin/commands/dialog.rb
|
244
245
|
- bin/commands/dnd.rb
|
@@ -330,6 +331,7 @@ files:
|
|
330
331
|
- lib/slack/web/api/endpoints/bots.rb
|
331
332
|
- lib/slack/web/api/endpoints/channels.rb
|
332
333
|
- lib/slack/web/api/endpoints/chat.rb
|
334
|
+
- lib/slack/web/api/endpoints/chat_scheduledMessages.rb
|
333
335
|
- lib/slack/web/api/endpoints/conversations.rb
|
334
336
|
- lib/slack/web/api/endpoints/dialog.rb
|
335
337
|
- lib/slack/web/api/endpoints/dnd.rb
|
@@ -439,6 +441,7 @@ files:
|
|
439
441
|
- spec/slack/web/api/endpoints/apps_permissions_users_spec.rb
|
440
442
|
- spec/slack/web/api/endpoints/apps_spec.rb
|
441
443
|
- spec/slack/web/api/endpoints/bots_spec.rb
|
444
|
+
- spec/slack/web/api/endpoints/chat_scheduledMessages_spec.rb
|
442
445
|
- spec/slack/web/api/endpoints/conversations_spec.rb
|
443
446
|
- spec/slack/web/api/endpoints/custom_specs/auth_spec.rb
|
444
447
|
- spec/slack/web/api/endpoints/custom_specs/channels_spec.rb
|
@@ -550,6 +553,7 @@ test_files:
|
|
550
553
|
- spec/slack/web/api/endpoints/apps_permissions_users_spec.rb
|
551
554
|
- spec/slack/web/api/endpoints/apps_spec.rb
|
552
555
|
- spec/slack/web/api/endpoints/bots_spec.rb
|
556
|
+
- spec/slack/web/api/endpoints/chat_scheduledMessages_spec.rb
|
553
557
|
- spec/slack/web/api/endpoints/conversations_spec.rb
|
554
558
|
- spec/slack/web/api/endpoints/custom_specs/auth_spec.rb
|
555
559
|
- spec/slack/web/api/endpoints/custom_specs/channels_spec.rb
|