slack-ruby-client 0.9.0 → 0.11.0

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 (142) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +3 -0
  4. data/.rubocop_todo.yml +40 -39
  5. data/.travis.yml +1 -9
  6. data/CHANGELOG.md +24 -0
  7. data/CONTRIBUTING.md +2 -2
  8. data/Gemfile +3 -1
  9. data/README.md +40 -12
  10. data/Rakefile +1 -1
  11. data/UPGRADING.md +1 -1
  12. data/bin/commands/api.rb +2 -2
  13. data/bin/commands/apps_permissions.rb +22 -0
  14. data/bin/commands/auth.rb +4 -4
  15. data/bin/commands/bots.rb +2 -2
  16. data/bin/commands/channels.rb +52 -40
  17. data/bin/commands/chat.rb +63 -25
  18. data/bin/commands/conversations.rb +178 -0
  19. data/bin/commands/dialog.rb +14 -0
  20. data/bin/commands/dnd.rb +8 -8
  21. data/bin/commands/emoji.rb +2 -2
  22. data/bin/commands/files.rb +38 -17
  23. data/bin/commands/files_comments.rb +6 -6
  24. data/bin/commands/groups.rb +44 -51
  25. data/bin/commands/im.rb +16 -13
  26. data/bin/commands/migration.rb +14 -0
  27. data/bin/commands/mpim.rb +11 -11
  28. data/bin/commands/oauth.rb +15 -2
  29. data/bin/commands/pins.rb +6 -6
  30. data/bin/commands/reactions.rb +13 -13
  31. data/bin/commands/reminders.rb +10 -10
  32. data/bin/commands/rtm.rb +9 -6
  33. data/bin/commands/search.rb +9 -9
  34. data/bin/commands/stars.rb +8 -8
  35. data/bin/commands/team.rb +10 -10
  36. data/bin/commands/team_profile.rb +2 -2
  37. data/bin/commands/usergroups.rb +16 -16
  38. data/bin/commands/usergroups_users.rb +4 -4
  39. data/bin/commands/users.rb +40 -36
  40. data/bin/commands/users_admin.rb +28 -0
  41. data/bin/commands/users_prefs.rb +12 -0
  42. data/bin/commands/users_profile.rb +7 -7
  43. data/bin/commands.rb +7 -1
  44. data/bin/slack +1 -1
  45. data/examples/hi_real_time/hi.rb +1 -1
  46. data/examples/hi_real_time_and_web/hi.rb +1 -1
  47. data/examples/hi_real_time_async_celluloid/hi.rb +1 -1
  48. data/examples/hi_real_time_async_eventmachine/hi.rb +1 -1
  49. data/examples/hi_web/hi.rb +1 -1
  50. data/examples/new_ticket/new_ticket.rb +1 -1
  51. data/lib/slack/messages/formatting.rb +4 -4
  52. data/lib/slack/messages/message.rb +1 -2
  53. data/lib/slack/real_time/api/templates/event_handler.erb +1 -1
  54. data/lib/slack/real_time/client.rb +11 -10
  55. data/lib/slack/real_time/concurrency/celluloid.rb +6 -2
  56. data/lib/slack/real_time/config.rb +11 -11
  57. data/lib/slack/real_time/models/base.rb +1 -2
  58. data/lib/slack/real_time/socket.rb +2 -2
  59. data/lib/slack/real_time/stores/base.rb +1 -2
  60. data/lib/slack/real_time/stores/starter.rb +92 -72
  61. data/lib/slack/real_time/stores/store.rb +120 -90
  62. data/lib/slack/version.rb +1 -1
  63. data/lib/slack/web/api/endpoints/api.rb +2 -2
  64. data/lib/slack/web/api/endpoints/apps_permissions.rb +35 -0
  65. data/lib/slack/web/api/endpoints/auth.rb +4 -4
  66. data/lib/slack/web/api/endpoints/bots.rb +2 -2
  67. data/lib/slack/web/api/endpoints/channels.rb +57 -34
  68. data/lib/slack/web/api/endpoints/chat.rb +107 -37
  69. data/lib/slack/web/api/endpoints/conversations.rb +301 -0
  70. data/lib/slack/web/api/endpoints/dialog.rb +32 -0
  71. data/lib/slack/web/api/endpoints/dnd.rb +9 -9
  72. data/lib/slack/web/api/endpoints/emoji.rb +2 -2
  73. data/lib/slack/web/api/endpoints/files.rb +53 -23
  74. data/lib/slack/web/api/endpoints/files_comments.rb +11 -11
  75. data/lib/slack/web/api/endpoints/groups.rb +38 -50
  76. data/lib/slack/web/api/endpoints/im.rb +27 -17
  77. data/lib/slack/web/api/endpoints/migration.rb +25 -0
  78. data/lib/slack/web/api/endpoints/mpim.rb +13 -15
  79. data/lib/slack/web/api/endpoints/oauth.rb +24 -3
  80. data/lib/slack/web/api/endpoints/pins.rb +6 -8
  81. data/lib/slack/web/api/endpoints/presence.rb +1 -1
  82. data/lib/slack/web/api/endpoints/reactions.rb +18 -20
  83. data/lib/slack/web/api/endpoints/reminders.rb +10 -10
  84. data/lib/slack/web/api/endpoints/rtm.rb +14 -8
  85. data/lib/slack/web/api/endpoints/search.rb +12 -12
  86. data/lib/slack/web/api/endpoints/stars.rb +10 -12
  87. data/lib/slack/web/api/endpoints/team.rb +12 -13
  88. data/lib/slack/web/api/endpoints/team_profile.rb +2 -2
  89. data/lib/slack/web/api/endpoints/usergroups.rb +22 -22
  90. data/lib/slack/web/api/endpoints/usergroups_users.rb +4 -4
  91. data/lib/slack/web/api/endpoints/users.rb +34 -24
  92. data/lib/slack/web/api/endpoints/users_admin.rb +46 -0
  93. data/lib/slack/web/api/endpoints/users_prefs.rb +19 -0
  94. data/lib/slack/web/api/endpoints/users_profile.rb +10 -10
  95. data/lib/slack/web/api/endpoints.rb +14 -2
  96. data/lib/slack/web/api/mixins/ids.id.rb +1 -1
  97. data/lib/slack/web/api/mixins/users.search.rb +38 -36
  98. data/lib/slack/web/api/patches/chat.1.text-attachments-required.patch +1 -1
  99. data/lib/slack/web/api/patches/chat.3.update-attachments-support.patch +4 -3
  100. data/lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch +17 -0
  101. data/lib/slack/web/api/patches/dialog.1.open-json-support.patch +17 -0
  102. data/lib/slack/web/api/templates/command.erb +4 -3
  103. data/lib/slack/web/api/templates/commands.erb +1 -1
  104. data/lib/slack/web/api/templates/endpoints.erb +2 -2
  105. data/lib/slack/web/api/templates/method.erb +18 -3
  106. data/lib/slack/web/api/templates/method_spec.erb +1 -1
  107. data/lib/slack/web/config.rb +16 -12
  108. data/lib/slack/web/faraday/connection.rb +1 -1
  109. data/lib/slack/web/faraday/response/raise_error.rb +3 -3
  110. data/lib/slack/web/pagination/cursor.rb +48 -0
  111. data/lib/slack-ruby-client.rb +6 -0
  112. data/lib/tasks/git.rake +1 -1
  113. data/lib/tasks/real_time.rake +1 -1
  114. data/lib/tasks/web.rake +4 -1
  115. data/slack-ruby-client.gemspec +2 -3
  116. data/spec/fixtures/slack/web/paginated_users_list.yml +181 -0
  117. data/spec/integration/integration_spec.rb +1 -1
  118. data/spec/slack/messages/formatting_spec.rb +1 -1
  119. data/spec/slack/real_time/client_spec.rb +62 -63
  120. data/spec/slack/real_time/concurrency/celluloid_spec.rb +41 -31
  121. data/spec/slack/real_time/concurrency/it_behaves_like_a_realtime_socket.rb +1 -1
  122. data/spec/slack/real_time/event_handlers/bot_spec.rb +4 -2
  123. data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +1 -1
  124. data/spec/slack/real_time/event_handlers/user_spec.rb +4 -2
  125. data/spec/slack/web/api/endpoints/apps_permissions_spec.rb +15 -0
  126. data/spec/slack/web/api/endpoints/conversations_spec.rb +100 -0
  127. data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +37 -1
  128. data/spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb +28 -0
  129. data/spec/slack/web/api/endpoints/custom_specs/users_spec.rb +16 -6
  130. data/spec/slack/web/api/endpoints/files_comments_spec.rb +8 -8
  131. data/spec/slack/web/api/endpoints/files_spec.rb +16 -5
  132. data/spec/slack/web/api/endpoints/migration_spec.rb +12 -0
  133. data/spec/slack/web/api/endpoints/oauth_spec.rb +11 -0
  134. data/spec/slack/web/api/endpoints/users_admin_spec.rb +17 -0
  135. data/spec/slack/web/api/endpoints/users_prefs_spec.rb +7 -0
  136. data/spec/slack/web/api/error_spec.rb +1 -1
  137. data/spec/slack/web/api/errors/slack_error_spec.rb +1 -1
  138. data/spec/slack/web/api/mixins/users_spec.rb +6 -4
  139. data/spec/slack/web/api/pagination/cursor_spec.rb +70 -0
  140. data/spec/support/queue_with_timeout.rb +1 -1
  141. data/spec/support/real_time/concurrency/mock.rb +1 -2
  142. metadata +47 -30
