grape-slack-bot 1.5.3 → 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/slack_bot/event.rb +9 -2
- data/lib/slack_bot/grape_extension.rb +1 -2
- data/lib/slack_bot/view.rb +11 -5
- data/lib/slack_bot.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8369c909fff6a3b4da241ee643cc4eb88aea44b4cf36b46d23894d98485b99b7
|
4
|
+
data.tar.gz: 6b20d7329e693eada51866d5a20fa57f964bbf24996ff59b073773751dd59843
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6e153e24e4b69c9447ab1a91f989213b0786f05ce25fb9ef726b855fe93e847c03ae00496379aa67f24de67f2a4b96e9a49f4c29589898044f04cda73131d41
|
7
|
+
data.tar.gz: 00aa26edbe0a901e646905ce3ba7b154ca112fd33340a86592860ec9e766ac1ee37bc616d0eaf63bbc9785ca901f761f46f8e60e2da4c0ea8fee31a6a11aedda
|
data/lib/slack_bot/event.rb
CHANGED
@@ -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!
|
data/lib/slack_bot/view.rb
CHANGED
@@ -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
|
-
|
56
|
+
self.class.pager_klass.new(cursor, args: args)
|
51
57
|
end
|
52
58
|
end
|
53
59
|
end
|
data/lib/slack_bot.rb
CHANGED