slack-ruby-client 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +0 -1
  3. data/.rubocop_todo.yml +23 -6
  4. data/.travis.yml +3 -0
  5. data/CHANGELOG.md +11 -0
  6. data/Gemfile +2 -0
  7. data/README.md +89 -1
  8. data/RELEASING.md +3 -1
  9. data/UPGRADING.md +26 -0
  10. data/bin/commands.rb +20 -0
  11. data/bin/commands/api.rb +14 -0
  12. data/bin/commands/auth.rb +12 -0
  13. data/bin/commands/channels.rb +140 -0
  14. data/bin/commands/chat.rb +47 -0
  15. data/bin/commands/emoji.rb +12 -0
  16. data/bin/commands/files.rb +61 -0
  17. data/bin/commands/groups.rb +158 -0
  18. data/bin/commands/im.rb +53 -0
  19. data/bin/commands/mpim.rb +53 -0
  20. data/bin/commands/oauth.rb +16 -0
  21. data/bin/commands/pins.rb +37 -0
  22. data/bin/commands/reactions.rb +53 -0
  23. data/bin/commands/rtm.rb +15 -0
  24. data/bin/commands/search.rb +40 -0
  25. data/bin/commands/stars.rb +37 -0
  26. data/bin/commands/team.rb +32 -0
  27. data/bin/commands/usergroups.rb +73 -0
  28. data/bin/commands/users.rb +48 -0
  29. data/bin/slack +50 -0
  30. data/examples/hi_real_time/Gemfile +2 -0
  31. data/examples/hi_real_time_and_web/Gemfile +2 -0
  32. data/examples/hi_real_time_async/Gemfile +5 -0
  33. data/examples/hi_real_time_async/hi.rb +29 -0
  34. data/lib/slack-ruby-client.rb +2 -2
  35. data/lib/slack/real_time/client.rb +72 -30
  36. data/lib/slack/real_time/concurrency.rb +8 -0
  37. data/lib/slack/real_time/concurrency/celluloid.rb +92 -0
  38. data/lib/slack/real_time/concurrency/eventmachine.rb +39 -0
  39. data/lib/slack/real_time/config.rb +23 -1
  40. data/lib/slack/real_time/socket.rb +50 -12
  41. data/lib/slack/version.rb +1 -1
  42. data/lib/slack/web/api/endpoints.rb +2 -0
  43. data/lib/slack/web/api/endpoints/groups.rb +1 -1
  44. data/lib/slack/web/api/endpoints/team.rb +1 -1
  45. data/lib/slack/web/api/endpoints/usergroups.rb +113 -0
  46. data/lib/slack/web/api/error.rb +6 -0
  47. data/lib/slack/web/api/schema/group.json +14 -0
  48. data/lib/slack/web/api/tasks/generate.rake +19 -3
  49. data/lib/slack/web/api/templates/command.erb +34 -0
  50. data/lib/slack/web/api/templates/commands.erb +5 -0
  51. data/lib/slack/web/config.rb +2 -0
  52. data/lib/slack/web/faraday/connection.rb +3 -2
  53. data/lib/slack/web/faraday/response/raise_error.rb +2 -1
  54. data/slack-ruby-client.gemspec +4 -2
  55. data/spec/fixtures/slack/web/429_error.yml +83 -0
  56. data/spec/fixtures/slack/web/rtm_start.yml +1 -1
  57. data/spec/fixtures/slack/web/users_list.yml +72 -0
  58. data/spec/integration/integration_spec.rb +88 -0
  59. data/spec/slack/real_time/client_spec.rb +8 -5
  60. data/spec/slack/real_time/concurrency/celluloid_spec.rb +58 -0
  61. data/spec/slack/real_time/concurrency/eventmachine_spec.rb +49 -0
  62. data/spec/slack/slack_spec.rb +52 -0
  63. data/spec/slack/web/api/endpoints/auth_spec.rb +6 -1
  64. data/spec/slack/web/api/endpoints/users_spec.rb +13 -0
  65. data/spec/slack/web/api/error_spec.rb +14 -0
  66. data/spec/slack/web/client_spec.rb +16 -0
  67. data/spec/support/real_time/concurrency/mock.rb +31 -0
  68. data/spec/support/real_time/connected_client.rb +5 -2
  69. metadata +55 -8
  70. data/spec/slack/real_time/socket_spec.rb +0 -46
