slack_line 1.3 → 1.4

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: '091877d65cd3c6b2c21d869608359fbc6c9774f663399eb01b2fec9afc098da3'
4
- data.tar.gz: 848360f12adbca1f5108764f450f448deac06a4fd61efcc8b994e3a00d166128
3
+ metadata.gz: 4cd84ee81b09ef89c3f46abcd5c595c29f3ced087632368f343aded9e20ac731
4
+ data.tar.gz: b17c80d061d6c9a72ae68321079414213905baaed8d9f2b976a95d3c8fcbc4cc
5
5
  SHA512:
6
- metadata.gz: b1b2ea474330ad8a53da29f5c74e271bfe17392c578dc8f7e2829767e52d4a7952dfb7929a76571236b83b336e7d254a735d9a7b49302ad9c0192f67b4fced92
7
- data.tar.gz: 2ab43cc4c5c4e02236cadbcaceac55146d9fc118246224494e9210b7e1e7eb21f0cbb04ffc2e8d5af901a0cd2e563ce721ca748e574ab1ac3226add51e4ee80a
6
+ metadata.gz: 1ff7cc5918a5b9395496814e1bbdb8494449ec202fd08ebd584afb1991d532cd9c62581e3c561d95acf2f308c5abea071c6b697a2754204103c15b8da81ef790
7
+ data.tar.gz: bfb562e958ec5d2b71a1d8bb1c895f2fd34b4e1a6c9cd5d557de4454f584cd77cc95db2e916ebc9e769b79128d62ea10e71da8a6de75a686e1cf93ef82674e4f
data/CHANGELOG.md CHANGED
@@ -21,3 +21,12 @@ Added disk-caching for the users and groups lists, through the `cache_path` and
21
21
  `message` and `thread` now accept `to:`, as the README showed. Declared `reline`
22
22
  as a runtime dependency, which fixes a warning or `LoadError` under Bundler on
23
23
  Ruby 4.0. The invalid content error now lists the classes of the bad arguments.
24
+
25
+ ## Version 1.4
26
+
27
+ **Breaking change:** calling `text` more than once in a `section` now raises an
28
+ `ArgumentError`. It used to silently keep only the last text, because a Slack
29
+ section block has one text field. Use one `section` per text.
30
+
31
+ Fixed README examples that didn't run, including `context` inside a `section`,
32
+ which Slack doesn't allow.
data/README.md CHANGED
@@ -13,13 +13,15 @@ sent_message = SlackLine.message("Something happened!", to: "#general").post
13
13
 
14
14
  # Construct a more complex message, then send it
15
15
  msg = SlackLine.message do
16
+ context "Don't worry! If this message surprises you, context @foobar"
17
+
18
+ # Like a Slack section block, a section holds one text and one link
16
19
  section do
17
- context "Don't worry! If this message surprises you, context @foobar"
18
20
  text "A thing has happened"
19
- text "Yeah, it happened for sure"
20
21
  link "How bad?", problems_path(problem.id)
21
22
  end
22
23
 
24
+ text "Yeah, it happened for sure"
23
25
  text "More details.."
24
26
  end
25
27
  sent_message = msg.post(to: "#general")
@@ -51,7 +53,7 @@ To update a SentThread, you'll need to choose message:
51
53
  ```ruby
52
54
  sent_message.update "Edit: never mind, false alarm"
53
55
  sent_thread.first.update "Problem Resolved!"
54
- sent_thread.detect { |m| m =~ /Not yet safe/ }&.update do
56
+ sent_thread.detect { |m| m.content.to_s.include?("Not yet safe") }&.update do
55
57
  text "it's safe now"
56
58
  end
57
59
  ```
@@ -119,7 +121,7 @@ SlackLine methods dispatch to), but you can construct additional clients
119
121
  with their own configs easily:
120
122
 
121
123
  ```ruby
122
- Slackline.configure do |config|
124
+ SlackLine.configure do |config|
123
125
  config.slack_token = ENV["TOKEN"]
124
126
  config.default_channel = "#general"
125
127
  config.bot_name = "FooBot"
@@ -128,7 +130,7 @@ end
128
130
  # Now SlackLine.message (et al) will use SlackLine.client,
129
131
  # configured as above.
130
132
 
131
- BAR_SLACK = SlackLine::Client.new(default_channel: "#team-bar", bot_name: "BarBot")
133
+ BAR_SLACK = SlackLine::Client.new(SlackLine.configuration, default_channel: "#team-bar", bot_name: "BarBot")
132
134
 
133
135
  # And now you can call those methods on `BAR_SLACK` to use a different
134
136
  # default channel and name
@@ -12,6 +12,8 @@ module SlackLine
12
12
  attr_reader :content
13
13
 
14
14
  def text(content, plain: false)
15
+ raise(ArgumentError, "A section can only have one text.") if @in_progress_section.text
16
+
15
17
  if plain
16
18
  @in_progress_section.plain_text(text: content)
17
19
  else
@@ -1,3 +1,3 @@
1
1
  module SlackLine
2
- VERSION = "1.3".freeze
2
+ VERSION = "1.4".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack_line
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.3'
4
+ version: '1.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Mueller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-04 00:00:00.000000000 Z
11
+ date: 2026-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec