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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb63c39ef18b4b6e6fb1d25e62300fcff41b759f3d59902c10423c306f892007
4
- data.tar.gz: 499f1d885b3a00e60af92ff9d0ba17c19f59ba3b1468d178498d08802c9429dd
3
+ metadata.gz: 858633fd4b83922e886bbec641c0075aab65aa9551d0a268cab9b51e3f3722fc
4
+ data.tar.gz: 3bc79397b71344abe4b535424d9913ca8a7f37259b4904da43acc0149674a6c6
5
5
  SHA512:
6
- metadata.gz: b0bf20b89e6ce48e9accb2ccd475d5f999686804d3c952e6a8903958af2f7b1500011f6abd904abba5f2cf73d635498f8c1feae7e4d00aa021b3ab0b6c1a5baa
7
- data.tar.gz: 42a8e2ecc5b6ca51ec1ab534e2a91bb500e352e26636f1a5671bf81244a40b321162bed30e1e7e0a78e53490575fbb0052c9d39fb108951f73425269cfafbab5
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
- ### Usage
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
  ------------
@@ -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 image(*args); default_section.image(*args); end
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 image(url, alt_text: nil)
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 = {
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'slack_message'
3
- gem.version = "1.3.0"
3
+ gem.version = "1.4.0"
4
4
  gem.summary = "A nice DSL for composing rich messages in Slack"
5
5
  gem.authors = ["Joe Mastey"]
6
6
  gem.email = 'hello@joemastey.com'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack_message
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Mastey