slack-ruby-bot-server 2.1.1 → 2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe48cdcb6c79a078efd57c77f7a4398fbf322c9f9d18273d034d5d03fee5e891
4
- data.tar.gz: 7c191f0dde13331ef4c729d03c786f1bf204f707d5d70a671c9dd9c49260a786
3
+ metadata.gz: b8080b3ce56aef52adfa56d9a44dd41441a3d5a1cade523ba0efeab835bdb49f
4
+ data.tar.gz: 13a73f38797ac35168f7367a63fec5a77ec8557eb28ee276b7c4908dc32ce3fc
5
5
  SHA512:
6
- metadata.gz: 31d2a6cb3ce5b0f4f4b15b42422f82ab5ac34ff34098c9bf6843da8473f669fe62b543d7b594d1fa831e205839a321824ebdcbc7dafd2d369a41ec23fec88c44
7
- data.tar.gz: 934b76c1bbacad15e7988d4732ce3f904f6c872a3e36186d00d3833370831f318700a768098fa433410b3b0941c2387d6868849c9e4f20fef7f06f8618c84569
6
+ metadata.gz: ac49a4aecc5e9fde9b9cfd3e8587875997cc397a122a7a186ab75718bb4d9dfd33969feb8c5d8ec29b584bfb6d886f3b2acda784487e43cab347afe56d093581
7
+ data.tar.gz: 87200e20d325daed6597d119df0726ec9da6f7b908300d49c2adbac82a124ff3f55e90373585de643a4a1a161a6f7b4869f6338fbdd24f00c72f4afc9ee451e7
@@ -4,6 +4,8 @@ on: [pull_request]
4
4
  jobs:
5
5
  danger:
6
6
  runs-on: ubuntu-latest
7
+ env:
8
+ BUNDLE_GEMFILE: Gemfile.danger
7
9
  steps:
8
10
  - uses: actions/checkout@v2
9
11
  with:
@@ -11,13 +13,10 @@ jobs:
11
13
  - name: Set up Ruby
12
14
  uses: ruby/setup-ruby@v1
13
15
  with:
14
- ruby-version: 2.6
16
+ ruby-version: 2.7
15
17
  bundler-cache: true
16
18
  - name: Run Danger
17
- env:
18
- BUNDLE_GEMFILE: Gemfile.danger
19
19
  run: |
20
- bundle install
21
20
  # the personal token is public, this is ok, base64 encode to avoid tripping Github
22
21
  TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | base64 --decode)
23
22
  DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
@@ -10,7 +10,7 @@ jobs:
10
10
  - name: Set up Ruby
11
11
  uses: ruby/setup-ruby@v1
12
12
  with:
13
- ruby-version: '3.1'
13
+ ruby-version: 3.4
14
14
  bundler-cache: true
15
15
  - name: Run RuboCop
16
16
  run: bundle exec rubocop
@@ -7,12 +7,15 @@ jobs:
7
7
  strategy:
8
8
  matrix:
9
9
  entry:
10
- - { ruby: 2.6.2, mongoid: 6.4.8, mongodb: 4.4 }
11
- - { ruby: 2.6.2, mongoid: 7.2.3, mongodb: 4.4 }
12
- - { ruby: 2.6.2, mongoid: 7.3.0, mongodb: 4.4 }
13
- - { ruby: 3.1.1, mongoid: 7.3.0, mongodb: 4.4 }
14
- - { ruby: 3.1.1, mongoid: 7.3.0, mongodb: 5.0 }
15
- - { ruby: 3.2.1, mongoid: 7.5.2, mongodb: 5.0 }
10
+ - { ruby: 3.2, mongoid: 6.4.8, mongodb: 4.4 }
11
+ - { ruby: 3.2, mongoid: 7.2.3, mongodb: 4.4 }
12
+ - { ruby: 3.2, mongoid: 7.3.0, mongodb: 4.4 }
13
+ - { ruby: 3.2, mongoid: 7.3.0, mongodb: 4.4 }
14
+ - { ruby: 3.3, mongoid: 7.3.0, mongodb: 5.0 }
15
+ - { ruby: 3.4, mongoid: 7.5.2, mongodb: 5.0 }
16
+ - { ruby: 3.4, mongoid: 8.1.11, mongodb: 6.0 }
17
+ - { ruby: 3.4, mongoid: 8.1.11, mongodb: 7.0 }
18
+ - { ruby: 3.4, mongoid: 8.1.11, mongodb: 8.0 }
16
19
  name: test (ruby=${{ matrix.entry.ruby }}, mongoid=${{ matrix.entry.mongoid }}, mongodb=${{ matrix.entry.mongodb }})
