CGA1123/slack-ruby-block-kit

Implement Slack::BlockKit::Layout::Header

CGA1123 opened this issue · 2 comments

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

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

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,

@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