@@ -2,8 +2,8 @@
2
2
 
3
3
  desc "Get info on your team's private channels."
4
4
  command 'groups' do |g|
5
- g.desc 'This method archives a private channel.'
6
- g.long_desc %( This method archives a private channel. )
5
+ g.desc 'Archives a private channel.'
6
+ g.long_desc %( Archives a private channel. )
7
7
  g.command 'archive' do |c|
8
8
  c.flag 'channel', desc: 'Private channel to archive.'
9
9
  c.action do |_global_options, options, _args|
@@ -11,17 +11,8 @@ command 'groups' do |g|
11
11
  end
12
12
  end
13
13
 
14
- g.desc 'This method closes a private channel.'
15
- g.long_desc %( This method closes a private channel. )
16
- g.command 'close' do |c|
17
- c.flag 'channel', desc: 'Private channel 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 channel.'
24
- g.long_desc %( This method creates a private channel. )
14
+ g.desc 'Creates a private channel.'
15
+ g.long_desc %( Creates a private channel. )
25
16
  g.command 'create' do |c|
26
17
  c.flag 'name', desc: 'Name of private channel to create.'
27
18
  c.flag 'validate', desc: 'Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.'
@@ -30,8 +21,8 @@ command 'groups' do |g|
30
21
  end
31
22
  end
32
23
 
33
- g.desc 'This method takes an existing private channel and performs the following steps:'
34
- g.long_desc %( This method takes an existing private channel and performs the following steps: )
24
+ g.desc 'Clones and archives a private channel.'
25
+ g.long_desc %( Clones and archives a private channel. )
35
26
  g.command 'createChild' do |c|
36
27
  c.flag 'channel', desc: 'Private channel to clone and archive.'
37
28
  c.action do |_global_options, options, _args|
@@ -39,30 +30,40 @@ command 'groups' do |g|
39
30
  end
40
31
  end
41
32
 
42
- g.desc 'This method returns a portion of messages/events from the specified private channel.'
43
- g.long_desc %( This method returns a portion of messages/events from the specified private channel. To read the entire history for a private channel, call the method with no latest or oldest arguments, and then continue paging using the instructions below. )
33
+ g.desc 'Fetches history of messages and events from a private channel.'
34
+ g.long_desc %( Fetches history of messages and events from a private channel. )
44
35
  g.command 'history' do |c|
45
36
  c.flag 'channel', desc: 'Private channel to fetch history for.'
37
+ c.flag 'inclusive', desc: 'Include messages with latest or oldest timestamp in results.'
46
38
  c.flag 'latest', desc: 'End of time range of messages to include in results.'
47
39
  c.flag 'oldest', desc: 'Start of time range of messages to include in results.'
48
- c.flag 'inclusive', desc: 'Include messages with latest or oldest timestamp in results.'
49
40
  c.flag 'unreads', desc: 'Include unread_count_display in the output?.'
50
41
  c.action do |_global_options, options, _args|
51
42
  puts JSON.dump($client.groups_history(options))
52
43
  end
53
44
  end
54
45
 
55
- g.desc 'This method returns information about a private channel.'
56
- g.long_desc %( This method returns information about a private channel. )
46
+ g.desc 'This method returns the ID of a group.'
47
+ g.long_desc %( This method returns the ID of a group. )
48
+ g.command 'id' do |c|
49
+ c.flag 'channel', desc: 'Group channel to get ID for, prefixed with #.'
50
+ c.action do |_global_options, options, _args|
51
+ puts JSON.dump($client.groups_id(options))
52
+ end
53
+ end
54
+
55
+ g.desc 'Gets information about a private channel.'
56
+ g.long_desc %( Gets information about a private channel. )
57
57
  g.command 'info' do |c|
58
58
  c.flag 'channel', desc: 'Private channel to get info on.'
59
+ c.flag 'include_locale', desc: 'Set this to true to receive the locale for this group. Defaults to false.'
59
60
  c.action do |_global_options, options, _args|
60
61
  puts JSON.dump($client.groups_info(options))
61
62
  end
62
63
  end
63
64
 
64
- g.desc 'This method is used to invite a user to a private channel. The calling user must be a member of the private channel.'
65
- g.long_desc %( This method is used to invite a user to a private channel. The calling user must be a member of the private channel. )
65
+ g.desc 'Invites a user to a private channel.'
66
+ g.long_desc %( Invites a user to a private channel. )
66
67
  g.command 'invite' do |c|
67
68
  c.flag 'channel', desc: 'Private channel to invite user to.'
68
69
  c.flag 'user', desc: 'User to invite.'
@@ -71,8 +72,8 @@ command 'groups' do |g|
71
72
  end
72
73
  end
73
74
 
74
- g.desc 'This method allows a user to remove another member from a private channel.'
75
- g.long_desc %( This method allows a user to remove another member from a private channel. )
75
+ g.desc 'Removes a user from a private channel.'
76
+ g.long_desc %( Removes a user from a private channel. )
76
77
  g.command 'kick' do |c|
77
78
  c.flag 'channel', desc: 'Private channel to remove user from.'
78
79
  c.flag 'user', desc: 'User to remove from private channel.'
@@ -81,8 +82,8 @@ command 'groups' do |g|
81
82
  end
82
83
  end
83
84
 
84
- g.desc 'This method is used to leave a private channel.'
85
- g.long_desc %( This method is used to leave a private channel. )
85
+ g.desc 'Leaves a private channel.'
86
+ g.long_desc %( Leaves a private channel. )
86
87
  g.command 'leave' do |c|