17
20
  steps:
18
21
  - uses: actions/checkout@v2
@@ -7,9 +7,14 @@ jobs:
7
7
  strategy:
8
8
  matrix:
9
9
  entry:
10
- - { ruby: 2.6.2, postgresql: 11, active_record: '~> 6.0.0' }
11
- - { ruby: 3.1.1, postgresql: 11, active_record: '~> 6.1.0' }
12
- - { ruby: 3.1.1, postgresql: 14, active_record: '~> 7.0.0' }
10
+ - { ruby: 3.2, postgresql: 11, active_record: '~> 6.0.0' }
11
+ - { ruby: 3.2, postgresql: 11, active_record: '~> 6.1.0' }
12
+ - { ruby: 3.2, postgresql: 14, active_record: '~> 7.0.0' }
13
+ - { ruby: 3.3, postgresql: 14, active_record: '~> 7.2.0' }
14
+ - { ruby: 3.4, postgresql: 14, active_record: '~> 7.2.0' }
15
+ - { ruby: 3.4, postgresql: 15, active_record: '~> 8.0.2' }
16
+ - { ruby: 3.4, postgresql: 16, active_record: '~> 8.0.2' }
17
+ - { ruby: 3.4, postgresql: 17, active_record: '~> 8.0.2' }
13
18
  name: test (ruby=${{ matrix.entry.ruby }}, postgresql=${{ matrix.entry.postgresql }}, active_record=${{ matrix.entry.active_record }})
14
19
  steps:
15
20
  - uses: actions/checkout@v2
data/.rubocop.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  AllCops:
2
2
  SuggestExtensions: false
3
3
  TargetRubyVersion: 2.6
4
+ NewCops: enable
4
5
 
5
6
  Metrics:
6
7
  Enabled: false
data/.rubocop_todo.yml CHANGED
@@ -1,14 +1,19 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2023-03-02 20:56:34 UTC using RuboCop version 1.47.0.
3
+ # on 2025-09-22 12:22:59 UTC using RuboCop version 1.80.2.
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
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
+ # Offense count: 2
10
+ # Configuration parameters: Severity.
11
+ Bundler/DuplicatedGroup:
12
+ Exclude:
13
+ - 'Gemfile'
14
+
9
15
  # Offense count: 1
10
- # Configuration parameters: Severity, Include.
11
- # Include: **/*.gemspec
16
+ # Configuration parameters: Severity.
12
17
  Gemspec/RequiredRubyVersion:
13
18
  Exclude:
14
19
  - 'slack-ruby-bot-server.gemspec'
@@ -38,12 +43,18 @@ Lint/ConstantDefinitionInBlock:
38
43
  Exclude:
39
44
  - 'lib/slack-ruby-bot-server/models/team/methods.rb'
40
45
 
46
+ # Offense count: 1
47
+ Lint/UselessDefined:
48
+ Exclude:
49
+ - 'lib/slack-ruby-bot-server/ext/bson/object_id.rb'
50
+
41
51
  # Offense count: 1
42
52
  # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
43
53
  # CheckDefinitionPathHierarchyRoots: lib, spec, test, src
44
54
  # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
45
55
  Naming/FileName:
46
56
  Exclude:
57
+ - 'Rakefile.rb'
47
58
  - 'lib/slack-ruby-bot-server.rb'
48
59
 
49
60
  # Offense count: 1
@@ -62,7 +73,7 @@ Naming/MethodParameterName:
62
73
  - 'lib/slack-ruby-bot-server/models/team/mongoid.rb'
63
74
  - 'lib/slack-ruby-bot-server/service.rb'
64
75
 
65
- # Offense count: 5
76
+ # Offense count: 6
66
77
  # This cop supports safe autocorrection (--autocorrect).
67
78
  # Configuration parameters: EnforcedStyle.
68
79
  # SupportedStyles: separated, grouped
