immosquare-slack 0.2.2 → 0.2.3

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: 8ee55a9d9a3ffafa9f99139fbe4931f30bff4138ea4e77ff1ba8d5e1b005f55a
4
- data.tar.gz: 1e2c4c73dc40c6caf741b983317e878204b9f1e42a865fdb7ca8ede4c2921510
3
+ metadata.gz: 12ae386c41e3ec21e398b12d2ac347fe368d1372df757c2369333256bcee4e8b
4
+ data.tar.gz: d18fb89c4db393a1cc0adddbcb4a66444a38dfb31096ff60f2fb89bd4c5a1517
5
5
  SHA512:
6
- metadata.gz: cc6d87db38e715bb3804a6f86755d9a055d55753bac17d5799bd99462d1e4b61e65a177af45c57da4777ddeb61e9689972e51b212debca92723d5bcbba015502
7
- data.tar.gz: 3bec4651abf9eafeec9aecbc40581ed4f54733c614a3e370bedd7f2b6161f391f1b79acf88c8d2b5d466168a58a65e442f1b81437dfc1019803a9ac41c287773
6
+ metadata.gz: 86cd275178aaaf100cb42df5eed83b76b1a4fe01a58229c16df81312923ad2f224f5316fed68c9110bc51c42eb17eaf9b886d333cf042e355dfa06b943c2fbcb
7
+ data.tar.gz: f4abd19d80848018fe73a01e137bf231ab4d1a6133d599e36642bde23b6097c9cc22cb03ce8b004181de8dbb4c860e5a9f58497398aa136f0dc19cee98837411
@@ -3,6 +3,7 @@ module ImmosquareSlack
3
3
  extend SharedMethods
4
4
 
5
5
  GENERAL_CHANNEL = "general".freeze
6
+ CHANNELS_LOCK = Mutex.new
6
7
 
7
8
  class << self
8
9
 
@@ -13,18 +14,24 @@ module ImmosquareSlack
13
14
  ##
14
15
  ## Piège : le cache ne reflète que l'état du workspace au
15
16
  ## premier appel. Un channel créé ou renommé ensuite n'y est
16
- ## pas. `force: true` vide le cache et refetch — à utiliser sur
17
- ## un miss de lookup pour distinguer un channel réellement
18
- ## absent d'un cache périmé avant tout fallback.
17
+ ## pas. `force: true` rafraîchit le cache sur un échec de
18
+ ## recherche. Les requêtes simultanées partagent le même
19
+ ## rafraîchissement pour préserver le quota de conversations.list.
20
+ ## Une erreur Slack laisse la dernière liste utilisable en cache.
19
21
  ##============================================================##
20
22
  def list_channels(force: false)
21
- @list_channels = nil if force
22
- @list_channels ||= begin
23
+ cached_channels = @list_channels
24
+ return cached_channels if cached_channels && !force
25
+
26
+ CHANNELS_LOCK.synchronize do
27
+ return @list_channels if @list_channels && !@list_channels.equal?(cached_channels)
28
+
23
29
  extra_params = {
24
30
  :types => ["public_channel", "private_channel"].join(","),
25
- :exclude_archived => false
31
+ :exclude_archived => false,
32
+ :limit => 200
26
33
  }
27
- fetch_paginated_data("https://slack.com/api/conversations.list", "channels", extra_params)
34
+ @list_channels = fetch_paginated_data("https://slack.com/api/conversations.list", "channels", extra_params)
28
35
  end
29
36
  end
30
37
 
@@ -1,3 +1,3 @@
1
1
  module ImmosquareSlack
2
- VERSION = "0.2.2".freeze
2
+ VERSION = "0.2.3".freeze
3
3
  end
metadata CHANGED
@@ -1,65 +1,64 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: immosquare-slack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
- - immosquare
7
+ - immosquare
8
8
  bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
- - !ruby/object:Gem::Dependency
13
- name: httparty
14
- requirement: !ruby/object:Gem::Requirement
15
- requirements:
16
- - - "~>"
17
- - !ruby/object:Gem::Version
18
- version: '0'
19
- type: :runtime
20
- prerelease: false
21
- version_requirements: !ruby/object:Gem::Requirement
22
- requirements:
23
- - - "~>"
24
- - !ruby/object:Gem::Version
25
- version: '0'
26
- description: ImmosquareSlack is a Ruby gem that provides an easy and efficient way
27
- to integrate Ruby applications with Slack. It leverages the Slack API to enable
28
- functionalities such as posting messages, managing channels, and other Slack-related
29
- operations. Designed for simplicity and ease of use, this gem is ideal for developers
30
- looking to enhance their Ruby applications with Slack's communication capabilities.
12
+ - !ruby/object:Gem::Dependency
13
+ name: httparty
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ -
17
+ - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: "0"
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ -
25
+ - ~>
26
+ - !ruby/object:Gem::Version
27
+ version: "0"
28
+ description: "ImmosquareSlack is a Ruby gem that provides an easy and efficient way to integrate Ruby applications with Slack. It leverages the Slack API to enable functionalities such as posting messages, managing channels, and other Slack-related operations. Designed for simplicity and ease of use, this gem is ideal for developers looking to enhance their Ruby applications with Slack's communication capabilities."
31
29
  email:
32
- - jules@immosquare.com
30
+ - jules@immosquare.com
33
31
  executables: []
34
32
  extensions: []
35
33
  extra_rdoc_files: []
36
34
  files:
37
- - lib/immosquare-slack.rb
38
- - lib/immosquare-slack/channel.rb
39
- - lib/immosquare-slack/configuration.rb
40
- - lib/immosquare-slack/shared_methods.rb
41
- - lib/immosquare-slack/user.rb
42
- - lib/immosquare-slack/version.rb
43
- homepage: https://github.com/immosquare/immosquare-slack
35
+ - lib/immosquare-slack.rb
36
+ - lib/immosquare-slack/channel.rb
37
+ - lib/immosquare-slack/configuration.rb
38
+ - lib/immosquare-slack/shared_methods.rb
39
+ - lib/immosquare-slack/user.rb
40
+ - lib/immosquare-slack/version.rb
41
+ homepage: "https://github.com/immosquare/immosquare-slack"
44
42
  licenses:
45
- - MIT
43
+ - MIT
46
44
  metadata: {}
47
45
  rdoc_options: []
48
46
  require_paths:
49
- - lib
47
+ - lib
50
48
  required_ruby_version: !ruby/object:Gem::Requirement
51
49
  requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: 3.2.6
50
+ -
51
+ - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 3.2.6
55
54
  required_rubygems_version: !ruby/object:Gem::Requirement
56
55
  requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- version: '0'
56
+ -
57
+ - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: "0"
60
60
  requirements: []
61
- rubygems_version: 4.0.23
61
+ rubygems_version: 4.1.0
62
62
  specification_version: 4
63
- summary: A Ruby gem for integrating with Slack API to perform various actions like
64
- posting messages.
63
+ summary: A Ruby gem for integrating with Slack API to perform various actions like posting messages.
65
64
  test_files: []