87
88
  c.flag 'channel', desc: 'Private channel to leave.'
88
89
  c.action do |_global_options, options, _args|
@@ -90,17 +91,18 @@ command 'groups' do |g|
90
91
  end
91
92
  end
92
93
 
93
- g.desc 'This method returns a list of private channels in the team that the caller is in and archived groups that the caller was in.'
94
- g.long_desc %( This method returns a list of private channels in the team that the caller is in and archived groups that the caller was in. The list of (non-deactivated) members in each private channel is also returned. )
94
+ g.desc 'Lists private channels that the calling user has access to.'
95
+ g.long_desc %( Lists private channels that the calling user has access to. )
95
96
  g.command 'list' do |c|
96
97
  c.flag 'exclude_archived', desc: "Don't return archived private channels."
98
+ c.flag 'exclude_members', desc: 'Exclude the members from each group.'
97
99
  c.action do |_global_options, options, _args|
98
100
  puts JSON.dump($client.groups_list(options))
99
101
  end
100
102
  end
101
103
 
102
- g.desc 'This method moves the read cursor in a private channel.'
103
- g.long_desc %( This method moves the read cursor in a private channel. )
104
+ g.desc 'Sets the read cursor in a private channel.'
105
+ g.long_desc %( Sets the read cursor in a private channel. )
104
106
  g.command 'mark' do |c|
105
107
  c.flag 'channel', desc: 'Private channel to set reading cursor in.'
106
108
  c.flag 'ts', desc: 'Timestamp of the most recently seen message.'
@@ -109,8 +111,8 @@ command 'groups' do |g|
109
111
  end
110
112
  end
111
113
 
112
- g.desc 'This method opens a private channel.'
113
- g.long_desc %( This method opens a private channel. )
114
+ g.desc 'Opens a private channel.'
115
+ g.long_desc %( Opens a private channel. )
114
116
  g.command 'open' do |c|
115
117
  c.flag 'channel', desc: 'Private channel to open.'
116
118
  c.action do |_global_options, options, _args|
@@ -118,8 +120,8 @@ command 'groups' do |g|
118
120
  end
119
121
  end
120
122
 
121
- g.desc 'This method renames a private channel.'
122
- g.long_desc %( This method renames a private channel. )
123
+ g.desc 'Renames a private channel.'
124
+ g.long_desc %( Renames a private channel. )
123
125
  g.command 'rename' do |c|
124
126
  c.flag 'channel', desc: 'Private channel to rename.'
125
127
  c.flag 'name', desc: 'New name for private channel.'
@@ -129,8 +131,8 @@ command 'groups' do |g|
129
131
  end
130
132
  end
131
133
 
132
- g.desc 'This method returns an entire thread (a message plus all the messages in reply to it).'
133
- g.long_desc %( This method returns an entire thread (a message plus all the messages in reply to it). )
134
+ g.desc 'Retrieve a thread of messages posted to a private channel'
135
+ g.long_desc %( Retrieve a thread of messages posted to a private channel )
134
136
  g.command 'replies' do |c|
135
137
  c.flag 'channel', desc: 'Private channel to fetch thread from.'
136
138
  c.flag 'thread_ts', desc: "Unique identifier of a thread's parent message."
@@ -139,8 +141,8 @@ command 'groups' do |g|
139
141
  end
140
142
  end
141
143
 
142
- g.desc 'This method is used to change the purpose of a private channel. The calling user must be a member of the private channel.'
143
- g.long_desc %( This method is used to change the purpose of a private channel. The calling user must be a member of the private channel. )
144
+ g.desc 'Sets the purpose for a private channel.'
145
+ g.long_desc %( Sets the purpose for a private channel. )
144
146
  g.command 'setPurpose' do |c|
145
147
  c.flag 'channel', desc: 'Private channel to set the purpose of.'
146
148
  c.flag 'purpose', desc: 'The new purpose.'
@@ -149,8 +151,8 @@ command 'groups' do |g|
149
151
  end
150
152
  end
151
153
 
152
- g.desc 'This method is used to change the topic of a private channel. The calling user must be a member of the private channel.'
153
- g.long_desc %( This method is used to change the topic of a private channel. The calling user must be a member of the private channel. )
154
+ g.desc 'Sets the topic for a private channel.'
155
+ g.long_desc %( Sets the topic for a private channel. )
154
156
  g.command 'setTopic' do |c|
155
157
  c.flag 'channel', desc: 'Private channel to set the topic of.'
156
158
  c.flag 'topic', desc: 'The new topic.'
@@ -159,21 +161,12 @@ command 'groups' do |g|
159
161
  end
160
162
  end
161
163
 
162
- g.desc 'This method unarchives a private channel.'
163
- g.long_desc %( This method unarchives a private channel. )
164
+ g.desc 'Unarchives a private channel.'
165
+ g.long_desc %( Unarchives a private channel. )
164
166
  g.command 'unarchive' do |c|
165
167
  c.flag 'channel', desc: 'Private channel to unarchive.'
166
168
  c.action do |_global_options, options, _args|
167
169
  puts JSON.dump($client.groups_unarchive(options))
168
170
  end
