CGA1123 / slack-ruby-block-kit

A ruby wrapper for Slack's Block Kit
https://rubydoc.info/gems/slack-ruby-block-kit
MIT License
72 stars 30 forks source link

Implement Slack::BlockKit::Layout::Header #56

Closed CGA1123 closed 4 years ago

CGA1123 commented 4 years ago

https://api.slack.com/reference/block-kit/blocks#header

Add a block object for this and an associated helper in Slack::BlockKit::Block.header

rspeicher commented 3 years ago

Should this have a corresponding shortcut method in https://github.com/CGA1123/slack-ruby-block-kit/blob/3a632f2e81129483fb6913fe1f00d370ecf9ddce/lib/slack/block_kit/blocks.rb?

E.g.,

diff --git a/lib/slack/block_kit/blocks.rb b/lib/slack/block_kit/blocks.rb
index a3c27c0..20b41d3 100644
--- a/lib/slack/block_kit/blocks.rb
+++ b/lib/slack/block_kit/blocks.rb
@@ -37,6 +37,12 @@ module Slack
         append(block)
       end

+      def header(text:, block_id: nil, emoji: nil)
+        block = Layout::Header.new(text: text, block_id: block_id, emoji: emoji)
+
+        append(block)
+      end
+
       def image(url:, alt_text:, title: nil, block_id: nil, emoji: nil)
         block = Layout::Image.new(
           url: url,
CGA1123 commented 3 years ago

@rspeicher Yes, that would be nice to add in. I'll happily accept a PR that does that!

An oversight on my part to not have included this during the initial implementation in #57