slack-ruby-client 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d6e26bc5f3e7e53c67ece14f51482ba24bfbbd1
4
- data.tar.gz: c83f574cf4041f1507c3ffdf9a0716669306ead9
3
+ metadata.gz: bddd0a87e5708039190f6426332ea467d989f691
4
+ data.tar.gz: 20b28016a329478c0dfcf1ebfb270c33e7c9e5b7
5
5
  SHA512:
6
- metadata.gz: 6753176ae587da7add086f67a6d51f9451e4160283ac369bef881743c1930c0b571b048d6c25bc54c8d2347ddf42f32024a46ed1cc93207fee346b55a7dfe8d5
7
- data.tar.gz: a1e45d53c9e0e1bb04369f4ad3f94fd7f061d92a0d8f2974fa89861c75a001cbfb7ea5cac63812ea4cab4fe3c7e9e411408731047d1d2be3f259b744b2e24153
6
+ metadata.gz: 617b369a14e5c896000962d3c917ba05d07af9cffdb6c08891ceb389161ff0f5e2de568601e0460ac99bd1fc1cdcaf7ed91cb6ea647797e00600ef9fad348c7b
7
+ data.tar.gz: 84bfc168239d0e7699b9f2192a5a1dde2c272a32910cc6867ed8ecb71a0ec83e9d7216a7cef3e3c7f66e67b79b8f5a5e9142f6c1b7a359e205be6e65575d088c
data/.travis.yml CHANGED
@@ -1,8 +1,8 @@
1
1
  rvm:
2
2
  - 2.2
3
3
  - 2.1
4
- - 2.0.0
5
- - rbx-2.2.10
4
+ - 2.0
5
+ - rbx-2.9
6
6
  - jruby-19mode
7
7
  - ruby-head