169
171
  end
170
-
171
- g.desc 'This method returns the ID of a group.'
172
- g.long_desc %( This method returns the ID of a group. )
173
- g.command 'id' do |c|
174
- c.flag 'channel', desc: 'Group channel to get ID for, prefixed with #.'
175
- c.action do |_global_options, options, _args|
176
- puts JSON.dump($client.groups_id(options))
177
- end
178
- end
179
172
  end
data/bin/commands/im.rb CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  desc 'Get info on your direct messages.'
4
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. )
5
+ g.desc 'Close a direct message channel.'
6
+ g.long_desc %( Close a direct message channel. )
7
7
  g.command 'close' do |c|
8
8
  c.flag 'channel', desc: 'Direct message channel to close.'
9
9
  c.action do |_global_options, options, _args|
@@ -11,29 +11,31 @@ command 'im' do |g|
11
11
  end
12
12
  end
13
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. )
14
+ g.desc 'Fetches history of messages and events from direct message channel.'
15
+ g.long_desc %( Fetches history of messages and events from direct message channel. )
16
16
  g.command 'history' do |c|
17
17
  c.flag 'channel', desc: 'Direct message channel to fetch history for.'
18
+ c.flag 'inclusive', desc: 'Include messages with latest or oldest timestamp in results.'
18
19
  c.flag 'latest', desc: 'End of time range of messages to include in results.'
19
20
  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
21
  c.flag 'unreads', desc: 'Include unread_count_display in the output?.'
22
22
  c.action do |_global_options, options, _args|
23
23
  puts JSON.dump($client.im_history(options))
24
24
  end
25
25
  end
26
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. )
27
+ g.desc 'Lists direct message channels for the calling user.'
28
+ g.long_desc %( Lists direct message channels for the calling user. )
29
29
  g.command 'list' do |c|
30
+ c.flag 'cursor', desc: "Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first 'page' of the collection. See pagination for more detail."
31
+ c.flag 'limit', desc: "The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached."
30
32
  c.action do |_global_options, options, _args|
31
33
  puts JSON.dump($client.im_list(options))
32
34
  end
33
35
  end
34
36
 
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.desc 'Sets the read cursor in a direct message channel.'
38
+ g.long_desc %( Sets the read cursor in a direct message channel. )
37
39
  g.command 'mark' do |c|
38
40
  c.flag 'channel', desc: 'Direct message channel to set reading cursor in.'
39
41
  c.flag 'ts', desc: 'Timestamp of the most recently seen message.'
@@ -42,18 +44,19 @@ command 'im' do |g|
42
44
  end
43
45
  end
44
46
 
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.desc 'Opens a direct message channel.'
48
+ g.long_desc %( Opens a direct message channel. )
47
49
  g.command 'open' do |c|
48
50
  c.flag 'user', desc: 'User to open a direct message channel with.'
51
+ c.flag 'include_locale', desc: 'Set this to true to receive the locale for this im. Defaults to false.'
49
52
  c.flag 'return_im', desc: 'Boolean, indicates you want the full IM channel definition in the response.'
50
53
  c.action do |_global_options, options, _args|
51
54
  puts JSON.dump($client.im_open(options))
52
55
  end
53
56
  end
54
57
 
55
- g.desc 'This method returns an entire thread (a message plus all the messages in reply to it).'
56
- g.long_desc %( This method returns an entire thread (a message plus all the messages in reply to it). )
58
+ g.desc 'Retrieve a thread of messages posted to a direct message conversation'
59
+ g.long_desc %( Retrieve a thread of messages posted to a direct message conversation )
57
60
  g.command 'replies' do |c|
58
61
  c.flag 'channel', desc: 'Direct message channel to fetch thread from.'
59
62
  c.flag 'thread_ts', desc: "Unique identifier of a thread's parent message."
@@ -0,0 +1,14 @@
1
+ # This file was auto-generated by lib/tasks/web.rake
2
+
3
+ desc 'Migration methods.'
4
+ command 'migration' do |g|
5
+ g.desc 'For Enterprise Grid workspaces, map local user IDs to global user IDs'
6
+ g.long_desc %( For Enterprise Grid workspaces, map local user IDs to global user IDs )
7
+ g.command 'exchange' do |c|
8
+ c.flag 'users', desc: 'A comma-separated list of user ids, up to 400 per request.'
9
+ c.flag 'to_old', desc: 'Specify true to convert W global user IDs to workspace-specific U IDs. Defaults to false.'
10
+ c.action do |_global_options, options, _args|
11
+ puts JSON.dump($client.migration_exchange(options))
12
+ end
13
+ end
14
+ end
data/bin/commands/mpim.rb CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  desc 'Get info on your multiparty direct messages.'
4
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. )
5
+ g.desc 'Closes a multiparty direct message channel.'
6
+ g.long_desc %( Closes a multiparty direct message channel. )
7
7
  g.command 'close' do |c|
8
8
  c.flag 'channel', desc: 'MPIM to close.'
9
9
  c.action do |_global_options, options, _args|
@@ -11,29 +11,29 @@ command 'mpim' do |g|
11
11
  end