@@ -70,6 +81,13 @@ Style/AccessorGrouping:
70
81
  Exclude:
71
82
  - 'lib/slack-ruby-bot-server/config.rb'
72
83
 
84
+ # Offense count: 2
85
+ # This cop supports unsafe autocorrection (--autocorrect-all).
86
+ Style/CollectionQuerying:
87
+ Exclude:
88
+ - 'lib/slack-ruby-bot-server/api/helpers/error_helpers.rb'
89
+ - 'lib/slack-ruby-bot-server/api/helpers/sort_helpers.rb'
90
+
73
91
  # Offense count: 3
74
92
  # This cop supports unsafe autocorrection (--autocorrect-all).
75
93
  Style/GlobalStdStream:
@@ -77,16 +95,6 @@ Style/GlobalStdStream:
77
95
  - 'spec/database_adapters/activerecord/activerecord.rb'
78
96
  - 'tasks/db.rake'
79
97
 
80
- # Offense count: 18
81
- # This cop supports safe autocorrection (--autocorrect).
82
- # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
83
- # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
84
- # SupportedShorthandSyntax: always, never, either, consistent
85
- Style/HashSyntax:
86
- Exclude:
87
- - 'lib/slack-ruby-bot-server/api/endpoints/teams_endpoint.rb'
88
- - 'lib/slack-ruby-bot-server/models/team/methods.rb'
89
-
90
98
  # Offense count: 1
91
99
  # This cop supports unsafe autocorrection (--autocorrect-all).
92
100
  Style/HashTransformKeys:
@@ -99,6 +107,12 @@ Style/HashTransformValues:
99
107
  Exclude:
100
108
  - 'lib/slack-ruby-bot-server/api/helpers/error_helpers.rb'
101
109
 
110
+ # Offense count: 2
111
+ # This cop supports unsafe autocorrection (--autocorrect-all).
112
+ Style/MapToHash:
113
+ Exclude:
114
+ - 'spec/support/api/endpoints/it_behaves_like_a_cursor_api.rb'
115
+
102
116
  # Offense count: 1
103
117
  # This cop supports unsafe autocorrection (--autocorrect-all).
104
118
  # Configuration parameters: EnforcedStyle, Autocorrect.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ### Changelog
2
2
 