8
8
  - jruby-head
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ### 0.5.1 (1/4/2016)
2
+
3
+ * Added `dnd_teamInfo`, `dnd_setSnooze`, `dnd_info`, `dnd_endSnooze` and `dnd_endDnd` - [@dblock](https://github.com/dblock).
4
+ * The `files_upload` method now requires both `file` and `filename` - [@dblock](https://github.com/dblock).
5
+
1
6
  ### 0.5.0 (12/7/2015)
2
7
 
3
8
  * Added `usergroups_create`, `usergroups_disable`, `usergroups_enable`, `usergroups_list`, `usergroups_update` and `usergroups_users` to Web API - [@dblock](https://github.com/dblock).
data/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2015 Daniel Doubrovkine, Artsy and Contributors
3
+ Copyright (c) 2015-2016 Daniel Doubrovkine, Artsy and Contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -7,13 +7,18 @@ Slack Ruby Client
7
7
 
8
8
  A Ruby client for the Slack [Web](https://api.slack.com/web) and [RealTime Messaging](https://api.slack.com/rtm) APIs. Comes with a handy command-line client, too.
9
9
 
10
- Writing a bot? Try [slack-ruby-bot](https://github.com/dblock/slack-ruby-bot) instead.
11
-
12
10
  ![](slack.png)
13
11
 
12
+ ## Useful to Me?
13
+
14
+ * This piece of the puzzle will help you send messages to Slack via the Web API and send and receive messages via the Real Time API.
15
+ * If you're trying to respond to slash commands, just write a basic web application and use this library to call the Slack Web API.
16
+ * If you're trying to build a Real Time bot, use [slack-ruby-bot](https://github.com/dblock/slack-ruby-bot), which uses this library.
17
+ * If you're trying to roll out a full service with Slack button integration to multiple teams, check out [slack-bot-server](https://github.com/dblock/slack-bot-server), which is built on top of slack-ruby-bot, which uses this library.
18
+
14
19
  ## Stable Release
15
20
 
16
- You're reading the documentation for [stable release, v0.5.0](https://github.com/dblock/slack-ruby-client/blob/v0.5.0/README.md). See [UPGRADING](UPGRADING.md) when upgrading from an older version.
21
+ You're reading the documentation for the **stable** release of slack-ruby-client, 0.5.1. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
17
22
 
18
23
  ## Installation
19
24
 
@@ -36,7 +41,7 @@ Run `bundle install`.
36
41
 
37
42
  ### Create a New Bot Integration
38
43
 
39
- This is something done in Slack, under [integrations](https://artsy.slack.com/services). Create a [new bot](https://artsy.slack.com/services/new/bot), and note its API token.
44
+ This is something done in Slack, under [integrations](https://my.slack.com/services). Create a [new bot](https://my.slack.com/services/new/bot), and note its API token.
40
45
 
41
46
  ![](screenshots/register-bot.png)
42
47
 
@@ -52,24 +57,58 @@ This sets a global default token. You can also pass a token into the initializer
52
57
 
53
58
  ### Web Client
54
59
 
55
- The Slack Web API allows you to build applications that interact with Slack. For example, send messages with [chat_PostMessage](https://api.slack.com/methods/chat.postMessage).
60
+ The Slack Web API allows you to build applications that interact with Slack.
61
+
62
+ #### Test Auth
56
63
 
57
64
  ```ruby
58
65
  client = Slack::Web::Client.new
59
-
60
66
  client.auth_test
67
+ ```
61
68
 
62
- general_channel = client.channels_list['channels'].detect { |c| c['name'] == 't3' }
69
+ #### Send Messages
63
70
 
64
- client.chat_postMessage(channel: general_channel['id'], text: 'Hello World', as_user: true)
71
+ Send messages with [chat_PostMessage](https://api.slack.com/methods/chat.postMessage).
72
+
73
+ ```ruby
74
+ client.chat_postMessage(channel: '#general', text: 'Hello World', as_user: true)
65
75
  ```
66
76
 
67
77
  See a fully working example in [examples/hi_web](examples/hi_web/hi.rb).
68
78
 
69
79
  ![](examples/hi_web/hi.gif)
70
80
 
81
+ #### List Channels
82
+
83
+ List channels with [channels_list](https://api.slack.com/methods/channels.list).
84
+
85
+ ```ruby
86
+ channels = client.channels_list['channels']
87
+
88
+ general_channel = channels.detect { |c| c['name'] == 'general' }
89
+ ```
90
+
91
+ #### Upload a File
92
+
93
+ Upload a file with [files_upload](https://api.slack.com/methods/files.upload).
94
+
95
+ ```ruby
96
+ client.files_upload(
97
+ channels: '#general',
98
+ as_user: true,
99
+ file: Faraday::UploadIO.new('/path/to/avatar.jpg', 'image/jpeg'),
100
+ title: 'My Avatar',
101
+ filename: 'avatar.jpg',
102
+ initial_comment: 'Attached a selfie.'
103
+ )
104
+ ```
105
+
106
+ #### Other
107
+
71
108
  Refer to the [Slack Web API Method Reference](https://api.slack.com/methods) for the list of all available functions.
72
109
 
110
+ #### Web Client Options
111
+
73
112
  You can configure the Web client either globally or via the initializer.
74
113
 
75
114
  ```ruby
@@ -276,6 +315,6 @@ See [CONTRIBUTING](CONTRIBUTING.md).
276
315
 
277
316
  ## Copyright and License
278
317
 
279
- Copyright (c) 2015, [Daniel Doubrovkine](https://twitter.com/dblockdotorg), [Artsy](https://www.artsy.net) and [Contributors](CHANGELOG.md).
318
+ Copyright (c) 2015-2016, [Daniel Doubrovkine](https://twitter.com/dblockdotorg), [Artsy](https://www.artsy.net) and [Contributors](CHANGELOG.md).
280
319
 
281
320
  This project is licensed under the [MIT License](LICENSE.md).
data/Rakefile CHANGED
@@ -11,9 +11,13 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
11
11
  spec.pattern = FileList['spec/**/*_spec.rb']
12
12
  end
13
13
 
14
- require 'rubocop/rake_task'
15
- RuboCop::RakeTask.new
14
+ if RUBY_ENGINE == 'rbx'
15
+ task default: [:spec]
16
+ else
17
+ require 'rubocop/rake_task'
18
+ RuboCop::RakeTask.new
16
19
 
17
- task default: [:rubocop, :spec]
20
+ task default: [:rubocop, :spec]
21
+ end
18
22
 
19
23
  load 'slack/web/api/tasks/generate.rake'
data/bin/commands.rb CHANGED
@@ -4,6 +4,7 @@ require 'commands/api'
4
4
  require 'commands/auth'
5
5
  require 'commands/channels'
6
6
  require 'commands/chat'
7
+ require 'commands/dnd'
7
8
  require 'commands/emoji'
8
9
  require 'commands/files'
9
10
  require 'commands/groups'
@@ -80,8 +80,8 @@ command 'channels' do |g|
80
80
  end
81
81
  end
82
82
 
83
- g.desc 'This method returns a list of all channels in the team. This includes channels the caller is in, channels'
84
- g.long_desc %( This method returns a list of all channels in the team. This includes channels the caller is in, channels they are not currently in, and archived channels. The number of (non-deactivated) members in each channel is also returned. )
83
+ g.desc 'This method returns a list of all channels in the team. This includes channels the caller is in, channels they are not currently in, and archived channels but does not include private channels. The number of (non-deactivated) members in each channel is also returned.'
84
+ g.long_desc %( This method returns a list of all channels in the team. This includes channels the caller is in, channels they are not currently in, and archived channels but does not include private channels. The number of (non-deactivated) members in each channel is also returned. )
85
85
  g.command 'list' do |c|
86
86
  c.flag 'exclude_archived', desc: "Don't return archived channels."
87
87
  c.action do |_global_options, options, _args|
@@ -0,0 +1,47 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ desc 'Adjust and view Do Not Disturb settings for team members'
4
+ command 'dnd' do |g|
5
+ g.desc "Ends the user's currently scheduled Do Not Disturb session immediately."
6
+ g.long_desc %( Ends the user's currently scheduled Do Not Disturb session immediately. )
7
+ g.command 'endDnd' do |c|
8
+ c.action do |_global_options, options, _args|
9
+ puts JSON.dump($client.dnd_endDnd(options))
10
+ end
11
+ end
12
+
13
+ g.desc "Ends the current user's snooze mode immediately."
14
+ g.long_desc %( Ends the current user's snooze mode immediately. )
15
+ g.command 'endSnooze' do |c|
16
+ c.action do |_global_options, options, _args|
17
+ puts JSON.dump($client.dnd_endSnooze(options))
18
+ end
19
+ end
20
+
21
+ g.desc "Provides information about a user's current Do Not Disturb settings."
22
+ g.long_desc %( Provides information about a user's current Do Not Disturb settings. )
23
+ g.command 'info' do |c|
24
+ c.flag 'user', desc: 'User to fetch status for (defaults to current user).'
25
+ c.action do |_global_options, options, _args|
26
+ puts JSON.dump($client.dnd_info(options))
27
+ end
28
+ end
29
+
30
+ g.desc "Adjusts the snooze duration for a user's Do Not Disturb settings. If a snooze session is not already active for the user, invoking this method will begin one for the specified duration."
31
+ g.long_desc %( Adjusts the snooze duration for a user's Do Not Disturb settings. If a snooze session is not already active for the user, invoking this method will begin one for the specified duration. )
32
+ g.command 'setSnooze' do |c|
33
+ c.flag 'num_minutes', desc: 'Number of minutes, from now, to snooze until.'
34
+ c.action do |_global_options, options, _args|
35
+ puts JSON.dump($client.dnd_setSnooze(options))
36
+ end
37
+ end
38
+
39
+ g.desc 'Provides information about the current Do Not Disturb settings for users of a Slack team.'
40
+ g.long_desc %( Provides information about the current Do Not Disturb settings for users of a Slack team. )
41
+ g.command 'teamInfo' do |c|
42
+ c.flag 'users', desc: 'Comma-separated list of users to fetch Do Not Disturb status for.'
43
+ c.action do |_global_options, options, _args|
44
+ puts JSON.dump($client.dnd_teamInfo(options))
45
+ end
46
+ end
47
+ end
@@ -53,7 +53,7 @@ You can pass multiple values in the types argument, like types=posts,snippets.Th
53
53
  c.flag 'filename', desc: 'Filename of file.'
54
54
  c.flag 'title', desc: 'Title of file.'
55
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.'
56
+ c.flag 'channels', desc: 'Comma-separated list of channel names or IDs where the file will be shared.'
57
57
  c.action do |_global_options, options, _args|
58
58
  puts JSON.dump($client.files_upload(options))
59
59
  end
@@ -1,47 +1,47 @@
1
1
  # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
2
 
3
- desc "Get info on your team's private groups."
3
+ desc "Get info on your team's private channels."
4
4
  command 'groups' do |g|
5
- g.desc 'This method archives a private group.'
6
- g.long_desc %( This method archives a private group. )
5
+ g.desc 'This method archives a private channel.'
6
+ g.long_desc %( This method archives a private channel. )
7
7
  g.command 'archive' do |c|
8
- c.flag 'channel', desc: 'Private group to archive.'
8
+ c.flag 'channel', desc: 'Private channel to archive.'
9
9
  c.action do |_global_options, options, _args|
10
10
  puts JSON.dump($client.groups_archive(options))
11
11
  end
12
12
  end
13
13
 
14
- g.desc 'This method closes a private group.'
15
- g.long_desc %( This method closes a private group. )
14
+ g.desc 'This method closes a private channel.'
15
+ g.long_desc %( This method closes a private channel. )
16
16
  g.command 'close' do |c|
17
- c.flag 'channel', desc: 'Group to close.'
17
+ c.flag 'channel', desc: 'Private channel to close.'
18
18
  c.action do |_global_options, options, _args|
19
19
  puts JSON.dump($client.groups_close(options))
20
20
  end
21
21
  end
22
22
 
23
- g.desc 'This method creates a private group.'
24
- g.long_desc %( This method creates a private group. )
23
+ g.desc 'This method creates a private channel.'
24
+ g.long_desc %( This method creates a private channel. )
25
25
  g.command 'create' do |c|
26
- c.flag 'name', desc: 'Name of group to create.'
26
+ c.flag 'name', desc: 'Name of private channel to create.'
27
27
  c.action do |_global_options, options, _args|
28
28
  puts JSON.dump($client.groups_create(options))
29
29
  end
30
30
  end
31
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: )
32
+ g.desc 'This method takes an existing private channel and performs the following steps:'
33
+ g.long_desc %( This method takes an existing private channel and performs the following steps: )
34
34
  g.command 'createChild' do |c|
35
- c.flag 'channel', desc: 'Group to clone and archive.'
35
+ c.flag 'channel', desc: 'Private channel to clone and archive.'
36
36
  c.action do |_global_options, options, _args|
37
37
  puts JSON.dump($client.groups_createChild(options))
38
38
  end
39
39
  end
40
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. )
41
+ g.desc 'This method returns a portion of messages/events from the specified private channel.'
42
+ 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. )
43
43
  g.command 'history' do |c|
44
- c.flag 'channel', desc: 'Group to fetch history for.'
44
+ c.flag 'channel', desc: 'Private channel to fetch history for.'
45
45
  c.flag 'latest', desc: 'End of time range of messages to include in results.'
46
46
  c.flag 'oldest', desc: 'Start of time range of messages to include in results.'
47
47
  c.flag 'inclusive', desc: 'Include messages with latest or oldest timestamp in results.'
@@ -51,106 +51,106 @@ command 'groups' do |g|
51
51
  end
52
52
  end
53
53
 
54
- g.desc 'This method returns information about a private group.'
55
- g.long_desc %( This method returns information about a private group. )
54
+ g.desc 'This method returns information about a private channel.'
55
+ g.long_desc %( This method returns information about a private channel. )
56
56
  g.command 'info' do |c|
57
- c.flag 'channel', desc: 'Group to get info on.'
57
+ c.flag 'channel', desc: 'Private channel to get info on.'
58
58
  c.action do |_global_options, options, _args|
59
59
  puts JSON.dump($client.groups_info(options))
60
60
  end
61
61
  end
62
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. )
63
+ 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.'
64
+ 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
65
  g.command 'invite' do |c|
66
- c.flag 'channel', desc: 'Private group to invite user to.'
66
+ c.flag 'channel', desc: 'Private channel to invite user to.'
67
67
  c.flag 'user', desc: 'User to invite.'
68
68
  c.action do |_global_options, options, _args|
69
69
  puts JSON.dump($client.groups_invite(options))
70
70
  end
71
71
  end
72
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. )
73
+ g.desc 'This method allows a user to remove another member from a private channel.'
74
+ g.long_desc %( This method allows a user to remove another member from a private channel. )
75
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.'
76
+ c.flag 'channel', desc: 'Private channel to remove user from.'
77
+ c.flag 'user', desc: 'User to remove from private channel.'
78
78
  c.action do |_global_options, options, _args|
79
79
  puts JSON.dump($client.groups_kick(options))
80
80
  end
81
81
  end
82
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. )
83
+ g.desc 'This method is used to leave a private channel.'
84
+ g.long_desc %( This method is used to leave a private channel. )
85
85
  g.command 'leave' do |c|
86
- c.flag 'channel', desc: 'Group to leave.'
86
+ c.flag 'channel', desc: 'Private channel to leave.'
87
87
  c.action do |_global_options, options, _args|
88
88
  puts JSON.dump($client.groups_leave(options))
89
89
  end
90
90
  end
91
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. )
92
+ 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.'
93
+ 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
94
  g.command 'list' do |c|
95
- c.flag 'exclude_archived', desc: "Don't return archived groups."
95
+ c.flag 'exclude_archived', desc: "Don't return archived private channels."
96
96
  c.action do |_global_options, options, _args|
97
97
  puts JSON.dump($client.groups_list(options))
98
98
  end
99
99
  end
100
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. )
101
+ g.desc 'This method moves the read cursor in a private channel.'
102
+ g.long_desc %( This method moves the read cursor in a private channel. )
103
103
  g.command 'mark' do |c|
104
- c.flag 'channel', desc: 'Group to set reading cursor in.'
104
+ c.flag 'channel', desc: 'Private channel to set reading cursor in.'
105
105
  c.flag 'ts', desc: 'Timestamp of the most recently seen message.'
106
106
  c.action do |_global_options, options, _args|
107
107
  puts JSON.dump($client.groups_mark(options))
108
108
  end
109
109
  end
110
110
 
111
- g.desc 'This method opens a private group.'
112
- g.long_desc %( This method opens a private group. )
111
+ g.desc 'This method opens a private channel.'
112
+ g.long_desc %( This method opens a private channel. )
113
113
  g.command 'open' do |c|
114
- c.flag 'channel', desc: 'Group to open.'
114
+ c.flag 'channel', desc: 'Private channel to open.'
115
115
  c.action do |_global_options, options, _args|
116
116
  puts JSON.dump($client.groups_open(options))
117
117
  end
118
118
  end
119
119
 
120
- g.desc 'This method renames a private group.'
121
- g.long_desc %( This method renames a private group. )
120
+ g.desc 'This method renames a private channel.'
121
+ g.long_desc %( This method renames a private channel. )
122
122
  g.command 'rename' do |c|
123
- c.flag 'channel', desc: 'Group to rename.'
124
- c.flag 'name', desc: 'New name for group.'
123
+ c.flag 'channel', desc: 'Private channel to rename.'
124
+ c.flag 'name', desc: 'New name for private channel.'
125
125
  c.action do |_global_options, options, _args|
126
126
  puts JSON.dump($client.groups_rename(options))
127
127
  end
128
128
  end
129
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. )
130
+ 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.'
131
+ 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. )
132
132
  g.command 'setPurpose' do |c|
133
- c.flag 'channel', desc: 'Private group to set the purpose of.'
133
+ c.flag 'channel', desc: 'Private channel to set the purpose of.'
134
134
  c.flag 'purpose', desc: 'The new purpose.'
135
135
  c.action do |_global_options, options, _args|
136
136
  puts JSON.dump($client.groups_setPurpose(options))
137
137
  end
138
138
  end
139
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. )
140
+ 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.'
141
+ 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. )
142
142
  g.command 'setTopic' do |c|
143
- c.flag 'channel', desc: 'Private group to set the topic of.'
143
+ c.flag 'channel', desc: 'Private channel to set the topic of.'
144
144
  c.flag 'topic', desc: 'The new topic.'
145
145
  c.action do |_global_options, options, _args|
146
146
  puts JSON.dump($client.groups_setTopic(options))
147
147
  end
148
148
  end
149
149
 
150
- g.desc 'This method unarchives a private group.'
151
- g.long_desc %( This method unarchives a private group. )
150
+ g.desc 'This method unarchives a private channel.'
151
+ g.long_desc %( This method unarchives a private channel. )
152
152
  g.command 'unarchive' do |c|
153
- c.flag 'channel', desc: 'Group to unarchive.'
153
+ c.flag 'channel', desc: 'Private channel to unarchive.'
154
154
  c.action do |_global_options, options, _args|
155
155
  puts JSON.dump($client.groups_unarchive(options))
156
156
  end
data/bin/commands/team.rb CHANGED
@@ -22,7 +22,7 @@ command 'team' do |g|
22
22
  g.long_desc %( This method lists the integration activity logs for a team, including when integrations are added, modified and removed. This method can only be called by Admins. )
23
23
  g.command 'integrationLogs' do |c|
24
24
  c.flag 'service_id', desc: 'Filter logs to this service. Defaults to all logs.'
25
- c.flag 'app_id', desc: 'Filter logs to this API application. Defaults to all logs.'
25
+ c.flag 'app_id', desc: 'Filter logs to this Slack app. Defaults to all logs.'
26
26
  c.flag 'user', desc: "Filter logs generated by this user's actions. Defaults to all logs."
27
27
  c.flag 'change_type', desc: 'Filter logs with this change type. Defaults to all logs.'
28
28
  c.action do |_global_options, options, _args|
data/lib/slack/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Slack
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
3
3
  end
@@ -4,6 +4,7 @@ require 'slack/web/api/endpoints/api'
4
4
  require 'slack/web/api/endpoints/auth'
5
5
  require 'slack/web/api/endpoints/channels'
6
6
  require 'slack/web/api/endpoints/chat'
7
+ require 'slack/web/api/endpoints/dnd'
7
8
  require 'slack/web/api/endpoints/emoji'
8
9
  require 'slack/web/api/endpoints/files'
9
10
  require 'slack/web/api/endpoints/groups'
@@ -27,6 +28,7 @@ module Slack
27
28
  include Auth
28
29
  include Channels
29
30
  include Chat
31
+ include Dnd
30
32
  include Emoji
31
33
  include Files
32
34
  include Groups
@@ -119,9 +119,7 @@ module Slack
119
119
  end
120
120
 
121
121
  #
122
- # This method returns a list of all channels in the team. This includes channels the caller is in, channels
123
- # they are not currently in, and archived channels. The number of (non-deactivated) members in each channel
124
- # is also returned.
122
+ # This method returns a list of all channels in the team. This includes channels the caller is in, channels they are not currently in, and archived channels but does not include private channels. The number of (non-deactivated) members in each channel is also returned.
125
123
  #
126
124
  # @option options [Object] :exclude_archived
127
125
  # Don't return archived channels.
@@ -0,0 +1,63 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ module Slack
4
+ module Web
5
+ module Api
6
+ module Endpoints
7
+ module Dnd
8
+ #
9
+ # Ends the user's currently scheduled Do Not Disturb session immediately.
10
+ #
11
+ # @see https://api.slack.com/methods/dnd.endDnd
12
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/dnd.endDnd.json
13
+ def dnd_endDnd(options = {})
14
+ post('dnd.endDnd', options)
15
+ end
16
+
17
+ #
18
+ # Ends the current user's snooze mode immediately.
19
+ #
20
+ # @see https://api.slack.com/methods/dnd.endSnooze
21
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/dnd.endSnooze.json
22
+ def dnd_endSnooze(options = {})
23
+ post('dnd.endSnooze', options)
24
+ end
25
+
26
+ #
27
+ # Provides information about a user's current Do Not Disturb settings.
28
+ #
29
+ # @option options [user] :user
30
+ # User to fetch status for (defaults to current user).
31
+ # @see https://api.slack.com/methods/dnd.info
32
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/dnd.info.json
33
+ def dnd_info(options = {})
34
+ post('dnd.info', options)
35
+ end
36
+
37
+ #
38
+ # Adjusts the snooze duration for a user's Do Not Disturb settings. If a snooze session is not already active for the user, invoking this method will begin one for the specified duration.
39
+ #
40
+ # @option options [Object] :num_minutes
41
+ # Number of minutes, from now, to snooze until.
42
+ # @see https://api.slack.com/methods/dnd.setSnooze
43
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/dnd.setSnooze.json
44
+ def dnd_setSnooze(options = {})
45
+ throw ArgumentError.new('Required arguments :num_minutes missing') if options[:num_minutes].nil?
46
+ post('dnd.setSnooze', options)
47
+ end
48
+
49
+ #
50
+ # Provides information about the current Do Not Disturb settings for users of a Slack team.
51
+ #
52
+ # @option options [Object] :users
53
+ # Comma-separated list of users to fetch Do Not Disturb status for.
54
+ # @see https://api.slack.com/methods/dnd.teamInfo
55
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/dnd.teamInfo.json
56
+ def dnd_teamInfo(options = {})
57
+ post('dnd.teamInfo', options)
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -74,10 +74,12 @@ module Slack
74
74
  # @option options [Object] :initial_comment
75
75
  # Initial comment to add to file.
76
76
  # @option options [Object] :channels
77
- # Comma separated list of channels to share the file into.
77
+ # Comma-separated list of channel names or IDs where the file will be shared.
78
78
  # @see https://api.slack.com/methods/files.upload
79
79
  # @see https://github.com/dblock/slack-api-ref/blob/master/methods/files.upload.json
80
80
  def files_upload(options = {})
81
+ throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
82
+ throw ArgumentError.new('Required arguments :filename missing') if options[:filename].nil?
81
83
  post('files.upload', options)
82
84
  end
83
85
  end
@@ -6,10 +6,10 @@ module Slack
6
6
  module Endpoints
7
7
  module Groups
8
8
  #
9
- # This method archives a private group.
9
+ # This method archives a private channel.
10
10
  #
11
11
  # @option options [group] :channel
12
- # Private group to archive.
12
+ # Private channel to archive.
13
13
  # @see https://api.slack.com/methods/groups.archive
14
14
  # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.archive.json
15
15
  def groups_archive(options = {})
@@ -18,10 +18,10 @@ module Slack
18
18
  end
19
19
 
20
20
  #
21
- # This method closes a private group.
21
+ # This method closes a private channel.
22
22
  #
23
23
  # @option options [group] :channel
24
- # Group to close.
24
+ # Private channel to close.
25
25
  # @see https://api.slack.com/methods/groups.close
26
26
  # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.close.json
27
27
  def groups_close(options = {})
@@ -30,10 +30,10 @@ module Slack
30
30
  end
31
31
 
32
32
  #
33
- # This method creates a private group.
33
+ # This method creates a private channel.
34
34
  #
35
35
  # @option options [Object] :name
36
- # Name of group to create.
36
+ # Name of private channel to create.
37
37
  # @see https://api.slack.com/methods/groups.create
38
38
  # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.create.json
39
39
  def groups_create(options = {})
@@ -42,10 +42,10 @@ module Slack
42
42
  end
43
43
 
44
44
  #
45
- # This method takes an existing private group and performs the following steps:
45
+ # This method takes an existing private channel and performs the following steps:
46
46
  #
47
47
  # @option options [group] :channel
48
- # Group to clone and archive.
48
+ # Private channel to clone and archive.
49
49
  # @see https://api.slack.com/methods/groups.createChild
50
50
  # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.createChild.json
51
51
  def groups_createChild(options = {})
@@ -54,12 +54,12 @@ module Slack
54
54
  end
55
55
 
56
56
  #
57
- # This method returns a portion of messages/events from the specified private group.
58
- # To read the entire history for a group, call the method with no latest or
57
+ # This method returns a portion of messages/events from the specified private channel.
58
+ # To read the entire history for a private channel, call the method with no latest or
59
59
  # oldest arguments, and then continue paging using the instructions below.
60
60
  #
61
61
  # @option options [group] :channel
62
- # Group to fetch history for.
62
+ # Private channel to fetch history for.
63
63
  # @option options [timestamp] :latest
64
64
  # End of time range of messages to include in results.
65
65
  # @option options [timestamp] :oldest
@@ -76,10 +76,10 @@ module Slack
76
76
  end
77
77
 
78
78
  #
79
- # This method returns information about a private group.
79
+ # This method returns information about a private channel.
80
80
  #
81
81
  # @option options [group] :channel
82
- # Group to get info on.
82
+ # Private channel to get info on.
83
83
  # @see https://api.slack.com/methods/groups.info
84
84
  # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.info.json
85
85
  def groups_info(options = {})
@@ -88,10 +88,10 @@ module Slack
88
88
  end
89
89
 
90
90
  #
91
- # This method is used to invite a user to a private group. The calling user must be a member of the group.
91
+ # This method is used to invite a user to a private channel. The calling user must be a member of the private channel.
92
92
  #
93
93
  # @option options [group] :channel
94
- # Private group to invite user to.
94
+ # Private channel to invite user to.
95
95
  # @option options [user] :user
96
96
  # User to invite.
97
97
  # @see https://api.slack.com/methods/groups.invite
@@ -103,12 +103,12 @@ module Slack
103
103
  end
104
104
 
105
105
  #
106
- # This method allows a user to remove another member from a private group.
106
+ # This method allows a user to remove another member from a private channel.
107
107
  #
108
108
  # @option options [group] :channel
109
- # Group to remove user from.
109
+ # Private channel to remove user from.
110
110
  # @option options [user] :user
111
- # User to remove from group.
111
+ # User to remove from private channel.
112
112
  # @see https://api.slack.com/methods/groups.kick
113
113
  # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.kick.json
114
114
  def groups_kick(options = {})
@@ -118,10 +118,10 @@ module Slack
118
118
  end
119
119
 
120
120
  #
121
- # This method is used to leave a private group.
121
+ # This method is used to leave a private channel.
122
122
  #
123
123
  # @option options [group] :channel
124
- # Group to leave.
124
+ # Private channel to leave.
125
125
  # @see https://api.slack.com/methods/groups.leave
126
126
  # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.leave.json
127
127
  def groups_leave(options = {})
@@ -130,11 +130,11 @@ module Slack
130
130
  end
131
131
 
132
132
  #
133
- # This method returns a list of groups in the team that the caller is in and archived groups that the caller was in.
134
- # The list of (non-deactivated) members in each group is also returned.
133
+ # This method returns a list of private channels in the team that the caller is in and archived groups that the caller was in.
134
+ # The list of (non-deactivated) members in each private channel is also returned.
135
135
  #
136
136
  # @option options [Object] :exclude_archived
137
- # Don't return archived groups.
137
+ # Don't return archived private channels.
138
138
  # @see https://api.slack.com/methods/groups.list
139
139
  # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.list.json
140
140
  def groups_list(options = {})
@@ -142,10 +142,10 @@ module Slack
142
142
  end
143
143
 
144
144
  #
145
- # This method moves the read cursor in a private group.
145
+ # This method moves the read cursor in a private channel.
146
146
  #
147
147
  # @option options [group] :channel
148
- # Group to set reading cursor in.
148
+ # Private channel to set reading cursor in.
149
149
  # @option options [timestamp] :ts
150
150
  # Timestamp of the most recently seen message.
151
151
  # @see https://api.slack.com/methods/groups.mark
@@ -157,10 +157,10 @@ module Slack
157
157
  end
158
158
 
159
159
  #
160
- # This method opens a private group.
160
+ # This method opens a private channel.
161
161
  #
162
162
  # @option options [group] :channel
163
- # Group to open.
163
+ # Private channel to open.
164
164
  # @see https://api.slack.com/methods/groups.open
165
165
  # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.open.json
166
166
  def groups_open(options = {})
@@ -169,12 +169,12 @@ module Slack
169
169
  end
170
170
 
171
171
  #
172
- # This method renames a private group.
172
+ # This method renames a private channel.
173
173
  #
174
174
  # @option options [group] :channel
175
- # Group to rename.
175
+ # Private channel to rename.
176
176
  # @option options [Object] :name
177
- # New name for group.
177
+ # New name for private channel.
178
178
  # @see https://api.slack.com/methods/groups.rename
179
179
  # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.rename.json
180
180
  def groups_rename(options = {})
@@ -184,10 +184,10 @@ module Slack
184
184
  end
185
185
 
186
186
  #
187
- # This method is used to change the purpose of a private group. The calling user must be a member of the private group.
187
+ # This method is used to change the purpose of a private channel. The calling user must be a member of the private channel.
188
188
  #
189
189
  # @option options [group] :channel
190
- # Private group to set the purpose of.
190
+ # Private channel to set the purpose of.
191
191
  # @option options [Object] :purpose
192
192
  # The new purpose.
193
193
  # @see https://api.slack.com/methods/groups.setPurpose
@@ -199,10 +199,10 @@ module Slack
199
199
  end
200
200
 
201
201
  #
202
- # This method is used to change the topic of a private group. The calling user must be a member of the private group.
202
+ # This method is used to change the topic of a private channel. The calling user must be a member of the private channel.
203
203
  #
204
204
  # @option options [group] :channel
205
- # Private group to set the topic of.
205
+ # Private channel to set the topic of.
206
206
  # @option options [Object] :topic
207
207
  # The new topic.
208
208
  # @see https://api.slack.com/methods/groups.setTopic
@@ -214,10 +214,10 @@ module Slack
214
214
  end
215
215
 
216
216
  #
217
- # This method unarchives a private group.
217
+ # This method unarchives a private channel.
218
218
  #
219
219
  # @option options [group] :channel
220
- # Group to unarchive.
220
+ # Private channel to unarchive.
221
221
  # @see https://api.slack.com/methods/groups.unarchive
222
222
  # @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups.unarchive.json
223
223
  def groups_unarchive(options = {})
@@ -29,7 +29,7 @@ module Slack
29
29
  # @option options [Object] :service_id
30
30
  # Filter logs to this service. Defaults to all logs.
31
31
  # @option options [Object] :app_id
32
- # Filter logs to this API application. Defaults to all logs.
32
+ # Filter logs to this Slack app. Defaults to all logs.
33
33
  # @option options [user] :user
34
34
  # Filter logs generated by this user's actions. Defaults to all logs.
35
35
  # @option options [Object] :change_type
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.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-07 00:00:00.000000000 Z
11
+ date: 2016-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -204,6 +204,7 @@ files:
204
204
  - bin/commands/auth.rb
205
205
  - bin/commands/channels.rb
206
206
  - bin/commands/chat.rb
207
+ - bin/commands/dnd.rb
207
208
  - bin/commands/emoji.rb
208
209
  - bin/commands/files.rb
209
210
  - bin/commands/groups.rb
@@ -251,6 +252,7 @@ files:
251
252
  - lib/slack/web/api/endpoints/auth.rb
252
253
  - lib/slack/web/api/endpoints/channels.rb
253
254
  - lib/slack/web/api/endpoints/chat.rb
255
+ - lib/slack/web/api/endpoints/dnd.rb
254
256
  - lib/slack/web/api/endpoints/emoji.rb
255
257
  - lib/slack/web/api/endpoints/files.rb
256
258
  - lib/slack/web/api/endpoints/groups.rb