12
12
  end
13
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. )
14
+ g.desc 'Fetches history of messages and events from a multiparty direct message.'
15
+ g.long_desc %( Fetches history of messages and events from a multiparty direct message. )
16
16
  g.command 'history' do |c|
17
17
  c.flag 'channel', desc: 'Multiparty direct message to fetch history for.'
18
+ c.flag 'inclusive', desc: 'Include messages with latest or oldest timestamp in results.'
18
19
  c.flag 'latest', desc: 'End of time range of messages to include in results.'
19
20
  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
21
  c.flag 'unreads', desc: 'Include unread_count_display in the output?.'
22
22
  c.action do |_global_options, options, _args|
23
23
  puts JSON.dump($client.mpim_history(options))
24
24
  end
25
25
  end
26
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. )
27
+ g.desc 'Lists multiparty direct message channels for the calling user.'
28
+ g.long_desc %( Lists multiparty direct message channels for the calling user. )
29
29
  g.command 'list' do |c|
30
30
  c.action do |_global_options, options, _args|
31
31
  puts JSON.dump($client.mpim_list(options))
32
32
  end
33
33
  end
34
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. )
35
+ g.desc 'Sets the read cursor in a multiparty direct message channel.'
36
+ g.long_desc %( Sets the read cursor in a multiparty direct message channel. )
37
37
  g.command 'mark' do |c|
38
38
  c.flag 'channel', desc: 'multiparty direct message channel to set reading cursor in.'
39
39
  c.flag 'ts', desc: 'Timestamp of the most recently seen message.'
@@ -51,8 +51,8 @@ command 'mpim' do |g|
51
51
  end
52
52
  end
53
53
 
54
- g.desc 'This method returns an entire thread (a message plus all the messages in reply to it).'
55
- g.long_desc %( This method returns an entire thread (a message plus all the messages in reply to it). )
54
+ g.desc 'Retrieve a thread of messages posted to a direct message conversation from a multiparty direct message.'
55
+ g.long_desc %( Retrieve a thread of messages posted to a direct message conversation from a multiparty direct message. )
56
56
  g.command 'replies' do |c|
57
57
  c.flag 'channel', desc: 'Multiparty direct message channel to fetch thread from.'
58
58
  c.flag 'thread_ts', desc: "Unique identifier of a thread's parent message."
@@ -2,8 +2,8 @@
2
2
 
3
3
  desc 'Oauth methods.'
4
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. )
5
+ g.desc 'Exchanges a temporary OAuth code for an API token.'
6
+ g.long_desc %( Exchanges a temporary OAuth code for an API token. )
7
7
  g.command 'access' do |c|
8
8
  c.flag 'client_id', desc: 'Issued when you created your application.'
9
9
  c.flag 'client_secret', desc: 'Issued when you created your application.'
@@ -13,4 +13,17 @@ command 'oauth' do |g|
13
13
  puts JSON.dump($client.oauth_access(options))
14
14
  end
15
15
  end
16
+
17
+ g.desc 'Exchanges a temporary OAuth verifier code for a workspace token.'
18
+ g.long_desc %( Exchanges a temporary OAuth verifier code for a workspace token. )
19
+ g.command 'token' do |c|
20
+ c.flag 'client_id', desc: 'Issued when you created your application.'
21
+ c.flag 'client_secret', desc: 'Issued when you created your application.'
22
+ c.flag 'code', desc: 'The code param returned via the OAuth callback.'
23
+ c.flag 'redirect_uri', desc: 'This must match the originally submitted URI (if one was sent).'
24
+ c.flag 'single_channel', desc: 'Request the user to add your app only to a single channel.'
25
+ c.action do |_global_options, options, _args|
26
+ puts JSON.dump($client.oauth_token(options))
27
+ end
28
+ end
16
29
  end
data/bin/commands/pins.rb CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  desc 'Pins methods.'
4
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. )
5
+ g.desc 'Pins an item to a channel.'
6
+ g.long_desc %( Pins an item to a channel. )
7
7
  g.command 'add' do |c|
8
8
  c.flag 'channel', desc: 'Channel to pin the item in.'
9
9
  c.flag 'file', desc: 'File to pin.'
@@ -14,8 +14,8 @@ command 'pins' do |g|
14
14
  end
15
15
  end
16
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. )
17
+ g.desc 'Lists items pinned to a channel.'
18
+ g.long_desc %( Lists items pinned to a channel. )
19
19
  g.command 'list' do |c|
20
20
  c.flag 'channel', desc: 'Channel to get pinned items for.'
21
21
  c.action do |_global_options, options, _args|
@@ -23,8 +23,8 @@ command 'pins' do |g|
23
23
  end
24
24
  end
25
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. )
26
+ g.desc 'Un-pins an item from a channel.'
27
+ g.long_desc %( Un-pins an item from a channel. )
28
28
  g.command 'remove' do |c|
29
29
  c.flag 'channel', desc: 'Channel where the item is pinned to.'
30
30
  c.flag 'file', desc: 'File to un-pin.'
@@ -2,49 +2,49 @@
2
2
 