3
+ ### 2.2.0 (2025/09/22)
4
+
5
+ * [#176](https://github.com/slack-ruby/slack-ruby-bot-server/pull/176): Deps: bump mongoid-scroll to 2.0 - [@markokajzer](https://github.com/markokajzer).
6
+ * [#175](https://github.com/slack-ruby/slack-ruby-bot-server/pull/175): Fix(activerecord): correctly check for database in rails 7.2+ - [@markokajzer](https://github.com/markokajzer).
7
+ * [#178](https://github.com/slack-ruby/slack-ruby-bot-server/pull/178): Add support for Mongoid 8 - [@dblock](https://github.com/dblock).
8
+ * [#178](https://github.com/slack-ruby/slack-ruby-bot-server/pull/178): Cursor-helper now requires mongoid-scroll 2.x - [@dblock](https://github.com/dblock).
9
+ * [#178](https://github.com/slack-ruby/slack-ruby-bot-server/pull/178): Add support for ActiveRecord 8 - [@dblock](https://github.com/dblock).
10
+
3
11
  ### 2.1.1 (2023/07/25)
4
12
 
5
13
  * [#172](https://github.com/slack-ruby/slack-ruby-bot-server/pull/172): Fix: intervals may not always be started in an async block - [@dblock](https://github.com/dblock).
data/Gemfile CHANGED
@@ -1,20 +1,29 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- case ENV['DATABASE_ADAPTER']
3
+ case ENV.fetch('DATABASE_ADAPTER', nil)
4
4
  when 'mongoid' then
5
5
  gem 'kaminari-mongoid'
6
6
  gem 'mongoid', ENV['MONGOID_VERSION'] || '~> 7.3.0'
7
- gem 'mongoid-scroll'
7
+ gem 'mongoid-scroll', '~> 2.0'
8
8
  gem 'mongoid-shell'
9
+ gem 'mutex_m'
10
+
11
+ group :development, :test do
12
+ gem 'database_cleaner-mongoid', '~> 2.0.1'
13
+ end
9
14
  when 'activerecord' then
10
15
  gem 'activerecord', ENV['ACTIVERECORD_VERSION'] || '~> 6.0.0'
11
16
  gem 'otr-activerecord'
12
- gem 'pagy_cursor'
17
+ gem 'pagy_cursor', '~> 0.6.1'
13
18
  gem 'pg'
19
+
20
+ group :development, :test do
21
+ gem 'database_cleaner-active_record', '~> 2.2.0'
22
+ end
14
23
  when nil
15
24
  warn "Missing ENV['DATABASE_ADAPTER']."
16
25
  else
17
- warn "Invalid ENV['DATABASE_ADAPTER']: #{ENV['DATABASE_ADAPTER']}."
26
+ warn "Invalid ENV['DATABASE_ADAPTER']: #{ENV.fetch('DATABASE_ADAPTER', nil)}."
18
27
  end
19
28
 
20
29
  gemspec
@@ -22,8 +31,7 @@ gemspec
22
31
  group :development, :test do
23
32
  gem 'bundler'
24
33
  gem 'byebug'
25
- gem 'capybara', '~> 3.36.0'
26
- gem 'database_cleaner', '~> 1.8.5'
34
+ gem 'capybara', '~> 3.40.0'
27
35
  gem 'fabrication'
28
36
  gem 'faker'
29
37
  gem 'faraday', '0.17.5'
@@ -33,9 +41,9 @@ group :development, :test do
33
41
  gem 'rack-test'
34
42
  gem 'rake'
35
43
  gem 'rspec'
36
- gem 'rubocop', '1.47'
37
- gem 'selenium-webdriver', '~> 4.1.0'
44
+ gem 'rubocop', '1.80.2'
45
+ gem 'selenium-webdriver', '~> 4.35.0'
38
46
  gem 'vcr'
39
47
  gem 'webmock'
40
- gem 'webrick', '~> 1.6.1'
48
+ gem 'webrick', '~> 1.9.1'
41
49
  end
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2020 Daniel Doubrovkine & Contributors
3
+ Copyright (c) 2015-2025 Daniel Doubrovkine & Contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -2,7 +2,6 @@ Slack Ruby Bot Server
2
2
  =====================
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/slack-ruby-bot-server.svg)](https://badge.fury.io/rb/slack-ruby-bot-server)
5
- [![Code Climate](https://codeclimate.com/github/slack-ruby/slack-ruby-bot-server.svg)](https://codeclimate.com/github/slack-ruby/slack-ruby-bot-server)
6
5
  [![mongodb](https://github.com/slack-ruby/slack-ruby-bot-server/actions/workflows/test-mongodb.yml/badge.svg)](https://github.com/slack-ruby/slack-ruby-bot-server/actions/workflows/test-mongodb.yml)
7
6
  [![postgresql](https://github.com/slack-ruby/slack-ruby-bot-server/actions/workflows/test-postgresql.yml/badge.svg)](https://github.com/slack-ruby/slack-ruby-bot-server/actions/workflows/test-postgresql.yml)
8
7
  [![rubocop](https://github.com/slack-ruby/slack-ruby-bot-server/actions/workflows/rubocop.yml/badge.svg)](https://github.com/slack-ruby/slack-ruby-bot-server/actions/workflows/rubocop.yml)
@@ -30,17 +29,15 @@ Build a complete Slack bot service with Slack button integration, in Ruby.
30
29
  - [HTML Templates](#html-templates)
31
30
  - [Access Tokens](#access-tokens)
32
31
  - [Sample Bots Using Slack Ruby Bot Server](#sample-bots-using-slack-ruby-bot-server)
33
- - [Slack Bots with Granular Permissions](#slack-bots-with-granular-permissions)
34
- - [Legacy Slack Bots](#legacy-slack-bots)
35
32
  - [Copyright & License](#copyright--license)
36
33
 
37
34
  ## What is this?
38
35
 
39
- A library that contains a web server and a RESTful [Grape](http://github.com/ruby-grape/grape) API serving a Slack bot to multiple teams. Use in conjunction with [slack-ruby-bot-server-events](https://github.com/slack-ruby/slack-ruby-bot-server-events) to build a complete Slack bot service, or [slack-ruby-bot-server-rtm](https://github.com/slack-ruby/slack-ruby-bot-server-rtm) to build a (legacy) Classic RealTime Slack bot. Your customers can use a Slack button to install the bot.
36
+ A library that contains a web server and a RESTful [Grape](http://github.com/ruby-grape/grape) API serving a Slack bot to multiple teams. Use in conjunction with [slack-ruby-bot-server-events](https://github.com/slack-ruby/slack-ruby-bot-server-events) to build a complete Slack bot service. Your customers can use a Slack button to install the bot.
40
37
 
41
38
  ## Stable Release
42
39
 
43
- You're reading the documentation for the **stable** release of slack-ruby-bot-server, 2.1.1. See [UPGRADING](UPGRADING.md) when upgrading from an older version. See [MIGRATING](MIGRATING.md) for help with migrating Legacy Slack Apps to Granular Scopes.
40
+ You're reading the documentation for the **stable** release of slack-ruby-bot-server, v2.2.0. See [UPGRADING](UPGRADING.md) when upgrading from an older version. See [MIGRATING](MIGRATING.md) for help with migrating Legacy Slack Apps to Granular Scopes.
44
41
 
45
42
  ## Make Your Own
46
43
 
@@ -278,7 +275,6 @@ A number of extensions use service manager callbacks and service timers to imple
278
275
  * [slack-ruby-bot-server-events](https://github.com/slack-ruby/slack-ruby-bot-server-events): Easily handle Slack slash commands, interactive buttons and events.
279
276
  * [slack-ruby-bot-server-mailchimp](https://github.com/slack-ruby/slack-ruby-bot-server-mailchimp): Subscribes new bot users to a Mailchimp mailing list.
280
277
  * [slack-ruby-bot-server-stripe](https://github.com/slack-ruby/slack-ruby-bot-server-stripe): Enables paid bots with trial periods and commerce through Stripe.
281
- * [slack-ruby-bot-server-rtm](https://github.com/slack-ruby/slack-ruby-bot-server-rtm): Create RTM Slack bots.
282
278
 
283
279
  #### Service Class
284
280
 
@@ -317,24 +313,13 @@ By default the implementation of [Team](lib/slack-ruby-bot-server/models/team) s
317
313
 
318
314
  ## Sample Bots Using Slack Ruby Bot Server
319
315
 
320
- ### Slack Bots with Granular Permissions
321
-
322
316
  * [slack-ruby-bot-server-events-sample](https://github.com/slack-ruby/slack-ruby-bot-server-events-sample), a generic sample
323
317
  * [slack-rails-bot-starter](https://github.com/CrazyOptimist/slack-rails-bot-starter), an all-in-one Rails starter kit
324
-
325
- ### Legacy Slack Bots
326
-
327
- * [slack-ruby-bot-server-sample](https://github.com/slack-ruby/slack-ruby-bot-server-sample), a generic sample
328
- * [slack-sup](https://github.com/dblock/slack-sup), see [sup.playplay.io](https://sup.playplay.io)
329
- * [slack-gamebot](https://github.com/dblock/slack-gamebot), see [www.playplay.io](https://www.playplay.io)
330
- * [slack-market](https://github.com/dblock/slack-market), see [market.playplay.io](https://market.playplay.io)
331
- * [slack-shellbot](https://github.com/slack-ruby/slack-shellbot), see [shell.playplay.io](https://shell.playplay.io)
332
- * [slack-api-explorer](https://github.com/slack-ruby/slack-api-explorer), see [api-explorer.playplay.io](https://shell.playplay.io)
333
- * [slack-strava](https://github.com/dblock/slack-strava), see [slava.playplay.io](https://slava.playplay.io)
334
- * [slack-arena](https://github.com/dblock/slack-arena), see [arena.playplay.io](https://arena.playplay.io)
335
-
318
+ * [slack-sup2](https://github.com/dblock/slack-sup2), see [sup2.playplay.io](https://sup2.playplay.io)
319
+ * [slack-gamebot2](https://github.com/dblock/slack-gamebot2), see [gamebot2.playplay.io](https://gamebot2.playplay.io)
320
+
336
321
  ## Copyright & License
337
322
 
338
- Copyright [Daniel Doubrovkine](http://code.dblock.org) and Contributors, 2015-2020
323
+ Copyright [Daniel Doubrovkine](http://code.dblock.org) and Contributors, 2015-2025
339
324
 
340
325
  [MIT License](LICENSE)
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'rspec/core'
5
5
  require 'rspec/core/rake_task'
6
6
 
7
7
  RSpec::Core::RakeTask.new(:spec) do |spec|
8
- spec.pattern = FileList['spec/**/*_spec.rb'].exclude(%r{ext\/(?!#{ENV['DATABASE_ADAPTER']})})
8
+ spec.pattern = FileList['spec/**/*_spec.rb'].exclude(%r{ext\/(?!#{ENV.fetch('DATABASE_ADAPTER', nil)})})
9
9
  end
10
10
 
11
11
  require 'rubocop/rake_task'
data/UPGRADING.md CHANGED
@@ -1,6 +1,12 @@
1
1
  Upgrading Slack-Ruby-Bot-Server
2
2
  ===============================
3
3
 
4
+ ### Upgrading to >= 2.2.0
5
+
6
+ #### Cursor Helper Iterator Changes
7
+
8
+ The mongoid [cursor helper](lib/slack-ruby-bot-server/api/helpers/cursor_helpers.rb) now requires `mongoid-scroll` 2.x, the second argument to `scroll` has changed. See mongoid-scroll [UPGRADING](https://github.com/mongoid/mongoid-scroll/blob/master/UPGRADING.md#upgrading-to--200) for more information.
9
+
4
10
  ### Upgrading to >= 2.0.0
5
11
 
6
12
  #### Replaced Pagination Gem for ActiveRecord
@@ -41,8 +41,8 @@ module SlackRubyBotServer
41
41
  raise 'Missing SLACK_CLIENT_ID or SLACK_CLIENT_SECRET.' unless ENV.key?('SLACK_CLIENT_ID') && ENV.key?('SLACK_CLIENT_SECRET')
42
42
 
43
43
  options = {
44
- client_id: ENV['SLACK_CLIENT_ID'],
45
- client_secret: ENV['SLACK_CLIENT_SECRET'],
44
+ client_id: ENV.fetch('SLACK_CLIENT_ID', nil),
45
+ client_secret: ENV.fetch('SLACK_CLIENT_SECRET', nil),
46
46
  code: params[:code]
47
47
  }
48
48
 
@@ -16,9 +16,9 @@ module SlackRubyBotServer
16
16
  coll = coll.skip(params[:offset].to_i) if params.key?(:offset)
17
17
  size = (params[:size] || 10).to_i
18
18
  coll = coll.limit(size)
19
- coll.scroll(params[:cursor]) do |record, next_cursor|
19
+ coll.scroll(params[:cursor]) do |record, iterator|
20
20
  results[:results] << record if record
21
- results[:next] = next_cursor.to_s
21
+ results[:next] = iterator.next_cursor.to_s
22
22
  break if results[:results].count >= size
23
23
  end
24
24
  results[:total_count] = coll.count if params[:total_count] && coll.respond_to?(:count)
@@ -13,7 +13,7 @@ module SlackRubyBotServer
13
13
  supported_sort_orders = route_sort
14
14
  error!("This API doesn't support sorting", 400) if supported_sort_orders.blank?
15
15
  unless supported_sort_orders.include?(sort_order)
16
- error!("Invalid sort order: #{sort_order}, must be#{supported_sort_orders.count == 1 ? '' : ' one of'} '#{supported_sort_orders.join("', '")}'", 400)
16
+ error!("Invalid sort order: #{sort_order}, must be#{' one of' unless supported_sort_orders.count == 1} '#{supported_sort_orders.join("', '")}'", 400)
17
17
  end
18
18
  end
19
19
  sort_order = sort_order.split(',').map do |sort_entry|
@@ -50,7 +50,8 @@ module SlackRubyBotServer
50
50
  error!("Cannot sort #{coll.class.name}", 500)
51
51
  end
52
52
  end
53
- coll = coll.is_a?(Module) && coll.respond_to?(:all) ? coll.all : coll
53
+ coll = coll.all if coll.is_a?(Module) && coll.respond_to?(:all)
54
+ coll
54
55
  end
55
56
  end
56
57
  end
@@ -1,7 +1,7 @@
1
1
  require 'rack/cors'
2
2
  require 'rack-rewrite'
3
3
  require 'rack-server-pages'
4
- require 'otr-activerecord' if SlackRubyBotServer::Config.activerecord? && !defined?(::Rails)
4
+ require 'otr-activerecord' if SlackRubyBotServer::Config.activerecord? && !defined?(Rails)
5
5
 
6
6
  module SlackRubyBotServer
7
7
  module Api
@@ -6,7 +6,12 @@ require 'pagy_cursor/pagy/extras/cursor'
6
6
  module SlackRubyBotServer
7
7
  module DatabaseAdapter
8
8
  def self.check!
9
- ActiveRecord::Base.connection_pool.with_connection(&:active?)
9
+ if ActiveRecord.version >= Gem::Version.new('7.2')
10
+ ActiveRecord::Base.connection.database_exists?
11
+ else
12
+ ActiveRecord::Base.connection_pool.with_connection(&:active?)
13
+ end
14
+
10
15
  raise 'Unexpected error.' unless ActiveRecord::Base.connected?
11
16
  rescue StandardError => e
12
17
  warn "Error connecting to PostgreSQL: #{e.message}"
@@ -33,4 +38,4 @@ module SlackRubyBotServer
33
38
  end
34
39
  end
35
40
 
36
- ::Boolean = Grape::API::Boolean
41
+ Boolean = Grape::API::Boolean
@@ -78,8 +78,8 @@ module SlackRubyBotServer
78
78
  start_intervals!
79
79
  end
80
80
 
81
- def start_intervals!
82
- ::Async::Reactor.run do
81
+ def start_intervals!(&_block)
82
+ ::Async::Reactor.run do |task|
83
83
  @intervals.each_pair do |period, calls_with_options|
84
84
  calls_with_options.each do |call_with_options|
85
85
  call, options = *call_with_options
@@ -88,6 +88,7 @@ module SlackRubyBotServer
88
88
  end
89
89
  end
90
90
  end
91
+ yield task if block_given?
91
92
  end
92
93
  end
93
94
 
@@ -1,3 +1,3 @@
1
1
  module SlackRubyBotServer
2
- VERSION = '2.1.1'.freeze
2
+ VERSION = '2.2.0'.freeze
3
3
  end
@@ -20,8 +20,10 @@ Gem::Specification.new do |spec|
20
20
  spec.add_dependency 'grape-roar', '>= 0.4.0'
21
21
  spec.add_dependency 'grape-swagger'
22
22
  spec.add_dependency 'kaminari-grape'
23
+ spec.add_dependency 'logger'
23
24
  spec.add_dependency 'rack-cors'
24
25
  spec.add_dependency 'rack-rewrite'
25
26
  spec.add_dependency 'rack-server-pages'
26
27
  spec.add_dependency 'slack-ruby-client'
28
+ spec.metadata['rubygems_mfa_required'] = 'true'
27
29
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-ruby-bot-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-07-25 00:00:00.000000000 Z
10
+ date: 2025-09-22 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: async
@@ -94,6 +93,20 @@ dependencies:
94
93
  - - ">="
95
94
  - !ruby/object:Gem::Version
96
95
  version: '0'
96
+ - !ruby/object:Gem::Dependency
97
+ name: logger
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ type: :runtime
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: rack-cors
99
112
  requirement: !ruby/object:Gem::Requirement
@@ -150,7 +163,6 @@ dependencies:
150
163
  - - ">="
151
164
  - !ruby/object:Gem::Version
152
165
  version: '0'
153
- description:
154
166
  email:
155
167
  - dblock@dblock.org
156
168
  executables: []
@@ -229,8 +241,8 @@ files:
229
241
  - tasks/db.rake
230
242
  homepage: https://github.com/slack-ruby/slack-ruby-bot-server
231
243
  licenses: []
232
- metadata: {}
233
- post_install_message:
244
+ metadata:
245
+ rubygems_mfa_required: 'true'
234
246
  rdoc_options: []
235
247
  require_paths:
236
248
  - lib
@@ -245,8 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
245
257
  - !ruby/object:Gem::Version
246
258
  version: '0'
247
259
  requirements: []
248
- rubygems_version: 3.3.7
249
- signing_key:
260
+ rubygems_version: 3.6.2
250
261
  specification_version: 4
251
262
  summary: A Grape API serving a Slack bot to multiple teams.
252
263
  test_files: []