grape-slack-bot 1.5.3 → 1.5.5

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: f2b70d87297ad0f3b585dfacc7eb41b14e2c67d7134bc3771d00fa0117d9f312
4
- data.tar.gz: 67db6701d3bc301502ab605a0987eb5e47bdcef3561bde1527646d57c0afdae0
3
+ metadata.gz: 8369c909fff6a3b4da241ee643cc4eb88aea44b4cf36b46d23894d98485b99b7
4
+ data.tar.gz: 6b20d7329e693eada51866d5a20fa57f964bbf24996ff59b073773751dd59843
5
5
  SHA512:
6
- metadata.gz: 304d11b6af4266b369fbfb780056956435e323a32d0acea59440c46add848a3acb9339129a6bc0c11c23b5f0b34c2151b9097a11eb8d856ab0a62a18c4719e6f
7
- data.tar.gz: 313680981ca8e1e0445ed3ea97955bf8ea3d9eba4b32b0fe30690c3917a619304d2aa389e839e5ed6d46737a51a2f68ec7ef735a193f72ddbbe131daf3b73836
6
+ metadata.gz: e6e153e24e4b69c9447ab1a91f989213b0786f05ce25fb9ef726b855fe93e847c03ae00496379aa67f24de67f2a4b96e9a49f4c29589898044f04cda73131d41
7
+ data.tar.gz: 00aa26edbe0a901e646905ce3ba7b154ca112fd33340a86592860ec9e766ac1ee37bc616d0eaf63bbc9785ca901f761f46f8e60e2da4c0ea8fee31a6a11aedda
@@ -4,8 +4,7 @@ module SlackBot
4
4
  define_singleton_method(:view_klass) { klass }
5
5
  end
6
6
 
7
- attr_reader :current_user, :params, :config
8
- attr_accessor :callback, :metadata
7
+ attr_reader :current_user, :params, :config, :callback, :metadata
9
8
  def initialize(current_user: nil, params: nil, callback: nil, config: nil)
10
9
  @current_user = current_user
11
10
  @params = params
@@ -19,6 +18,14 @@ module SlackBot
19
18
 
20
19
  private
21
20
 
21
+ def callback=(callback)
22
+ @callback = callback
23
+ end
24
+
25
+ def metadata=(metadata)
26
+ @metadata = metadata
27
+ end
28
+
22
29
  def event_type
23
30
  params["event"]["type"]
24
31
  end
@@ -12,8 +12,7 @@ module SlackBot
12
12
  end
13
13
 
14
14
  def fetch_user_id
15
- params.dig("user_id") || params.dig("user", "id") ||
16
- params.dig("event", "user")
15
+ params.dig("user_id") || params.dig("user", "id") || params.dig("event", "user")
17
16
  end
18
17
 
19
18
  def verify_slack_signature!
@@ -20,6 +20,12 @@ module SlackBot
20
20
  @context = context.with_indifferent_access if context.is_a?(Hash)
21
21
  end
22
22
 
23
+ def method_missing(method_name, *args, &block)
24
+ return @context[method_name.to_sym] if @context.key?(method_name.to_sym)
25
+
26
+ super
27
+ end
28
+
23
29
  def text_modal
24
30
  {
25
31
  title: {
@@ -34,20 +40,20 @@ module SlackBot
34
40
 
35
41
  private
36
42
 
37
- def current_date
38
- Date.current
39
- end
40
-
41
43
  def divider_block
42
44
  { type: "divider" }
43
45
  end
44
46
 
47
+ def current_date
48
+ Date.current
49
+ end
50
+
45
51
  def command
46
52
  params[:command]
47
53
  end
48
54
 
49
55
  def paginate(cursor)
50
- SlackBot::Pager.new(cursor, args: args)
56
+ self.class.pager_klass.new(cursor, args: args)
51
57
  end
52
58
  end
53
59
  end
data/lib/slack_bot.rb CHANGED
@@ -22,5 +22,5 @@ require 'slack_bot/pager'
22
22
  require 'slack_bot/grape_extension'
23
23
 
24
24
  module SlackBot
25
- VERSION = '1.5.3'.freeze
25
+ VERSION = '1.5.5'.freeze
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-slack-bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Makarov