3
3
  desc 'Reactions methods.'
4
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. )
5
+ g.desc 'Adds a reaction to an item.'
6
+ g.long_desc %( Adds a reaction to an item. )
7
7
  g.command 'add' do |c|
8
8
  c.flag 'name', desc: 'Reaction (emoji) name.'
9
+ c.flag 'channel', desc: 'Channel where the message to add reaction to was posted.'
9
10
  c.flag 'file', desc: 'File to add reaction to.'
10
11
  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
12
  c.flag 'timestamp', desc: 'Timestamp of the message to add reaction to.'
13
13
  c.action do |_global_options, options, _args|
14
14
  puts JSON.dump($client.reactions_add(options))
15
15
  end
16
16
  end
17
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). )
18
+ g.desc 'Gets reactions for an item.'
19
+ g.long_desc %( Gets reactions for an item. )
20
20
  g.command 'get' do |c|
21
+ c.flag 'channel', desc: 'Channel where the message to get reactions for was posted.'
21
22
  c.flag 'file', desc: 'File to get reactions for.'
22
23
  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
24
  c.flag 'full', desc: 'If true always return the complete reaction list.'
25
+ c.flag 'timestamp', desc: 'Timestamp of the message to get reactions for.'
26
26
  c.action do |_global_options, options, _args|
27
27
  puts JSON.dump($client.reactions_get(options))
28
28
  end
29
29
  end
30
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. )
31
+ g.desc 'Lists reactions made by a user.'
32
+ g.long_desc %( Lists reactions made by a user. )
33
33
  g.command 'list' do |c|
34
- c.flag 'user', desc: 'Show reactions made by this user. Defaults to the authed user.'
35
34
  c.flag 'full', desc: 'If true always return the complete reaction list.'
35
+ c.flag 'user', desc: 'Show reactions made by this user. Defaults to the authed user.'
36
36
  c.action do |_global_options, options, _args|
37
37
  puts JSON.dump($client.reactions_list(options))
38
38
  end
39
39
  end
40
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. )
41
+ g.desc 'Removes a reaction from an item.'
42
+ g.long_desc %( Removes a reaction from an item. )
43
43
  g.command 'remove' do |c|
44
44
  c.flag 'name', desc: 'Reaction (emoji) name.'
45
+ c.flag 'channel', desc: 'Channel where the message to remove reaction from was posted.'
45
46
  c.flag 'file', desc: 'File to remove reaction from.'
46
47
  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
48
  c.flag 'timestamp', desc: 'Timestamp of the message to remove reaction from.'
49
49
  c.action do |_global_options, options, _args|
50
50
  puts JSON.dump($client.reactions_remove(options))
@@ -2,8 +2,8 @@
2
2
 
3
3
  desc 'Reminders methods.'
4
4
  command 'reminders' do |g|
5
- g.desc 'This method creates a reminder.'
6
- g.long_desc %( This method creates a reminder. )
5
+ g.desc 'Creates a reminder.'
6
+ g.long_desc %( Creates a reminder. )
7
7
  g.command 'add' do |c|
8
8
  c.flag 'text', desc: 'The content of the reminder.'
9
9
  c.flag 'time', desc: 'When this reminder should happen: the Unix timestamp (up to five years from now), the number of seconds until the reminder (if within 24 hours), or a natural language description (Ex. "in 15 minutes," or "every Thursday").'
@@ -13,8 +13,8 @@ command 'reminders' do |g|
13
13
  end
14
14
  end
15
15
 
16
- g.desc 'This method completes a reminder.'
17
- g.long_desc %( This method completes a reminder. )
16
+ g.desc 'Marks a reminder as complete.'
17
+ g.long_desc %( Marks a reminder as complete. )
18
18
  g.command 'complete' do |c|
19
19
  c.flag 'reminder', desc: 'The ID of the reminder to be marked as complete.'
20
20
  c.action do |_global_options, options, _args|
@@ -22,8 +22,8 @@ command 'reminders' do |g|
22
22
  end
23
23
  end
24
24
 
25
- g.desc 'This method deletes a reminder.'
26
- g.long_desc %( This method deletes a reminder. )
25
+ g.desc 'Deletes a reminder.'
26
+ g.long_desc %( Deletes a reminder. )
27
27
  g.command 'delete' do |c|
28
28
  c.flag 'reminder', desc: 'The ID of the reminder.'
29
29
  c.action do |_global_options, options, _args|
@@ -31,8 +31,8 @@ command 'reminders' do |g|
31
31
  end
32
32
  end
33
33
 
34
- g.desc 'This method returns information about a reminder.'
35
- g.long_desc %( This method returns information about a reminder. )
34
+ g.desc 'Gets information about a reminder.'
35
+ g.long_desc %( Gets information about a reminder. )
36
36
  g.command 'info' do |c|
37
37
  c.flag 'reminder', desc: 'The ID of the reminder.'
38
38
  c.action do |_global_options, options, _args|
@@ -40,8 +40,8 @@ command 'reminders' do |g|
40
40
  end
41
41
  end
42
42
 
