dev_training_bot 1.0.5 → 1.1.0
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35194d81f801d6bffaf4cd64320d3aef488681087d12f1ff40af5268494a92ef
|
4
|
+
data.tar.gz: ecbaef26de77f59111412a27ba519f7bb92d2c9b732993cd96e94a449c0b51d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ef9ad25829c9fe845c752e76feedce616b745c1219ef46825a3d9de06694391780f656df69c54c41bc97bd6966e77d642ee75ab8bf180088404e642f469f838
|
7
|
+
data.tar.gz: d546749b38dc56c1a5163af8757e9a868bc83815271238dac941543e3e1116ee8dbf075dab67256795dcefbd6b207ef9004025c8e14140564ca37699e36fb59a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -18,6 +18,7 @@ Generate a [token](https://api.slack.com/custom-integrations/legacy-tokens) for
|
|
18
18
|
Configure the following environment variables:
|
19
19
|
```sh
|
20
20
|
CLIENT_SECRETS_PATH="$HOME/.client_secrets.json"
|
21
|
+
CLIENT_TOKEN_PATH="$HOME/.token.yaml"
|
21
22
|
FILE_ID=<Google Docs file id>
|
22
23
|
SLACK_API_TOKEN=<your slack user token>
|
23
24
|
SLACK_CHANNEL="#your_channel"
|
data/lib/dev_training_bot/cli.rb
CHANGED
@@ -32,8 +32,13 @@ module DevTrainingBot
|
|
32
32
|
end
|
33
33
|
|
34
34
|
desc 'publish', "Send a poll to the #{ENV['SLACK_CHANNEL']} channel"
|
35
|
+
method_option :exclude,
|
36
|
+
aliases: '-e',
|
37
|
+
type: :array,
|
38
|
+
desc: 'Exclude authors from the final list'
|
35
39
|
def publish
|
36
|
-
|
40
|
+
topics = topic_service.to_poll(exclude: options[:exclude])
|
41
|
+
slack_service.create_poll(topics)
|
37
42
|
slack_service.link_doc
|
38
43
|
say 'Successfully published the poll!', :green
|
39
44
|
end
|
@@ -6,7 +6,7 @@ module DevTrainingBot
|
|
6
6
|
OOB_URI = 'urn:ietf:wg:oauth:2.0:oob'.freeze
|
7
7
|
APPLICATION_NAME = 'Dev Training Bot'.freeze
|
8
8
|
CLIENT_SECRETS_PATH = ENV['CLIENT_SECRETS_PATH'].freeze
|
9
|
-
CREDENTIALS_PATH = '
|
9
|
+
CREDENTIALS_PATH = ENV['CLIENT_TOKEN_PATH'].freeze
|
10
10
|
SCOPE = Google::Apis::DriveV3::AUTH_DRIVE_READONLY
|
11
11
|
DOC_URL = "https://docs.google.com/document/d/#{ENV['FILE_ID']}".freeze
|
12
12
|
FORMATS = {
|
@@ -7,9 +7,9 @@ module DevTrainingBot
|
|
7
7
|
@drive_service = drive_service
|
8
8
|
end
|
9
9
|
|
10
|
-
def to_poll
|
10
|
+
def to_poll(exclude: [])
|
11
11
|
return '' if empty?
|
12
|
-
"\"#{topics.first(10).join('" "')}\""
|
12
|
+
"\"#{topics.reject { |topic| topic.author.in?(exclude) }.first(10).join('" "')}\""
|
13
13
|
end
|
14
14
|
|
15
15
|
def content
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dev_training_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Marchante
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chronic
|