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.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop_todo.yml +15 -4
  4. data/CHANGELOG.md +7 -0
  5. data/README.md +8 -1
  6. data/Rakefile +1 -1
  7. data/bin/commands.rb +1 -0
  8. data/bin/commands/api.rb +2 -2
  9. data/bin/commands/apps.rb +2 -2
  10. data/bin/commands/apps_permissions.rb +4 -4
  11. data/bin/commands/apps_permissions_resources.rb +2 -2
  12. data/bin/commands/apps_permissions_scopes.rb +2 -2
  13. data/bin/commands/apps_permissions_users.rb +4 -4
  14. data/bin/commands/auth.rb +4 -4
  15. data/bin/commands/bots.rb +2 -2
  16. data/bin/commands/channels.rb +32 -31
  17. data/bin/commands/chat.rb +48 -17
  18. data/bin/commands/chat_scheduledMessages.rb +17 -0
  19. data/bin/commands/conversations.rb +35 -35
  20. data/bin/commands/dialog.rb +2 -2
  21. data/bin/commands/dnd.rb +9 -9
  22. data/bin/commands/emoji.rb +2 -2
  23. data/bin/commands/files.rb +14 -25
  24. data/bin/commands/files_comments.rb +2 -23
  25. data/bin/commands/groups.rb +33 -33
  26. data/bin/commands/im.rb +13 -13
  27. data/bin/commands/migration.rb +2 -2
  28. data/bin/commands/mpim.rb +11 -11
  29. data/bin/commands/oauth.rb +4 -4
  30. data/bin/commands/pins.rb +6 -6
  31. data/bin/commands/reactions.rb +8 -8
  32. data/bin/commands/reminders.rb +10 -10
  33. data/bin/commands/rtm.rb +4 -4
  34. data/bin/commands/search.rb +7 -7
  35. data/bin/commands/stars.rb +6 -6
  36. data/bin/commands/team.rb +8 -8
  37. data/bin/commands/team_profile.rb +2 -2
  38. data/bin/commands/usergroups.rb +11 -11
  39. data/bin/commands/usergroups_users.rb +4 -4
  40. data/bin/commands/users.rb +21 -22
  41. data/bin/commands/users_profile.rb +4 -4
  42. data/lib/slack/events/request.rb +9 -5
  43. data/lib/slack/real_time/client.rb +23 -6
  44. data/lib/slack/real_time/concurrency/async.rb +55 -23
  45. data/lib/slack/real_time/concurrency/celluloid.rb +0 -1
  46. data/lib/slack/real_time/concurrency/eventmachine.rb +0 -5
  47. data/lib/slack/real_time/socket.rb +16 -9
  48. data/lib/slack/version.rb +1 -1
  49. data/lib/slack/web/api/endpoints.rb +2 -0
  50. data/lib/slack/web/api/endpoints/api.rb +1 -1
  51. data/lib/slack/web/api/endpoints/apps.rb +1 -1
  52. data/lib/slack/web/api/endpoints/apps_permissions.rb +2 -2
  53. data/lib/slack/web/api/endpoints/apps_permissions_resources.rb +1 -1
  54. data/lib/slack/web/api/endpoints/apps_permissions_scopes.rb +1 -1
  55. data/lib/slack/web/api/endpoints/apps_permissions_users.rb +2 -2
  56. data/lib/slack/web/api/endpoints/auth.rb +2 -2
  57. data/lib/slack/web/api/endpoints/bots.rb +1 -1
  58. data/lib/slack/web/api/endpoints/channels.rb +18 -15
  59. data/lib/slack/web/api/endpoints/chat.rb +63 -9
  60. data/lib/slack/web/api/endpoints/chat_scheduledMessages.rb +37 -0
  61. data/lib/slack/web/api/endpoints/conversations.rb +17 -17
  62. data/lib/slack/web/api/endpoints/dialog.rb +1 -1
  63. data/lib/slack/web/api/endpoints/dnd.rb +4 -4
  64. data/lib/slack/web/api/endpoints/emoji.rb +1 -1
  65. data/lib/slack/web/api/endpoints/files.rb +7 -18
  66. data/lib/slack/web/api/endpoints/files_comments.rb +1 -34
  67. data/lib/slack/web/api/endpoints/groups.rb +18 -16
  68. data/lib/slack/web/api/endpoints/im.rb +8 -6
  69. data/lib/slack/web/api/endpoints/migration.rb +1 -1
  70. data/lib/slack/web/api/endpoints/mpim.rb +7 -5
  71. data/lib/slack/web/api/endpoints/oauth.rb +2 -2
  72. data/lib/slack/web/api/endpoints/pins.rb +5 -3
  73. data/lib/slack/web/api/endpoints/reactions.rb +6 -4
  74. data/lib/slack/web/api/endpoints/reminders.rb +5 -5
  75. data/lib/slack/web/api/endpoints/rtm.rb +2 -2
  76. data/lib/slack/web/api/endpoints/search.rb +3 -3
  77. data/lib/slack/web/api/endpoints/stars.rb +5 -3
  78. data/lib/slack/web/api/endpoints/team.rb +5 -4
  79. data/lib/slack/web/api/endpoints/team_profile.rb +1 -1
  80. data/lib/slack/web/api/endpoints/usergroups.rb +5 -5
  81. data/lib/slack/web/api/endpoints/usergroups_users.rb +2 -2
  82. data/lib/slack/web/api/endpoints/users.rb +12 -12
  83. data/lib/slack/web/api/endpoints/users_profile.rb +2 -2
  84. data/spec/integration/integration_spec.rb +43 -36
  85. data/spec/slack/events/request_spec.rb +29 -1
  86. data/spec/slack/real_time/concurrency/celluloid_spec.rb +5 -0
  87. data/spec/slack/real_time/concurrency/eventmachine_spec.rb +1 -0
  88. data/spec/slack/web/api/endpoints/chat_scheduledMessages_spec.rb +7 -0
  89. data/spec/slack/web/api/endpoints/files_comments_spec.rb +0 -19
  90. data/spec/spec_helper.rb +5 -0
  91. 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 = 'ade6ca762ade4db0e7d31484cd616b9c'
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)
@@ -27,6 +27,7 @@ begin
27
27
  describe '#disconnect!' do
28
28
  it 'closes and nils the websocket' do
29
29
  socket.instance_variable_set('@driver', ws)
30
+ expect(ws).to receive(:emit).with(:close)
30
31
  expect(ws).to receive(:close)
31
32
  socket.disconnect!
32
33
  end
@@ -0,0 +1,7 @@
1
+ # This file was auto-generated by lib/tasks/web.rake
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Slack::Web::Api::Endpoints::ChatScheduledmessages do
6
+ let(:client) { Slack::Web::Client.new }
7
+ end
@@ -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
@@ -13,3 +13,8 @@ end
13
13
  Slack.configure do |config|
14
14
  config.token = ENV['SLACK_API_TOKEN']
15
15
  end
16
+
17
+ RSpec.configure do |config|
18
+ # Enable flags like --only-failures and --next-failure
19
+ config.example_status_persistence_file_path = '.rspec_status'
20
+ 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.14.1
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-02-26 00:00:00.000000000 Z
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