slack-ruby-client 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +10 -6
- data/CHANGELOG.md +6 -0
- data/README.md +40 -2
- data/bin/commands/channels.rb +9 -0
- data/bin/commands/groups.rb +9 -0
- data/bin/commands/users.rb +9 -0
- data/examples/hi_real_time/hi.rb +5 -0
- data/lib/slack-ruby-client.rb +1 -0
- data/lib/slack/real_time/concurrency/celluloid.rb +4 -4
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints.rb +4 -0
- data/lib/slack/web/api/endpoints/channels.rb +13 -0
- data/lib/slack/web/api/endpoints/chat.rb +2 -0
- data/lib/slack/web/api/endpoints/dnd.rb +1 -0
- data/lib/slack/web/api/endpoints/files.rb +1 -0
- data/lib/slack/web/api/endpoints/groups.rb +16 -0
- data/lib/slack/web/api/endpoints/im.rb +4 -0
- data/lib/slack/web/api/endpoints/mpim.rb +3 -0
- data/lib/slack/web/api/endpoints/pins.rb +3 -0
- data/lib/slack/web/api/endpoints/reactions.rb +4 -0
- data/lib/slack/web/api/endpoints/stars.rb +3 -0
- data/lib/slack/web/api/endpoints/team.rb +1 -0
- data/lib/slack/web/api/endpoints/users.rb +2 -0
- data/lib/slack/web/api/error.rb +1 -1
- data/lib/slack/web/api/mixins.rb +3 -0
- data/lib/slack/web/api/mixins/channels.id.json +20 -0
- data/lib/slack/web/api/mixins/channels.id.rb +26 -0
- data/lib/slack/web/api/mixins/groups.id.json +20 -0
- data/lib/slack/web/api/mixins/groups.id.rb +26 -0
- data/lib/slack/web/api/mixins/users.id.json +20 -0
- data/lib/slack/web/api/mixins/users.id.rb +26 -0
- data/lib/slack/web/api/patches/chat.1.text-attachments-required.patch +1 -1
- data/lib/slack/web/api/tasks/generate.rake +4 -1
- data/lib/slack/web/api/templates/endpoints.erb +4 -0
- data/lib/slack/web/api/templates/method.erb +14 -5
- data/spec/fixtures/slack/web/channels_info.yml +46 -0
- data/spec/fixtures/slack/web/groups_info.yml +43 -0
- data/spec/fixtures/slack/web/users_info.yml +130 -0
- data/spec/integration/integration_spec.rb +11 -2
- data/spec/slack/web/api/endpoints/channels_spec.rb +11 -0
- data/spec/slack/web/api/endpoints/groups_spec.rb +11 -0
- data/spec/slack/web/api/endpoints/users_spec.rb +4 -0
- data/spec/slack/web/api/mixins/channels_spec.rb +31 -0
- data/spec/slack/web/api/mixins/groups_spec.rb +31 -0
- data/spec/slack/web/api/mixins/users_spec.rb +31 -0
- metadata +25 -2
@@ -0,0 +1,43 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://slack.com/api/groups.list
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: token=token
|
9
|
+
response:
|
10
|
+
status:
|
11
|
+
code: 200
|
12
|
+
message: OK
|
13
|
+
headers:
|
14
|
+
Content-Type:
|
15
|
+
- application/json; charset=utf-8
|
16
|
+
body:
|
17
|
+
encoding: ASCII-8BIT
|
18
|
+
string: '{"ok":true,"groups":[{"id":"G0K7EV5A7","name":"mpdm-dblock--rubybot--player1-1","is_group":true,"created":1453561861,"creator":"U04KB5WQR","is_archived":false,"is_mpim":true,"members":["U04KB5WQR","U0HLFUZLJ","U07518DTL"],"topic":{"value":"Group
|
19
|
+
messaging","creator":"U04KB5WQR","last_set":1453561861},"purpose":{"value":"Group
|
20
|
+
messaging with: @dblock @rubybot @player1","creator":"U04KB5WQR","last_set":1453561861}}]}'
|
21
|
+
http_version:
|
22
|
+
recorded_at: Sat, 23 Jan 2016 15:19:10 GMT
|
23
|
+
- request:
|
24
|
+
method: post
|
25
|
+
uri: https://slack.com/api/groups.info
|
26
|
+
body:
|
27
|
+
encoding: UTF-8
|
28
|
+
string: channel=G0K7EV5A7&token=token
|
29
|
+
response:
|
30
|
+
status:
|
31
|
+
code: 200
|
32
|
+
message: OK
|
33
|
+
headers:
|
34
|
+
Content-Type:
|
35
|
+
- application/json; charset=utf-8
|
36
|
+
body:
|
37
|
+
encoding: ASCII-8BIT
|
38
|
+
string: '{"ok":true,"group":{"id":"G0K7EV5A7","name":"mpdm-dblock--rubybot--player1-1","is_group":true,"created":1453561861,"creator":"U04KB5WQR","is_archived":false,"is_mpim":true,"is_open":false,"last_read":"0000000000.000000","latest":null,"unread_count":0,"unread_count_display":0,"members":["U04KB5WQR","U0HLFUZLJ","U07518DTL"],"topic":{"value":"Group
|
39
|
+
messaging","creator":"U04KB5WQR","last_set":1453561861},"purpose":{"value":"Group
|
40
|
+
messaging with: @dblock @rubybot @player1","creator":"U04KB5WQR","last_set":1453561861}}}'
|
41
|
+
http_version:
|
42
|
+
recorded_at: Sat, 23 Jan 2016 15:19:46 GMT
|
43
|
+
recorded_with: VCR 3.0.0
|
@@ -0,0 +1,130 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://slack.com/api/users.list
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: presence=true&token=token
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json; charset=utf-8
|
12
|
+
User-Agent:
|
13
|
+
- Slack Ruby Client/0.5.0
|
14
|
+
Content-Type:
|
15
|
+
- application/x-www-form-urlencoded
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Access-Control-Allow-Origin:
|
24
|
+
- '*'
|
25
|
+
Cache-Control:
|
26
|
+
- private, no-cache, no-store, must-revalidate
|
27
|
+
Content-Security-Policy:
|
28
|
+
- referrer no-referrer;
|
29
|
+
Content-Type:
|
30
|
+
- application/json; charset=utf-8
|
31
|
+
Date:
|
32
|
+
- Sun, 06 Dec 2015 20:18:45 GMT
|
33
|
+
Expires:
|
34
|
+
- Mon, 26 Jul 1997 05:00:00 GMT
|
35
|
+
Pragma:
|
36
|
+
- no-cache
|
37
|
+
Server:
|
38
|
+
- Apache
|
39
|
+
Strict-Transport-Security:
|
40
|
+
- max-age=31536000; includeSubDomains; preload
|
41
|
+
Vary:
|
42
|
+
- Accept-Encoding
|
43
|
+
X-Accepted-Oauth-Scopes:
|
44
|
+
- users:read,read
|
45
|
+
X-Content-Type-Options:
|
46
|
+
- nosniff
|
47
|
+
X-Oauth-Scopes:
|
48
|
+
- identify,read,post,client
|
49
|
+
X-Xss-Protection:
|
50
|
+
- '0'
|
51
|
+
Content-Length:
|
52
|
+
- '1450'
|
53
|
+
Connection:
|
54
|
+
- keep-alive
|
55
|
+
body:
|
56
|
+
encoding: ASCII-8BIT
|
57
|
+
string: '{"ok":true,"members":[{"id":"U092BDCLV","team_id":"T04KB5WQH","name":"artsy","deleted":false,"status":null,"color":"e0a729","real_name":"Artsy
|
58
|
+
Bot","tz":null,"tz_label":"Pacific Standard Time","tz_offset":-28800,"profile":{"bot_id":"B092B5DDG","image_24":"https:\/\/avatars.slack-edge.com\/2015-08-13\/9080316676_7bbab49314a0429c7f7d_24.jpg","image_32":"https:\/\/avatars.slack-edge.com\/2015-08-13\/9080316676_7bbab49314a0429c7f7d_32.jpg","image_48":"https:\/\/avatars.slack-edge.com\/2015-08-13\/9080316676_7bbab49314a0429c7f7d_48.jpg","image_72":"https:\/\/avatars.slack-edge.com\/2015-08-13\/9080316676_7bbab49314a0429c7f7d_48.jpg","image_192":"https:\/\/avatars.slack-edge.com\/2015-08-13\/9080316676_7bbab49314a0429c7f7d_48.jpg","image_512":"https:\/\/avatars.slack-edge.com\/2015-08-13\/9080316676_7bbab49314a0429c7f7d_48.jpg","image_1024":"https:\/\/avatars.slack-edge.com\/2015-08-13\/9080316676_7bbab49314a0429c7f7d_48.jpg","image_original":"https:\/\/avatars.slack-edge.com\/2015-08-13\/9080316676_7bbab49314a0429c7f7d_original.jpg","first_name":"Artsy","last_name":"Bot","title":"Searches
|
59
|
+
Artsy.","real_name":"Artsy Bot","real_name_normalized":"Artsy Bot"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"presence":"away"},{"id":"U07KECJ77","team_id":"T04KB5WQH","name":"aws","deleted":false,"status":null,"color":"e96699","real_name":"AWS
|
60
|
+
Cloud","tz":null,"tz_label":"Pacific Standard Time","tz_offset":-28800,"profile":{"bot_id":"B07KECJ6R","image_24":"https:\/\/avatars.slack-edge.com\/2015-07-14\/7660472085_4755a86e204c9706c84f_24.jpg","image_32":"https:\/\/avatars.slack-edge.com\/2015-07-14\/7660472085_4755a86e204c9706c84f_32.jpg","image_48":"https:\/\/avatars.slack-edge.com\/2015-07-14\/7660472085_4755a86e204c9706c84f_48.jpg","image_72":"https:\/\/avatars.slack-edge.com\/2015-07-14\/7660472085_4755a86e204c9706c84f_48.jpg","image_192":"https:\/\/avatars.slack-edge.com\/2015-07-14\/7660472085_4755a86e204c9706c84f_48.jpg","image_original":"https:\/\/avatars.slack-edge.com\/2015-07-14\/7660472085_4755a86e204c9706c84f_original.jpg","first_name":"AWS","last_name":"Cloud","real_name":"AWS
|
61
|
+
Cloud","real_name_normalized":"AWS Cloud"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"presence":"away"},{"id":"U0EA7TZJN","team_id":"T04KB5WQH","name":"bar","deleted":false,"status":null,"color":"5b89d5","real_name":"","tz":null,"tz_label":"Pacific
|
62
|
+
Standard Time","tz_offset":-28800,"profile":{"bot_id":"B0EA31LQM","image_24":"https:\/\/avatars.slack-edge.com\/2015-11-11\/14346833313_f359ba59a1211d17912b_24.jpg","image_32":"https:\/\/avatars.slack-edge.com\/2015-11-11\/14346833313_f359ba59a1211d17912b_32.jpg","image_48":"https:\/\/avatars.slack-edge.com\/2015-11-11\/14346833313_f359ba59a1211d17912b_48.jpg","image_72":"https:\/\/avatars.slack-edge.com\/2015-11-11\/14346833313_f359ba59a1211d17912b_72.jpg","image_192":"https:\/\/avatars.slack-edge.com\/2015-11-11\/14346833313_f359ba59a1211d17912b_192.jpg","image_512":"https:\/\/avatars.slack-edge.com\/2015-11-11\/14346833313_f359ba59a1211d17912b_512.jpg","image_1024":"https:\/\/avatars.slack-edge.com\/2015-11-11\/14346833313_f359ba59a1211d17912b_512.jpg","image_original":"https:\/\/avatars.slack-edge.com\/2015-11-11\/14346833313_f359ba59a1211d17912b_original.jpg","real_name":"","real_name_normalized":""},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"presence":"away"},{"id":"U092V4E9L","team_id":"T04KB5WQH","name":"broskoski","deleted":false,"status":null,"color":"684b6c","real_name":"Cab","tz":"America\/Indiana\/Indianapolis","tz_label":"Eastern
|
63
|
+
Standard Time","tz_offset":-18000,"profile":{"first_name":"Cab","real_name":"Cab","real_name_normalized":"Cab","email":"cab@artsymail.com","image_24":"https:\/\/secure.gravatar.com\/avatar\/99621cbca6ea94706a8f5dcdc5e8af4a.jpg?s=24&d=https%3A%2F%2Fslack.global.ssl.fastly.net%2F66f9%2Fimg%2Favatars%2Fava_0017-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/99621cbca6ea94706a8f5dcdc5e8af4a.jpg?s=32&d=https%3A%2F%2Fslack.global.ssl.fastly.net%2F66f9%2Fimg%2Favatars%2Fava_0017-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/99621cbca6ea94706a8f5dcdc5e8af4a.jpg?s=48&d=https%3A%2F%2Fslack.global.ssl.fastly.net%2F66f9%2Fimg%2Favatars%2Fava_0017-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/99621cbca6ea94706a8f5dcdc5e8af4a.jpg?s=72&d=https%3A%2F%2Fslack.global.ssl.fastly.net%2F66f9%2Fimg%2Favatars%2Fava_0017-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/99621cbca6ea94706a8f5dcdc5e8af4a.jpg?s=192&d=https%3A%2F%2Fslack.global.ssl.fastly.net%2F7fa9%2Fimg%2Favatars%2Fava_0017-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/99621cbca6ea94706a8f5dcdc5e8af4a.jpg?s=512&d=https%3A%2F%2Fslack.global.ssl.fastly.net%2F7fa9%2Fimg%2Favatars%2Fava_0017-512.png"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"presence":"away"},{"id":"U04KB5WQR","team_id":"T04KB5WQH","name":"example","deleted":false,"status":null,"color":"9f69e7","real_name":"","tz":"America\/Indiana\/Indianapolis","tz_label":"Eastern
|
64
|
+
Standard Time","tz_offset":-18000,"profile":{"real_name":"","real_name_normalized":"","email":"user@example.org","image_24":"https:\/\/secure.gravatar.com\/avatar\/3d925b45ac07ec0ae5bd04888f6c5b61.jpg?s=24&d=https%3A%2F%2Fslack.global.ssl.fastly.net%2F66f9%2Fimg%2Favatars%2Fava_0015-24.png","image_32":"https:\/\/secure.gravatar.com\/avatar\/3d925b45ac07ec0ae5bd04888f6c5b61.jpg?s=32&d=https%3A%2F%2Fslack.global.ssl.fastly.net%2F66f9%2Fimg%2Favatars%2Fava_0015-32.png","image_48":"https:\/\/secure.gravatar.com\/avatar\/3d925b45ac07ec0ae5bd04888f6c5b61.jpg?s=48&d=https%3A%2F%2Fslack.global.ssl.fastly.net%2F66f9%2Fimg%2Favatars%2Fava_0015-48.png","image_72":"https:\/\/secure.gravatar.com\/avatar\/3d925b45ac07ec0ae5bd04888f6c5b61.jpg?s=72&d=https%3A%2F%2Fslack.global.ssl.fastly.net%2F66f9%2Fimg%2Favatars%2Fava_0015-72.png","image_192":"https:\/\/secure.gravatar.com\/avatar\/3d925b45ac07ec0ae5bd04888f6c5b61.jpg?s=192&d=https%3A%2F%2Fslack.global.ssl.fastly.net%2F7fa9%2Fimg%2Favatars%2Fava_0015-192.png","image_512":"https:\/\/secure.gravatar.com\/avatar\/3d925b45ac07ec0ae5bd04888f6c5b61.jpg?s=512&d=https%3A%2F%2Fslack.global.ssl.fastly.net%2F7fa9%2Fimg%2Favatars%2Fava_0015-512.png"},"is_admin":true,"is_owner":true,"is_primary_owner":true,"is_restricted":false,"is_ultra_restricted":false,"is_bot":false,"presence":"active"},{"id":"U04JZBDQQ","team_id":"T04KB5WQH","name":"foo","deleted":true,"profile":{"bot_id":"B04JZBDQC","image_24":"https:\/\/avatars.slack-edge.com\/2015-04-28\/4645387956_44604ca32e800d947f22_24.jpg","image_32":"https:\/\/avatars.slack-edge.com\/2015-04-28\/4645387956_44604ca32e800d947f22_32.jpg","image_48":"https:\/\/avatars.slack-edge.com\/2015-04-28\/4645387956_44604ca32e800d947f22_48.jpg","image_72":"https:\/\/avatars.slack-edge.com\/2015-04-28\/4645387956_44604ca32e800d947f22_72.jpg","image_192":"https:\/\/avatars.slack-edge.com\/2015-04-28\/4645387956_44604ca32e800d947f22_192.jpg","image_original":"https:\/\/avatars.slack-edge.com\/2015-04-28\/4645387956_44604ca32e800d947f22_original.jpg","real_name":"","real_name_normalized":""},"is_bot":true,"presence":"away"},{"id":"U04JPQ0JS","team_id":"T04KB5WQH","name":"gamebot","deleted":false,"status":null,"color":"4bbe2e","real_name":"Game
|
65
|
+
Bot","tz":null,"tz_label":"Pacific Standard Time","tz_offset":-28800,"profile":{"bot_id":"B04JPQ0JE","image_24":"https:\/\/avatars.slack-edge.com\/2015-04-28\/4635825662_28d3661bf00dc6013442_24.jpg","image_32":"https:\/\/avatars.slack-edge.com\/2015-04-28\/4635825662_28d3661bf00dc6013442_32.jpg","image_48":"https:\/\/avatars.slack-edge.com\/2015-04-28\/4635825662_28d3661bf00dc6013442_48.jpg","image_72":"https:\/\/avatars.slack-edge.com\/2015-04-28\/4635825662_28d3661bf00dc6013442_48.jpg","image_192":"https:\/\/avatars.slack-edge.com\/2015-04-28\/4635825662_28d3661bf00dc6013442_48.jpg","image_original":"https:\/\/avatars.slack-edge.com\/2015-04-28\/4635825662_28d3661bf00dc6013442_original.jpg","first_name":"Game","last_name":"Bot","title":"Game
|
66
|
+
ons.","real_name":"Game Bot","real_name_normalized":"Game Bot"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"presence":"away"},{"id":"U06JGTU5V","team_id":"T04KB5WQH","name":"mathbot","deleted":false,"status":null,"color":"3c989f","real_name":"Math
|
67
|
+
Bot","tz":null,"tz_label":"Pacific Standard Time","tz_offset":-28800,"profile":{"bot_id":"B06JH1N93","image_24":"https:\/\/avatars.slack-edge.com\/2015-06-19\/6629501812_c507c80d735dfc75bbc8_24.jpg","image_32":"https:\/\/avatars.slack-edge.com\/2015-06-19\/6629501812_c507c80d735dfc75bbc8_32.jpg","image_48":"https:\/\/avatars.slack-edge.com\/2015-06-19\/6629501812_c507c80d735dfc75bbc8_48.jpg","image_72":"https:\/\/avatars.slack-edge.com\/2015-06-19\/6629501812_c507c80d735dfc75bbc8_48.jpg","image_192":"https:\/\/avatars.slack-edge.com\/2015-06-19\/6629501812_c507c80d735dfc75bbc8_48.jpg","image_original":"https:\/\/avatars.slack-edge.com\/2015-06-19\/6629501812_c507c80d735dfc75bbc8_original.jpg","first_name":"Math","last_name":"Bot","real_name":"Math
|
68
|
+
Bot","real_name_normalized":"Math Bot"},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"presence":"away"},{"id":"U07518DTL","team_id":"T04KB5WQH","name":"rubybot","deleted":false,"status":null,"color":"674b1b","real_name":"","tz":null,"tz_label":"Pacific
|
69
|
+
Standard Time","tz_offset":-28800,"profile":{"bot_id":"B0751JU2H","image_24":"https:\/\/avatars.slack-edge.com\/2015-07-02\/7171641589_359bf095c1fe0841e582_24.jpg","image_32":"https:\/\/avatars.slack-edge.com\/2015-07-02\/7171641589_359bf095c1fe0841e582_32.jpg","image_48":"https:\/\/avatars.slack-edge.com\/2015-07-02\/7171641589_359bf095c1fe0841e582_48.jpg","image_72":"https:\/\/avatars.slack-edge.com\/2015-07-02\/7171641589_359bf095c1fe0841e582_48.jpg","image_192":"https:\/\/avatars.slack-edge.com\/2015-07-02\/7171641589_359bf095c1fe0841e582_48.jpg","image_original":"https:\/\/avatars.slack-edge.com\/2015-07-02\/7171641589_359bf095c1fe0841e582_original.jpg","real_name":"","real_name_normalized":""},"is_admin":false,"is_owner":false,"is_primary_owner":false,"is_restricted":false,"is_ultra_restricted":false,"is_bot":true,"presence":"away"}]}'
|
70
|
+
http_version:
|
71
|
+
recorded_at: Sun, 06 Dec 2015 20:18:46 GMT
|
72
|
+
- request:
|
73
|
+
method: post
|
74
|
+
uri: https://slack.com/api/users.info
|
75
|
+
body:
|
76
|
+
encoding: UTF-8
|
77
|
+
string: token=token
|
78
|
+
headers:
|
79
|
+
Accept:
|
80
|
+
- application/json; charset=utf-8
|
81
|
+
User-Agent:
|
82
|
+
- Slack Ruby Client/0.5.4
|
83
|
+
Content-Type:
|
84
|
+
- application/x-www-form-urlencoded
|
85
|
+
Accept-Encoding:
|
86
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
87
|
+
response:
|
88
|
+
status:
|
89
|
+
code: 200
|
90
|
+
message: OK
|
91
|
+
headers:
|
92
|
+
Access-Control-Allow-Origin:
|
93
|
+
- '*'
|
94
|
+
Cache-Control:
|
95
|
+
- private, no-cache, no-store, must-revalidate
|
96
|
+
Content-Security-Policy:
|
97
|
+
- referrer no-referrer;
|
98
|
+
Content-Type:
|
99
|
+
- application/json; charset=utf-8
|
100
|
+
Date:
|
101
|
+
- Fri, 22 Jan 2016 19:17:18 GMT
|
102
|
+
Expires:
|
103
|
+
- Mon, 26 Jul 1997 05:00:00 GMT
|
104
|
+
Pragma:
|
105
|
+
- no-cache
|
106
|
+
Server:
|
107
|
+
- Apache
|
108
|
+
Strict-Transport-Security:
|
109
|
+
- max-age=31536000; includeSubDomains; preload
|
110
|
+
Vary:
|
111
|
+
- Accept-Encoding
|
112
|
+
X-Accepted-Oauth-Scopes:
|
113
|
+
- users:read,read
|
114
|
+
X-Content-Type-Options:
|
115
|
+
- nosniff
|
116
|
+
X-Oauth-Scopes:
|
117
|
+
- identify,read,post,client
|
118
|
+
X-Xss-Protection:
|
119
|
+
- '0'
|
120
|
+
Content-Length:
|
121
|
+
- '287'
|
122
|
+
Connection:
|
123
|
+
- keep-alive
|
124
|
+
body:
|
125
|
+
encoding: UTF-8
|
126
|
+
string: '{"ok":true,"user":{"id":"U07KECJ77","team_id":"T04KB5WQH","name":"aws","deleted":true,"profile":{"bot_id":"B07KECJ6R","image_24":"https:\/\/avatars.slack-edge.com\/2015-07-14\/7660472085_4755a86e204c9706c84f_24.jpg","image_32":"https:\/\/avatars.slack-edge.com\/2015-07-14\/7660472085_4755a86e204c9706c84f_32.jpg","image_48":"https:\/\/avatars.slack-edge.com\/2015-07-14\/7660472085_4755a86e204c9706c84f_48.jpg","image_72":"https:\/\/avatars.slack-edge.com\/2015-07-14\/7660472085_4755a86e204c9706c84f_48.jpg","image_192":"https:\/\/avatars.slack-edge.com\/2015-07-14\/7660472085_4755a86e204c9706c84f_48.jpg","image_original":"https:\/\/avatars.slack-edge.com\/2015-07-14\/7660472085_4755a86e204c9706c84f_original.jpg","first_name":"AWS","last_name":"Cloud","real_name":"AWS
|
127
|
+
Cloud","real_name_normalized":"AWS Cloud"},"is_bot":true}}'
|
128
|
+
http_version:
|
129
|
+
recorded_at: Fri, 22 Jan 2016 19:17:18 GMT
|
130
|
+
recorded_with: VCR 3.0.1
|
@@ -69,11 +69,15 @@ RSpec.describe 'integration test', skip: !ENV['SLACK_API_TOKEN'] && 'missing SLA
|
|
69
69
|
start_server
|
70
70
|
end
|
71
71
|
|
72
|
+
let(:channel) { "@#{client.self['name']}" }
|
73
|
+
|
72
74
|
it 'responds to message' do
|
73
75
|
message = SecureRandom.hex
|
74
76
|
|
75
77
|
client.on :message do |data|
|
76
78
|
logger.debug data
|
79
|
+
# concurrent execution of tests causes messages to arrive in any order
|
80
|
+
next unless data['text'] == message
|
77
81
|
expect(data['text']).to eq message
|
78
82
|
expect(data['subtype']).to eq 'bot_message'
|
79
83
|
logger.debug 'client.stop!'
|
@@ -81,8 +85,13 @@ RSpec.describe 'integration test', skip: !ENV['SLACK_API_TOKEN'] && 'missing SLA
|
|
81
85
|
client.stop!
|
82
86
|
end
|
83
87
|
|
84
|
-
logger.debug "chat_postMessage, channel
|
85
|
-
client.web_client.chat_postMessage channel:
|
88
|
+
logger.debug "chat_postMessage, channel=#{channel}, message=#{message}"
|
89
|
+
client.web_client.chat_postMessage channel: channel, text: message
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'sends message' do
|
93
|
+
client.message(channel: channel, text: 'Hello world!')
|
94
|
+
client.stop!
|
86
95
|
end
|
87
96
|
end
|
88
97
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Slack::Web::Api::Endpoints::Channels do
|
4
|
+
let(:client) { Slack::Web::Client.new }
|
5
|
+
context 'channels' do
|
6
|
+
it 'info', vcr: { cassette_name: 'web/channels_info' } do
|
7
|
+
json = client.channels_info(channel: '#general')
|
8
|
+
expect(json['channel']['name']).to eq 'general'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Slack::Web::Api::Endpoints::Groups do
|
4
|
+
let(:client) { Slack::Web::Client.new }
|
5
|
+
context 'groups' do
|
6
|
+
it 'info', vcr: { cassette_name: 'web/groups_info' } do
|
7
|
+
json = client.groups_info(channel: '#mpdm-dblock--rubybot--player1-1')
|
8
|
+
expect(json['group']['name']).to eq 'mpdm-dblock--rubybot--player1-1'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -9,5 +9,9 @@ RSpec.describe Slack::Web::Api::Endpoints::Users do
|
|
9
9
|
expect(json['members'].size).to eq 9
|
10
10
|
expect(json['members'].first['presence']).to eq 'away'
|
11
11
|
end
|
12
|
+
it 'info', vcr: { cassette_name: 'web/users_info' } do
|
13
|
+
json = client.users_info(user: '@aws')
|
14
|
+
expect(json['user']['name']).to eq 'aws'
|
15
|
+
end
|
12
16
|
end
|
13
17
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Slack::Web::Api::Mixins::Channels do
|
4
|
+
let(:klass) do
|
5
|
+
Class.new do
|
6
|
+
include Slack::Web::Api::Mixins::Channels
|
7
|
+
end
|
8
|
+
end
|
9
|
+
subject do
|
10
|
+
klass.new
|
11
|
+
end
|
12
|
+
before do
|
13
|
+
allow(subject).to receive(:channels_list).and_return(
|
14
|
+
'channels' => [{
|
15
|
+
'id' => 'CDEADBEEF',
|
16
|
+
'name' => 'general'
|
17
|
+
}]
|
18
|
+
)
|
19
|
+
end
|
20
|
+
context '#channels_id' do
|
21
|
+
it 'leaves channels specified by ID alone' do
|
22
|
+
expect(subject.channels_id(channel: 'C123456')).to eq('ok' => true, 'channel' => { 'id' => 'C123456' })
|
23
|
+
end
|
24
|
+
it 'translates a channel that starts with a #' do
|
25
|
+
expect(subject.channels_id(channel: '#general')).to eq('ok' => true, 'channel' => { 'id' => 'CDEADBEEF' })
|
26
|
+
end
|
27
|
+
it 'fails with an exception' do
|
28
|
+
expect { subject.channels_id(channel: '#invalid') }.to raise_error Slack::Web::Api::Error, 'channel_not_found'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Slack::Web::Api::Mixins::Groups do
|
4
|
+
let(:klass) do
|
5
|
+
Class.new do
|
6
|
+
include Slack::Web::Api::Mixins::Groups
|
7
|
+
end
|
8
|
+
end
|
9
|
+
subject do
|
10
|
+
klass.new
|
11
|
+
end
|
12
|
+
before do
|
13
|
+
allow(subject).to receive(:groups_list).and_return(
|
14
|
+
'groups' => [{
|
15
|
+
'id' => 'CDEADBEEF',
|
16
|
+
'name' => 'general'
|
17
|
+
}]
|
18
|
+
)
|
19
|
+
end
|
20
|
+
context '#groups_id' do
|
21
|
+
it 'leaves groups specified by ID alone' do
|
22
|
+
expect(subject.groups_id(channel: 'C123456')).to eq('ok' => true, 'group' => { 'id' => 'C123456' })
|
23
|
+
end
|
24
|
+
it 'translates a channel that starts with a #' do
|
25
|
+
expect(subject.groups_id(channel: '#general')).to eq('ok' => true, 'group' => { 'id' => 'CDEADBEEF' })
|
26
|
+
end
|
27
|
+
it 'fails with an exception' do
|
28
|
+
expect { subject.groups_id(channel: '#invalid') }.to raise_error Slack::Web::Api::Error, 'channel_not_found'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Slack::Web::Api::Mixins::Users do
|
4
|
+
let(:klass) do
|
5
|
+
Class.new do
|
6
|
+
include Slack::Web::Api::Mixins::Users
|
7
|
+
end
|
8
|
+
end
|
9
|
+
subject do
|
10
|
+
klass.new
|
11
|
+
end
|
12
|
+
before do
|
13
|
+
allow(subject).to receive(:users_list).and_return(
|
14
|
+
'members' => [{
|
15
|
+
'id' => 'UDEADBEEF',
|
16
|
+
'name' => 'aws'
|
17
|
+
}]
|
18
|
+
)
|
19
|
+
end
|
20
|
+
context '#users_id' do
|
21
|
+
it 'leaves users specified by ID alone' do
|
22
|
+
expect(subject.users_id(user: 'U123456')).to eq('ok' => true, 'user' => { 'id' => 'U123456' })
|
23
|
+
end
|
24
|
+
it 'translates a user that starts with a #' do
|
25
|
+
expect(subject.users_id(user: '@aws')).to eq('ok' => true, 'user' => { 'id' => 'UDEADBEEF' })
|
26
|
+
end
|
27
|
+
it 'fails with an exception' do
|
28
|
+
expect { subject.users_id(user: '@foo') }.to raise_error Slack::Web::Api::Error, 'user_not_found'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
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.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Doubrovkine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -270,6 +270,13 @@ files:
|
|
270
270
|
- lib/slack/web/api/endpoints/usergroups.rb
|
271
271
|
- lib/slack/web/api/endpoints/users.rb
|
272
272
|
- lib/slack/web/api/error.rb
|
273
|
+
- lib/slack/web/api/mixins.rb
|
274
|
+
- lib/slack/web/api/mixins/channels.id.json
|
275
|
+
- lib/slack/web/api/mixins/channels.id.rb
|
276
|
+
- lib/slack/web/api/mixins/groups.id.json
|
277
|
+
- lib/slack/web/api/mixins/groups.id.rb
|
278
|
+
- lib/slack/web/api/mixins/users.id.json
|
279
|
+
- lib/slack/web/api/mixins/users.id.rb
|
273
280
|
- lib/slack/web/api/patches/chat.1.text-attachments-required.patch
|
274
281
|
- lib/slack/web/api/patches/chat.2.attachments-json.patch
|
275
282
|
- lib/slack/web/api/schema/group.json
|
@@ -291,7 +298,10 @@ files:
|
|
291
298
|
- spec/fixtures/slack/web/429_error.yml
|
292
299
|
- spec/fixtures/slack/web/auth_test_error.yml
|
293
300
|
- spec/fixtures/slack/web/auth_test_success.yml
|
301
|
+
- spec/fixtures/slack/web/channels_info.yml
|
302
|
+
- spec/fixtures/slack/web/groups_info.yml
|
294
303
|
- spec/fixtures/slack/web/rtm_start.yml
|
304
|
+
- spec/fixtures/slack/web/users_info.yml
|
295
305
|
- spec/fixtures/slack/web/users_list.yml
|
296
306
|
- spec/integration/integration_spec.rb
|
297
307
|
- spec/slack/config_spec.rb
|
@@ -305,9 +315,14 @@ files:
|
|
305
315
|
- spec/slack/slack_spec.rb
|
306
316
|
- spec/slack/version_spec.rb
|
307
317
|
- spec/slack/web/api/endpoints/auth_spec.rb
|
318
|
+
- spec/slack/web/api/endpoints/channels_spec.rb
|
308
319
|
- spec/slack/web/api/endpoints/chat_spec.rb
|
320
|
+
- spec/slack/web/api/endpoints/groups_spec.rb
|
309
321
|
- spec/slack/web/api/endpoints/users_spec.rb
|
310
322
|
- spec/slack/web/api/error_spec.rb
|
323
|
+
- spec/slack/web/api/mixins/channels_spec.rb
|
324
|
+
- spec/slack/web/api/mixins/groups_spec.rb
|
325
|
+
- spec/slack/web/api/mixins/users_spec.rb
|
311
326
|
- spec/slack/web/client_spec.rb
|
312
327
|
- spec/spec_helper.rb
|
313
328
|
- spec/support/queue_with_timeout.rb
|
@@ -343,7 +358,10 @@ test_files:
|
|
343
358
|
- spec/fixtures/slack/web/429_error.yml
|
344
359
|
- spec/fixtures/slack/web/auth_test_error.yml
|
345
360
|
- spec/fixtures/slack/web/auth_test_success.yml
|
361
|
+
- spec/fixtures/slack/web/channels_info.yml
|
362
|
+
- spec/fixtures/slack/web/groups_info.yml
|
346
363
|
- spec/fixtures/slack/web/rtm_start.yml
|
364
|
+
- spec/fixtures/slack/web/users_info.yml
|
347
365
|
- spec/fixtures/slack/web/users_list.yml
|
348
366
|
- spec/integration/integration_spec.rb
|
349
367
|
- spec/slack/config_spec.rb
|
@@ -357,9 +375,14 @@ test_files:
|
|
357
375
|
- spec/slack/slack_spec.rb
|
358
376
|
- spec/slack/version_spec.rb
|
359
377
|
- spec/slack/web/api/endpoints/auth_spec.rb
|
378
|
+
- spec/slack/web/api/endpoints/channels_spec.rb
|
360
379
|
- spec/slack/web/api/endpoints/chat_spec.rb
|
380
|
+
- spec/slack/web/api/endpoints/groups_spec.rb
|
361
381
|
- spec/slack/web/api/endpoints/users_spec.rb
|
362
382
|
- spec/slack/web/api/error_spec.rb
|
383
|
+
- spec/slack/web/api/mixins/channels_spec.rb
|
384
|
+
- spec/slack/web/api/mixins/groups_spec.rb
|
385
|
+
- spec/slack/web/api/mixins/users_spec.rb
|
363
386
|
- spec/slack/web/client_spec.rb
|
364
387
|
- spec/spec_helper.rb
|
365
388
|
- spec/support/queue_with_timeout.rb
|