slack_block_kit 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +47 -0
- data/lib/slack/block_kit.rb +1 -1
- data/slack_block_kit.gemspec +2 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17381b67feba0d6b08918c55888ecdaa069484b548216a0b04353a068853f41c
|
4
|
+
data.tar.gz: 8b963fe8e7e19bfa9a300577fe7661a436c1dd1c815fc3c635d72d8b4b14ae9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd76cfa9d4219fc00b56dab3cbb701f06b5eb118254173b5efc62bde43918c35256138d8963a3489ce15e78a7a779f15d4da3b6afef34a447e0857a9929fe34c
|
7
|
+
data.tar.gz: 361e954e869220fdda3d22e964088ef89e9f566c738c00d5bf0bbd77e4f06914b3521fd6cf3b98b0370b68b1f5d2c25c23c324e056b932a5e4122eb4ed14a469
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
slack_block_kit (0.3.
|
4
|
+
slack_block_kit (0.3.3)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -14,7 +14,7 @@ GEM
|
|
14
14
|
ast (~> 2.4.0)
|
15
15
|
powerpack (0.1.2)
|
16
16
|
rainbow (3.0.0)
|
17
|
-
rake (
|
17
|
+
rake (13.0.1)
|
18
18
|
rspec (3.8.0)
|
19
19
|
rspec-core (~> 3.8.0)
|
20
20
|
rspec-expectations (~> 3.8.0)
|
data/README.md
CHANGED
@@ -37,6 +37,53 @@ Finally, require this:
|
|
37
37
|
require 'slack/block_kit'
|
38
38
|
```
|
39
39
|
|
40
|
+
## Examples
|
41
|
+
|
42
|
+
Here are a few examples that might help you get started!
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
require 'faraday'
|
46
|
+
require 'slack/block_kit'
|
47
|
+
require 'json'
|
48
|
+
|
49
|
+
a_prebuilt_block = Slack::BlockKit::Layout::Section.new
|
50
|
+
text = Slack::BlockKit::Composition::Mrkdwn.new(text: ':wave: *hello*')
|
51
|
+
an_image = Slack::BlockKit::Element::Image.new(image_url: 'https://git.io/fjDW8', alt_text: 'a picture')
|
52
|
+
a_prebuilt_block.accessorise(an_image)
|
53
|
+
a_prebuilt_block.text = text
|
54
|
+
|
55
|
+
blocks = Slack::BlockKit.blocks do |b|
|
56
|
+
b.section do |s|
|
57
|
+
s.plain_text(text: 'Some plain text message!')
|
58
|
+
s.button(text: 'A button that is important', style: 'primary', action_id: 'id')
|
59
|
+
end
|
60
|
+
|
61
|
+
b.divider
|
62
|
+
|
63
|
+
b.context do |c|
|
64
|
+
c.mrkdwn(text: '_some italicised text for context_')
|
65
|
+
end
|
66
|
+
|
67
|
+
b.append(a_prebuilt_block)
|
68
|
+
end
|
69
|
+
|
70
|
+
webhook_url = 'https://hooks.slack.com/services/your/webhook/url'
|
71
|
+
body = { blocks: blocks.as_json, text: 'New block message!' }
|
72
|
+
|
73
|
+
response = Faraday.post(
|
74
|
+
webhook_url,
|
75
|
+
body.to_json,
|
76
|
+
'Content-Type' => 'application/json'
|
77
|
+
)
|
78
|
+
```
|
79
|
+
|
80
|
+
This will create a message like this:
|
81
|
+
|
82
|
+
![example block message](https://git.io/fjDWR)
|
83
|
+
|
84
|
+
You can also check out the [`slackerduty`](https://github.com/CGA1123/slackerduty) project for some example,
|
85
|
+
[`Slackerduty::Alert`](https://github.com/CGA1123/slackerduty/blob/b33d708124ddf36d1432080ba7e16e66fefa6993/lib/slackerduty/alert.rb#L28-L34) and [`Slackerduty::Blocks`](https://github.com/CGA1123/slackerduty/blob/master/lib/slackerduty/blocks) may be helpful places to start.
|
86
|
+
|
40
87
|
## Contributing
|
41
88
|
|
42
89
|
Bug reports and pull requests are welcome on GitHub at https://github.com/CGA1123/slack_block_kit-ruby
|
data/lib/slack/block_kit.rb
CHANGED
@@ -6,7 +6,7 @@ module Slack
|
|
6
6
|
module Element; end
|
7
7
|
module Layout; end
|
8
8
|
|
9
|
-
VERSION = '0.3.
|
9
|
+
VERSION = '0.3.3'
|
10
10
|
|
11
11
|
Dir[File.join(__dir__, 'block_kit', 'composition', '*.rb')].each { |file| require file }
|
12
12
|
Dir[File.join(__dir__, 'block_kit', 'element', '*.rb')].each { |file| require file }
|
data/slack_block_kit.gemspec
CHANGED
@@ -9,7 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.version = Slack::BlockKit::VERSION
|
10
10
|
spec.authors = ['Christian Gregg']
|
11
11
|
spec.email = ['c_arlt@hotmail.com']
|
12
|
-
spec.summary = "A ruby wrapper for Slack's Block Kit"
|
12
|
+
spec.summary = "DEPRECATED: A ruby wrapper for Slack's Block Kit"
|
13
|
+
spec.description = "Deprecated in favour of slack-ruby-block-kit"
|
13
14
|
spec.homepage = 'https://github.com/CGA1123/slack_block_kit-ruby'
|
14
15
|
spec.license = 'MIT'
|
15
16
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack_block_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Gregg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
description:
|
97
|
+
description: Deprecated in favour of slack-ruby-block-kit
|
98
98
|
email:
|
99
99
|
- c_arlt@hotmail.com
|
100
100
|
executables: []
|
@@ -157,5 +157,5 @@ requirements: []
|
|
157
157
|
rubygems_version: 3.0.3
|
158
158
|
signing_key:
|
159
159
|
specification_version: 4
|
160
|
-
summary: A ruby wrapper for Slack's Block Kit
|
160
|
+
summary: 'DEPRECATED: A ruby wrapper for Slack''s Block Kit'
|
161
161
|
test_files: []
|