slack-ruby-bot-server-rtm 0.1.1 → 0.2.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.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/README.md +14 -2
- data/lib/slack-ruby-bot-server-rtm/lifecycle.rb +3 -1
- data/lib/slack-ruby-bot-server-rtm/server.rb +7 -3
- data/lib/slack-ruby-bot-server-rtm/version.rb +1 -1
- data/sample_apps/sample_app_activerecord/db/migrate/20201125164500_add_oauth_fields.rb +8 -0
- data/sample_apps/sample_app_activerecord/db/schema.rb +5 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0994639f48c3a767e5fbc7fd32ad3562b10c441bd9501c281e2fb319ac9f6b1d'
|
4
|
+
data.tar.gz: c3a15360020d5c583c51d62638a1173242f90436688ce42449ed1c8252078999
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6120ad611f46756377074d921b58c0d96e6d9d6e5939e6f53c01c09ed82803271d4cd9491a337f36130e7a59fbf130d64655b813724cde8151cf4597c99857b0
|
7
|
+
data.tar.gz: dab2bb5ef2aef7e94701667f169f4d8a185f6921ade0a5391e3e177f36cd4976d813558e07237dd911737d3e4aa2a9b681b33e2830ac0ff97836f8a91488d744
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2020-11-
|
3
|
+
# on 2020-11-27 15:32:33 -0500 using RuboCop version 0.81.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
### Changelog
|
2
2
|
|
3
|
+
#### 0.2.0 (2020/11/27)
|
4
|
+
|
5
|
+
* [#1](https://github.com/slack-ruby/slack-ruby-bot-server-rtm/pull/1): Only start OAuth v1 teams with a bot token - [@dblock](https://github.com/dblock).
|
6
|
+
|
3
7
|
#### 0.1.1 (2020/11/15)
|
4
8
|
|
5
9
|
* Fix: error `private method 'run_callbacks' called for #<SlackRubyBotServer::Service>` - [@dblock](https://github.com/dblock).
|
data/README.md
CHANGED
@@ -2,9 +2,21 @@ Slack Ruby Bot Server RealTime (RTM) Extension
|
|
2
2
|
==============================================
|
3
3
|
|
4
4
|
[](https://badge.fury.io/rb/slack-ruby-bot-server-rtm)
|
5
|
-
[](https://travis-ci.org/slack-ruby/slack-ruby-bot-server-rtm)
|
6
6
|
|
7
|
-
|
7
|
+
# Table of Contents
|
8
|
+
|
9
|
+
- [Introduction](#introduction)
|
10
|
+
- [Samples](#samples)
|
11
|
+
- [Usage](#usage)
|
12
|
+
- [Gemfile](#gemfile)
|
13
|
+
- [Configure](#configure)
|
14
|
+
- [Server Class](#server-class)
|
15
|
+
- [Copyright & License](#copyright--license)
|
16
|
+
|
17
|
+
### Introduction
|
18
|
+
|
19
|
+
This library is an extension to [slack-ruby-bot-server](https://github.com/slack-ruby/slack-ruby-bot-server) that makes it easy to implement Slack RTM bots.
|
8
20
|
|
9
21
|
### Samples
|
10
22
|
|
@@ -5,6 +5,8 @@ SlackRubyBotServer.configure do |config|
|
|
5
5
|
end
|
6
6
|
|
7
7
|
SlackRubyBotServer::Config.service_class.instance.on :starting do |team, _error, options|
|
8
|
+
next if team.respond_to?(:oauth_version) && team.oauth_version != 'v1'
|
9
|
+
|
8
10
|
SlackRubyBotServer::Config.service_class.instance.logger.info "Starting real-time team #{team}."
|
9
11
|
options = { team: team }
|
10
12
|
server = SlackRubyBotServer::RealTime::Config.server_class.new(options)
|
@@ -26,6 +28,6 @@ SlackRubyBotServer::Config.service_class.instance.on :stopped do |team, _error,
|
|
26
28
|
end
|
27
29
|
|
28
30
|
SlackRubyBotServer::Config.service_class.instance.on :deactivated do |team, _error, _options|
|
29
|
-
SlackRubyBotServer::Config.service_class.instance.logger.info "De-
|
31
|
+
SlackRubyBotServer::Config.service_class.instance.logger.info "De-activated real-time team #{team}."
|
30
32
|
team.server = nil
|
31
33
|
end
|
@@ -23,9 +23,13 @@ module SlackRubyBotServer
|
|
23
23
|
rescue StandardError => e
|
24
24
|
SlackRubyBotServer::Config.service_class.instance.send(:run_callbacks, :error, team, e)
|
25
25
|
case e.message
|
26
|
-
when 'account_inactive', 'invalid_auth'
|
27
|
-
|
28
|
-
|
26
|
+
when 'account_inactive', 'invalid_auth'
|
27
|
+
if team.respond_to?(:oauth_version) && team.oauth_version != 'v1'
|
28
|
+
SlackRubyBotServer::Config.service_class.instance.logger.info "#{team.name}: #{e.message}, team OAuth scope has been upgraded."
|
29
|
+
else
|
30
|
+
SlackRubyBotServer::Config.service_class.instance.logger.error "#{team.name}: #{e.message}, team will be deactivated."
|
31
|
+
SlackRubyBotServer::Config.service_class.instance.deactivate! team
|
32
|
+
end
|
29
33
|
else
|
30
34
|
wait = e.retry_after if e.is_a?(Slack::Web::Api::Errors::TooManyRequestsError)
|
31
35
|
SlackRubyBotServer::Config.service_class.instance.logger.error "#{team.name}: #{e.message}, restarting in #{wait} second(s)."
|
@@ -12,7 +12,7 @@
|
|
12
12
|
#
|
13
13
|
# It's strongly recommended that you check this file into your version control system.
|
14
14
|
|
15
|
-
ActiveRecord::Schema.define(version:
|
15
|
+
ActiveRecord::Schema.define(version: 20_201_125_164_500) do
|
16
16
|
# These are extensions that must be enabled in order to support this database
|
17
17
|
enable_extension 'plpgsql'
|
18
18
|
|
@@ -22,10 +22,12 @@ ActiveRecord::Schema.define(version: 20_190_323_181_453) do
|
|
22
22
|
t.boolean 'active', default: true
|
23
23
|
t.string 'domain'
|
24
24
|
t.string 'token'
|
25
|
-
t.datetime 'created_at',
|
26
|
-
t.datetime 'updated_at',
|
25
|
+
t.datetime 'created_at', null: false
|
26
|
+
t.datetime 'updated_at', null: false
|
27
27
|
t.string 'bot_user_id'
|
28
28
|
t.string 'activated_user_id'
|
29
29
|
t.string 'activated_user_access_token'
|
30
|
+
t.string 'oauth_scope'
|
31
|
+
t.string 'oauth_version', default: 'v1', null: false
|
30
32
|
end
|
31
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack-ruby-bot-server-rtm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Doubrovkine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-websocket
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- sample_apps/sample_app_activerecord/config/postgresql.yml
|
97
97
|
- sample_apps/sample_app_activerecord/db/migrate/20170307164946_create_teams_table.rb
|
98
98
|
- sample_apps/sample_app_activerecord/db/migrate/20190323181453_add_activated_fields.rb
|
99
|
+
- sample_apps/sample_app_activerecord/db/migrate/20201125164500_add_oauth_fields.rb
|
99
100
|
- sample_apps/sample_app_activerecord/db/schema.rb
|
100
101
|
- sample_apps/sample_app_activerecord/spec/api/root_spec.rb
|
101
102
|
- sample_apps/sample_app_activerecord/spec/commands/help_spec.rb
|