@@ -0,0 +1,47 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ desc 'Post chat messages to Slack.'
4
+ command 'chat' do |g|
5
+ g.desc 'This method deletes a message from a channel.'
6
+ g.long_desc %( This method deletes a message from a channel. )
7
+ g.command 'delete' do |c|
8
+ c.flag 'ts', desc: 'Timestamp of the message to be deleted.'
9
+ c.flag 'channel', desc: 'Channel containing the message to be deleted.'
10
+ c.action do |_global_options, options, _args|
11
+ puts JSON.dump($client.chat_delete(options))
12
+ end
13
+ end
14
+
15
+ g.desc 'This method posts a message to a public channel, private group, or IM channel.'
16
+ g.long_desc %( This method posts a message to a public channel, private group, or IM channel. )
17
+ g.command 'postMessage' do |c|
18
+ c.flag 'channel', desc: 'Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.'
19
+ c.flag 'text', desc: 'Text of the message to send. See below for an explanation of formatting.'
20
+ c.flag 'username', desc: 'Name of bot.'
21
+ c.flag 'as_user', desc: 'Pass true to post the message as the authed user, instead of as a bot.'
22
+ c.flag 'parse', desc: 'Change how messages are treated. See below.'
23
+ c.flag 'link_names', desc: 'Find and link channel names and usernames.'
24
+ c.flag 'attachments', desc: 'Structured message attachments.'
25
+ c.flag 'unfurl_links', desc: 'Pass true to enable unfurling of primarily text-based content.'
26
+ c.flag 'unfurl_media', desc: 'Pass false to disable unfurling of media content.'
27
+ c.flag 'icon_url', desc: 'URL to an image to use as the icon for this message.'
28
+ c.flag 'icon_emoji', desc: 'emoji to use as the icon for this message. Overrides icon_url.'
29
+ c.action do |_global_options, options, _args|
30
+ puts JSON.dump($client.chat_postMessage(options))
31
+ end
32
+ end
33
+
34
+ g.desc 'This method updates a message in a channel.'
35
+ g.long_desc %( This method updates a message in a channel. )
36
+ g.command 'update' do |c|
37
+ c.flag 'ts', desc: 'Timestamp of the message to be updated.'
38
+ c.flag 'channel', desc: 'Channel containing the message to be updated.'
39
+ c.flag 'text', desc: 'New text for the message, using the default formatting rules.'
40
+ c.flag 'attachments', desc: 'Structured message attachments.'
41
+ c.flag 'parse', desc: 'Change how messages are treated. See below.'
42
+ c.flag 'link_names', desc: 'Find and link channel names and usernames.'
43
+ c.action do |_global_options, options, _args|
44
+ puts JSON.dump($client.chat_update(options))
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,12 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ desc 'Emoji methods.'
4
+ command 'emoji' do |g|
5
+ g.desc 'This method lists the custom emoji for a team.'
6
+ g.long_desc %( This method lists the custom emoji for a team. )
7
+ g.command 'list' do |c|
8
+ c.action do |_global_options, options, _args|
9
+ puts JSON.dump($client.emoji_list(options))
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,61 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ desc 'Get info on files uploaded to Slack, upload new files to Slack.'
4
+ command 'files' do |g|
5
+ g.desc 'This method deletes a file from your team.'
6
+ g.long_desc %( This method deletes a file from your team. )
7
+ g.command 'delete' do |c|
8
+ c.flag 'file', desc: 'ID of file to delete.'
9
+ c.action do |_global_options, options, _args|
10
+ puts JSON.dump($client.files_delete(options))
11
+ end
12
+ end
13
+
14
+ g.desc 'This method returns information about a file in your team.'
15
+ g.long_desc %( This method returns information about a file in your team. )
16
+ g.command 'info' do |c|
17
+ c.flag 'file', desc: 'File to fetch info for.'
18
+ c.action do |_global_options, options, _args|
19
+ puts JSON.dump($client.files_info(options))
20
+ end
21
+ end
22
+
23
+ g.desc 'This method returns a list of files within the team. It can be filtered and sliced in various ways.'
24
+ g.long_desc %( This method returns a list of files within the team. It can be filtered and sliced in various ways. )
25
+ g.command 'list' do |c|
26
+ c.flag 'user', desc: 'Filter files created by a single user.'
27
+ c.flag 'ts_from', desc: 'Filter files created after this timestamp (inclusive).'
28
+ c.flag 'ts_to', desc: 'Filter files created before this timestamp (inclusive).'
29
+ c.flag 'types', desc: 'Filter files by type:
30
+
31
+ all - All files
32
+ posts - Posts
33
+ snippets - Snippets
34
+ images - Image files
35
+ gdocs - Google docs
36
+ zips - Zip files
37
+ pdfs - PDF files
38
+
39
+
40
+ You can pass multiple values in the types argument, like types=posts,snippets.The default value is all, which does not filter the list.
41
+ .'
42
+ c.action do |_global_options, options, _args|
43
+ puts JSON.dump($client.files_list(options))
44
+ end
45
+ end
46
+
47
+ g.desc 'This method allows you to create or upload an existing file.'
48
+ g.long_desc %( This method allows you to create or upload an existing file. )
49
+ g.command 'upload' do |c|
50
+ c.flag 'file', desc: 'File contents via multipart/form-data.'
51
+ c.flag 'content', desc: 'File contents via a POST var.'
52
+ c.flag 'filetype', desc: 'Slack-internal file type identifier.'
53
+ c.flag 'filename', desc: 'Filename of file.'
54
+ c.flag 'title', desc: 'Title of file.'
55
+ c.flag 'initial_comment', desc: 'Initial comment to add to file.'
56
+ c.flag 'channels', desc: 'Comma separated list of channels to share the file into.'
57
+ c.action do |_global_options, options, _args|
58
+ puts JSON.dump($client.files_upload(options))
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,158 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ desc "Get info on your team's private groups."
4
+ command 'groups' do |g|
5
+ g.desc 'This method archives a private group.'
6
+ g.long_desc %( This method archives a private group. )
7
+ g.command 'archive' do |c|
8
+ c.flag 'channel', desc: 'Private group to archive.'
9
+ c.action do |_global_options, options, _args|
10
+ puts JSON.dump($client.groups_archive(options))
11
+ end
12
+ end
13
+
14
+ g.desc 'This method closes a private group.'
15
+ g.long_desc %( This method closes a private group. )
16
+ g.command 'close' do |c|
17
+ c.flag 'channel', desc: 'Group to close.'
18
+ c.action do |_global_options, options, _args|
19
+ puts JSON.dump($client.groups_close(options))
20
+ end
21
+ end
22
+
23
+ g.desc 'This method creates a private group.'
24
+ g.long_desc %( This method creates a private group. )
25
+ g.command 'create' do |c|
26
+ c.flag 'name', desc: 'Name of group to create.'
27
+ c.action do |_global_options, options, _args|
28
+ puts JSON.dump($client.groups_create(options))
29
+ end
30
+ end
31
+
32
+ g.desc 'This method takes an existing private group and performs the following steps:'
33
+ g.long_desc %( This method takes an existing private group and performs the following steps: )
34
+ g.command 'createChild' do |c|
35
+ c.flag 'channel', desc: 'Group to clone and archive.'
36
+ c.action do |_global_options, options, _args|
37
+ puts JSON.dump($client.groups_createChild(options))
38
+ end
39
+ end
40
+
41
+ g.desc 'This method returns a portion of messages/events from the specified private group.'
42
+ g.long_desc %( This method returns a portion of messages/events from the specified private group. To read the entire history for a group, call the method with no latest or oldest arguments, and then continue paging using the instructions below. )
43
+ g.command 'history' do |c|
44
+ c.flag 'channel', desc: 'Group to fetch history for.'
45
+ c.flag 'latest', desc: 'End of time range of messages to include in results.'
46
+ c.flag 'oldest', desc: 'Start of time range of messages to include in results.'
47
+ c.flag 'inclusive', desc: 'Include messages with latest or oldest timestamp in results.'
48
+ c.flag 'unreads', desc: 'Include unread_count_display in the output?.'
49
+ c.action do |_global_options, options, _args|
50
+ puts JSON.dump($client.groups_history(options))
51
+ end
52
+ end
53
+
54
+ g.desc 'This method returns information about a private group.'
55
+ g.long_desc %( This method returns information about a private group. )
56
+ g.command 'info' do |c|
57
+ c.flag 'channel', desc: 'Group to get info on.'
58
+ c.action do |_global_options, options, _args|
59
+ puts JSON.dump($client.groups_info(options))
60
+ end
61
+ end
62
+
63
+ g.desc 'This method is used to invite a user to a private group. The calling user must be a member of the group.'
64
+ g.long_desc %( This method is used to invite a user to a private group. The calling user must be a member of the group. )
65
+ g.command 'invite' do |c|
66
+ c.flag 'channel', desc: 'Private group to invite user to.'
67
+ c.flag 'user', desc: 'User to invite.'
68
+ c.action do |_global_options, options, _args|
69
+ puts JSON.dump($client.groups_invite(options))
70
+ end
71
+ end
72
+
73
+ g.desc 'This method allows a user to remove another member from a private group.'
74
+ g.long_desc %( This method allows a user to remove another member from a private group. )
75
+ g.command 'kick' do |c|
76
+ c.flag 'channel', desc: 'Group to remove user from.'
77
+ c.flag 'user', desc: 'User to remove from group.'
78
+ c.action do |_global_options, options, _args|
79
+ puts JSON.dump($client.groups_kick(options))
80
+ end
81
+ end
82
+
83
+ g.desc 'This method is used to leave a private group.'
84
+ g.long_desc %( This method is used to leave a private group. )
85
+ g.command 'leave' do |c|
86
+ c.flag 'channel', desc: 'Group to leave.'
87
+ c.action do |_global_options, options, _args|
88
+ puts JSON.dump($client.groups_leave(options))
89
+ end
90
+ end
91
+
92
+ g.desc 'This method returns a list of groups in the team that the caller is in and archived groups that the caller was in.'
93
+ g.long_desc %( This method returns a list of groups in the team that the caller is in and archived groups that the caller was in. The list of (non-deactivated) members in each group is also returned. )
94
+ g.command 'list' do |c|
95
+ c.flag 'exclude_archived', desc: "Don't return archived groups."
96
+ c.action do |_global_options, options, _args|
97
+ puts JSON.dump($client.groups_list(options))
98
+ end
99
+ end
100
+
101
+ g.desc 'This method moves the read cursor in a private group.'
102
+ g.long_desc %( This method moves the read cursor in a private group. )
103
+ g.command 'mark' do |c|
104
+ c.flag 'channel', desc: 'Group to set reading cursor in.'
105
+ c.flag 'ts', desc: 'Timestamp of the most recently seen message.'
106
+ c.action do |_global_options, options, _args|
107
+ puts JSON.dump($client.groups_mark(options))
108
+ end
109
+ end
110
+
111
+ g.desc 'This method opens a private group.'
112
+ g.long_desc %( This method opens a private group. )
113
+ g.command 'open' do |c|
114
+ c.flag 'channel', desc: 'Group to open.'
115
+ c.action do |_global_options, options, _args|
116
+ puts JSON.dump($client.groups_open(options))
117
+ end
118
+ end
119
+
120
+ g.desc 'This method renames a private group.'
121
+ g.long_desc %( This method renames a private group. )
122
+ g.command 'rename' do |c|
123
+ c.flag 'channel', desc: 'Group to rename.'
124
+ c.flag 'name', desc: 'New name for group.'
125
+ c.action do |_global_options, options, _args|
126
+ puts JSON.dump($client.groups_rename(options))
127
+ end
128
+ end
129
+
130
+ g.desc 'This method is used to change the purpose of a private group. The calling user must be a member of the private group.'
131
+ g.long_desc %( This method is used to change the purpose of a private group. The calling user must be a member of the private group. )
132
+ g.command 'setPurpose' do |c|
133
+ c.flag 'channel', desc: 'Private group to set the purpose of.'
134
+ c.flag 'purpose', desc: 'The new purpose.'
135
+ c.action do |_global_options, options, _args|
136
+ puts JSON.dump($client.groups_setPurpose(options))
137
+ end
138
+ end
139
+
140
+ g.desc 'This method is used to change the topic of a private group. The calling user must be a member of the private group.'
141
+ g.long_desc %( This method is used to change the topic of a private group. The calling user must be a member of the private group. )
142
+ g.command 'setTopic' do |c|
143
+ c.flag 'channel', desc: 'Private group to set the topic of.'
144
+ c.flag 'topic', desc: 'The new topic.'
145
+ c.action do |_global_options, options, _args|
146
+ puts JSON.dump($client.groups_setTopic(options))
147
+ end
148
+ end
149
+
150
+ g.desc 'This method unarchives a private group.'
151
+ g.long_desc %( This method unarchives a private group. )
152
+ g.command 'unarchive' do |c|
153
+ c.flag 'channel', desc: 'Group to unarchive.'
154
+ c.action do |_global_options, options, _args|
155
+ puts JSON.dump($client.groups_unarchive(options))
156
+ end
157
+ end
158
+ end
@@ -0,0 +1,53 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ desc 'Get info on your direct messages.'
4
+ command 'im' do |g|
5
+ g.desc 'This method closes a direct message channel.'
6
+ g.long_desc %( This method closes a direct message channel. )
7
+ g.command 'close' do |c|
8
+ c.flag 'channel', desc: 'Direct message channel to close.'
9
+ c.action do |_global_options, options, _args|
10
+ puts JSON.dump($client.im_close(options))
11
+ end
12
+ end
13
+
14
+ g.desc 'This method returns a portion of messages/events from the specified direct message channel.'
15
+ g.long_desc %( This method returns a portion of messages/events from the specified direct message channel. To read the entire history for a direct message channel, call the method with no latest or oldest arguments, and then continue paging using the instructions below. )
16
+ g.command 'history' do |c|
17
+ c.flag 'channel', desc: 'Direct message channel to fetch history for.'
18
+ c.flag 'latest', desc: 'End of time range of messages to include in results.'
19
+ c.flag 'oldest', desc: 'Start of time range of messages to include in results.'
20
+ c.flag 'inclusive', desc: 'Include messages with latest or oldest timestamp in results.'
21
+ c.flag 'unreads', desc: 'Include unread_count_display in the output?.'
22
+ c.action do |_global_options, options, _args|
23
+ puts JSON.dump($client.im_history(options))
24
+ end
25
+ end
26
+
27
+ g.desc 'This method returns a list of all im channels that the user has.'
28
+ g.long_desc %( This method returns a list of all im channels that the user has. )
29
+ g.command 'list' do |c|
30
+ c.action do |_global_options, options, _args|
31
+ puts JSON.dump($client.im_list(options))
32
+ end
33
+ end
34
+
35
+ g.desc 'This method moves the read cursor in a direct message channel.'
36
+ g.long_desc %( This method moves the read cursor in a direct message channel. )
37
+ g.command 'mark' do |c|
38
+ c.flag 'channel', desc: 'Direct message channel to set reading cursor in.'
39
+ c.flag 'ts', desc: 'Timestamp of the most recently seen message.'
40
+ c.action do |_global_options, options, _args|
41
+ puts JSON.dump($client.im_mark(options))
42
+ end
43
+ end
44
+
45
+ g.desc 'This method opens a direct message channel with another member of your Slack team.'
46
+ g.long_desc %( This method opens a direct message channel with another member of your Slack team. )
47
+ g.command 'open' do |c|
48
+ c.flag 'user', desc: 'User to open a direct message channel with.'
49
+ c.action do |_global_options, options, _args|
50
+ puts JSON.dump($client.im_open(options))
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,53 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ desc 'Get info on your multiparty direct messages.'
4
+ command 'mpim' do |g|
5
+ g.desc 'This method closes a multiparty direct message channel.'
6
+ g.long_desc %( This method closes a multiparty direct message channel. )
7
+ g.command 'close' do |c|
8
+ c.flag 'channel', desc: 'MPIM to close.'
9
+ c.action do |_global_options, options, _args|
10
+ puts JSON.dump($client.mpim_close(options))
11
+ end
12
+ end
13
+
14
+ g.desc 'This method returns a portion of messages/events from the specified multiparty direct message channel.'
15
+ g.long_desc %( This method returns a portion of messages/events from the specified multiparty direct message channel. To read the entire history for a multiparty direct message, call the method with no latest or oldest arguments, and then continue paging using the instructions below. )
16
+ g.command 'history' do |c|
17
+ c.flag 'channel', desc: 'Multiparty direct message to fetch history for.'
18
+ c.flag 'latest', desc: 'End of time range of messages to include in results.'
19
+ c.flag 'oldest', desc: 'Start of time range of messages to include in results.'
20
+ c.flag 'inclusive', desc: 'Include messages with latest or oldest timestamp in results.'
21
+ c.flag 'unreads', desc: 'Include unread_count_display in the output?.'
22
+ c.action do |_global_options, options, _args|
23
+ puts JSON.dump($client.mpim_history(options))
24
+ end
25
+ end
26
+
27
+ g.desc 'This method returns a list of all multiparty direct message channels that the user has.'
28
+ g.long_desc %( This method returns a list of all multiparty direct message channels that the user has. )
29
+ g.command 'list' do |c|
30
+ c.action do |_global_options, options, _args|
31
+ puts JSON.dump($client.mpim_list(options))
32
+ end
33
+ end
34
+
35
+ g.desc 'This method moves the read cursor in a multiparty direct message channel.'
36
+ g.long_desc %( This method moves the read cursor in a multiparty direct message channel. )
37
+ g.command 'mark' do |c|
38
+ c.flag 'channel', desc: 'multiparty direct message channel to set reading cursor in.'
39
+ c.flag 'ts', desc: 'Timestamp of the most recently seen message.'
40
+ c.action do |_global_options, options, _args|
41
+ puts JSON.dump($client.mpim_mark(options))
42
+ end
43
+ end
44
+
45
+ g.desc 'This method opens a multiparty direct message.'
46
+ g.long_desc %( This method opens a multiparty direct message. )
47
+ g.command 'open' do |c|
48
+ c.flag 'users', desc: 'Comma separated lists of users. The ordering of the users is preserved whenever a MPIM group is returned.'
49
+ c.action do |_global_options, options, _args|
50
+ puts JSON.dump($client.mpim_open(options))
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,16 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ desc 'Oauth methods.'
4
+ command 'oauth' do |g|
5
+ g.desc 'This method allows you to exchange a temporary OAuth code for an API access token.'
6
+ g.long_desc %( This method allows you to exchange a temporary OAuth code for an API access token. This is used as part of the OAuth authentication flow. )
7
+ g.command 'access' do |c|
8
+ c.flag 'client_id', desc: 'Issued when you created your application.'
9
+ c.flag 'client_secret', desc: 'Issued when you created your application.'
10
+ c.flag 'code', desc: 'The code param returned via the OAuth callback.'
11
+ c.flag 'redirect_uri', desc: 'This must match the originally submitted URI (if one was sent).'
12
+ c.action do |_global_options, options, _args|
13
+ puts JSON.dump($client.oauth_access(options))
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,37 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ desc 'Pins methods.'
4
+ command 'pins' do |g|
5
+ g.desc 'This method pins an item (file, file comment, channel message, or group message) to a particular channel.'
6
+ g.long_desc %( This method pins an item (file, file comment, channel message, or group message) to a particular channel. The channel argument is required and one of file, file_comment, or timestamp must also be specified. )
7
+ g.command 'add' do |c|
8
+ c.flag 'channel', desc: 'Channel to pin the item in.'
9
+ c.flag 'file', desc: 'File to pin.'
10
+ c.flag 'file_comment', desc: 'File comment to pin.'
11
+ c.flag 'timestamp', desc: 'Timestamp of the message to pin.'
12
+ c.action do |_global_options, options, _args|
13
+ puts JSON.dump($client.pins_add(options))
14
+ end
15
+ end
16
+
17
+ g.desc 'This method lists the items pinned to a channel.'
18
+ g.long_desc %( This method lists the items pinned to a channel. )
19
+ g.command 'list' do |c|
20
+ c.flag 'channel', desc: 'Channel to get pinned items for.'
21
+ c.action do |_global_options, options, _args|
22
+ puts JSON.dump($client.pins_list(options))
23
+ end
24
+ end
25
+
26
+ g.desc 'This method un-pins an item (file, file comment, channel message, or group message) from a channel.'
27
+ g.long_desc %( This method un-pins an item (file, file comment, channel message, or group message) from a channel. The channel argument is required and one of file, file_comment, or timestamp must also be specified. )
28
+ g.command 'remove' do |c|
29
+ c.flag 'channel', desc: 'Channel where the item is pinned to.'
30
+ c.flag 'file', desc: 'File to un-pin.'
31
+ c.flag 'file_comment', desc: 'File comment to un-pin.'
32
+ c.flag 'timestamp', desc: 'Timestamp of the message to un-pin.'
33
+ c.action do |_global_options, options, _args|
34
+ puts JSON.dump($client.pins_remove(options))
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,53 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ desc 'Reactions methods.'
4
+ command 'reactions' do |g|
5
+ g.desc 'This method adds a reaction (emoji) to an item (file, file comment, channel message, group message, or direct message).'
6
+ g.long_desc %( This method adds a reaction (emoji) to an item (file, file comment, channel message, group message, or direct message). One of file, file_comment, or the combination of channel and timestamp must be specified. )
7
+ g.command 'add' do |c|
8
+ c.flag 'name', desc: 'Reaction (emoji) name.'
9
+ c.flag 'file', desc: 'File to add reaction to.'
10
+ c.flag 'file_comment', desc: 'File comment to add reaction to.'
11
+ c.flag 'channel', desc: 'Channel where the message to add reaction to was posted.'
12
+ c.flag 'timestamp', desc: 'Timestamp of the message to add reaction to.'
13
+ c.action do |_global_options, options, _args|
14
+ puts JSON.dump($client.reactions_add(options))
15
+ end
16
+ end
17
+
18
+ g.desc 'This method returns a list of all reactions for a single item (file, file comment, channel message, group message, or direct message).'
19
+ g.long_desc %( This method returns a list of all reactions for a single item (file, file comment, channel message, group message, or direct message). )
20
+ g.command 'get' do |c|
21
+ c.flag 'file', desc: 'File to get reactions for.'
22
+ c.flag 'file_comment', desc: 'File comment to get reactions for.'
23
+ c.flag 'channel', desc: 'Channel where the message to get reactions for was posted.'
24
+ c.flag 'timestamp', desc: 'Timestamp of the message to get reactions for.'
25
+ c.flag 'full', desc: 'If true always return the complete reaction list.'
26
+ c.action do |_global_options, options, _args|
27
+ puts JSON.dump($client.reactions_get(options))
28
+ end
29
+ end
30
+
31
+ g.desc 'This method returns a list of all items (file, file comment, channel message, group message, or direct message) reacted to by a user.'
32
+ g.long_desc %( This method returns a list of all items (file, file comment, channel message, group message, or direct message) reacted to by a user. )
33
+ g.command 'list' do |c|
34
+ c.flag 'user', desc: 'Show reactions made by this user. Defaults to the authed user.'
35
+ c.flag 'full', desc: 'If true always return the complete reaction list.'
36
+ c.action do |_global_options, options, _args|
37
+ puts JSON.dump($client.reactions_list(options))
38
+ end
39
+ end
40
+
41
+ g.desc 'This method removes a reaction (emoji) from an item (file, file comment, channel message, group message, or direct message).'
42
+ g.long_desc %( This method removes a reaction (emoji) from an item (file, file comment, channel message, group message, or direct message). One of file, file_comment, or the combination of channel and timestamp must be specified. )
43
+ g.command 'remove' do |c|
44
+ c.flag 'name', desc: 'Reaction (emoji) name.'
45
+ c.flag 'file', desc: 'File to remove reaction from.'
46
+ c.flag 'file_comment', desc: 'File comment to remove reaction from.'
47
+ c.flag 'channel', desc: 'Channel where the message to remove reaction from was posted.'
48
+ c.flag 'timestamp', desc: 'Timestamp of the message to remove reaction from.'
49
+ c.action do |_global_options, options, _args|
50
+ puts JSON.dump($client.reactions_remove(options))
51
+ end
52
+ end
53
+ end