43
- g.desc 'This method lists all reminders created by or for a given user.'
44
- g.long_desc %( This method lists all reminders created by or for a given user. )
43
+ g.desc 'Lists all reminders created by or for a given user.'
44
+ g.long_desc %( Lists all reminders created by or for a given user. )
45
45
  g.command 'list' do |c|
46
46
  c.action do |_global_options, options, _args|
47
47
  puts JSON.dump($client.reminders_list(options))
data/bin/commands/rtm.rb CHANGED
@@ -2,21 +2,24 @@
2
2
 
3
3
  desc 'Rtm methods.'
4
4
  command 'rtm' do |g|
5
- g.desc 'This method begins a Real Time Messaging API session and reserves your application a specific URL with which to connect via websocket.'
6
- g.long_desc %( This method begins a Real Time Messaging API session and reserves your application a specific URL with which to connect via websocket. )
5
+ g.desc 'Starts a Real Time Messaging session.'
6
+ g.long_desc %( Starts a Real Time Messaging session. )
7
7
  g.command 'connect' do |c|
8
+ c.flag 'batch_presence_aware', desc: 'Only deliver presence events when requested by subscription. See presence subscriptions.'
8
9
  c.action do |_global_options, options, _args|
9
10
  puts JSON.dump($client.rtm_connect(options))
10
11
  end
11
12
  end
12
13
 
13
- g.desc 'This method begins a Real Time Messaging API session and reserves your application a specific URL with which to connect via websocket.'
14
- g.long_desc %( This method begins a Real Time Messaging API session and reserves your application a specific URL with which to connect via websocket. )
14
+ g.desc 'Starts a Real Time Messaging session.'
15
+ g.long_desc %( Starts a Real Time Messaging session. )
15
16
  g.command 'start' do |c|
16
- c.flag 'simple_latest', desc: 'Return timestamp only for latest message object of each channel (improves performance).'
17
- c.flag 'no_unreads', desc: 'Skip unread counts for each channel (improves performance).'
17
+ c.flag 'batch_presence_aware', desc: 'Only deliver presence events when requested by subscription. See presence subscriptions.'
18
+ c.flag 'include_locale', desc: 'Set this to true to receive the locale for users and channels. Defaults to false.'
18
19
  c.flag 'mpim_aware', desc: 'Returns MPIMs to the client in the API response.'
19
20
  c.flag 'no_latest', desc: 'Exclude latest timestamps for channels, groups, mpims, and ims. Automatically sets no_unreads to 1.'
21
+ c.flag 'no_unreads', desc: 'Skip unread counts for each channel (improves performance).'
22
+ c.flag 'simple_latest', desc: 'Return timestamp only for latest message object of each channel (improves performance).'
20
23
  c.action do |_global_options, options, _args|
21
24
  puts JSON.dump($client.rtm_start(options))
22
25
  end
@@ -2,37 +2,37 @@
2
2
 
3
3
  desc "Search your team's files and messages."
4
4
  command 'search' do |g|
5
- g.desc 'This method allows users and applications to search both messages and files in a single call.'
6
- g.long_desc %( This method allows users and applications to search both messages and files in a single call. )
5
+ g.desc 'Searches for messages and files matching a query.'
6
+ g.long_desc %( Searches for messages and files matching a query. )
7
7
  g.command 'all' do |c|
8
8
  c.flag 'query', desc: 'Search query. May contains booleans, etc.'
9
+ c.flag 'highlight', desc: 'Pass a value of true to enable query highlight markers (see below).'
9
10
  c.flag 'sort', desc: 'Return matches sorted by either score or timestamp.'
10
11
  c.flag 'sort_dir', desc: 'Change sort direction to ascending (asc) or descending (desc).'
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
15
15
  end
16
16
 
17
- g.desc 'This method returns files matching a search query.'
18
- g.long_desc %( This method returns files matching a search query. )
17
+ g.desc 'Searches for files matching a query.'
18
+ g.long_desc %( Searches for files matching a query. )
19
19
  g.command 'files' do |c|
20
20
  c.flag 'query', desc: 'Search query. May contain booleans, etc.'
21
+ c.flag 'highlight', desc: 'Pass a value of true to enable query highlight markers (see below).'
21
22
  c.flag 'sort', desc: 'Return matches sorted by either score or timestamp.'
22
23
  c.flag 'sort_dir', desc: 'Change sort direction to ascending (asc) or descending (desc).'
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
27
27
  end
28
28
 
29
- g.desc 'This method returns messages matching a search query.'
30
- g.long_desc %( This method returns messages matching a search query. )
29
+ g.desc 'Searches for messages matching a query.'
30
+ g.long_desc %( Searches for messages matching a query. )
31
31
  g.command 'messages' do |c|
32
32
  c.flag 'query', desc: 'Search query. May contains booleans, etc.'
33
+ c.flag 'highlight', desc: 'Pass a value of true to enable query highlight markers (see below).'
33
34
  c.flag 'sort', desc: 'Return matches sorted by either score or timestamp.'
34
35
  c.flag 'sort_dir', desc: 'Change sort direction to ascending (asc) or descending (desc).'
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