slack_message 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -1
- data/lib/slack_message/dsl.rb +21 -3
- data/slack_message.gemspec +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: 858633fd4b83922e886bbec641c0075aab65aa9551d0a268cab9b51e3f3722fc
|
4
|
+
data.tar.gz: 3bc79397b71344abe4b535424d9913ca8a7f37259b4904da43acc0149674a6c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8cb6fcfaeeade894cba87671231d49de003917069e597906d53a166a8d2e74a25a1e2f55aaadefbe606b940106f8123afe02b9d820191210bfccd3e8962ce95
|
7
|
+
data.tar.gz: fa49ddfecbd19538bfe91d62f0e7decc88cc52ef42e6d0c880138820671b27d23334dd90fd7a970e080a85221bdbf5b40929e3ee3d6e73db0e039efc1d17acd9
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## [Unreleased]
|
4
4
|
|
5
|
+
## [1.4.0] - 2021-09-27
|
6
|
+
- Moved image to accessory_image to differentiate between the image block
|
7
|
+
and the accessory image within a block.
|
8
|
+
|
5
9
|
## [1.3.0] - 2021-09-27
|
6
10
|
- Added ability to use custom names when posting.
|
7
11
|
- Added ability to post images within sections.
|
data/README.md
CHANGED
@@ -69,7 +69,7 @@ SlackMessage.configure do |config|
|
|
69
69
|
end
|
70
70
|
```
|
71
71
|
|
72
|
-
###
|
72
|
+
### Posting Messages
|
73
73
|
|
74
74
|
As mentioned at the top, posting a message to Slack is dang easy:
|
75
75
|
|
@@ -209,6 +209,7 @@ Also, some behaviors that are still planned but not yet added:
|
|
209
209
|
* allow custom http_options in configuration
|
210
210
|
* more of BlockKit's options
|
211
211
|
* any interactive elements at all (I don't understand them yet)
|
212
|
+
* more interesting return types for your message
|
212
213
|
|
213
214
|
Contributing
|
214
215
|
------------
|
data/lib/slack_message/dsl.rb
CHANGED
@@ -25,6 +25,24 @@ class SlackMessage::Dsl
|
|
25
25
|
@body.push({ type: "divider" })
|
26
26
|
end
|
27
27
|
|
28
|
+
def image(url, alt_text:, title: nil)
|
29
|
+
finalize_default_section
|
30
|
+
|
31
|
+
config = {
|
32
|
+
type: "image",
|
33
|
+
image_url: url,
|
34
|
+
alt_text: alt_text,
|
35
|
+
}
|
36
|
+
|
37
|
+
if !title.nil?
|
38
|
+
config[:title] = {
|
39
|
+
type: "plain_text", text: title, emoji: true
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
@body.push(config)
|
44
|
+
end
|
45
|
+
|
28
46
|
def context(text)
|
29
47
|
finalize_default_section
|
30
48
|
|
@@ -39,7 +57,7 @@ class SlackMessage::Dsl
|
|
39
57
|
|
40
58
|
def text(*args); default_section.text(*args); end
|
41
59
|
def link_button(*args); default_section.link_button(*args); end
|
42
|
-
def
|
60
|
+
def accessory_image(*args); default_section.accessory_image(*args); end
|
43
61
|
def blank_line(*args); default_section.blank_line(*args); end
|
44
62
|
def link(*args); default_section.link(*args); end
|
45
63
|
def list_item(*args); default_section.list_item(*args); end
|
@@ -118,10 +136,10 @@ class SlackMessage::Dsl
|
|
118
136
|
@body.merge!(config)
|
119
137
|
end
|
120
138
|
|
121
|
-
def
|
139
|
+
def accessory_image(url, alt_text: nil)
|
122
140
|
if !@body[:accessory].nil?
|
123
141
|
previous_type = @body[:accessory][:type]
|
124
|
-
warn "WARNING: Overriding previous #{previous_type} in section to use image instead: #{url}"
|
142
|
+
warn "WARNING: Overriding previous #{previous_type} in section to use accessory image instead: #{url}"
|
125
143
|
end
|
126
144
|
|
127
145
|
config = {
|
data/slack_message.gemspec
CHANGED