Class: Slackened::Surface::Message
- Inherits:
-
Object
- Object
- Slackened::Surface::Message
show all
- Extended by:
- Forwardable, BlockKit::Blocks
- Defined in:
- lib/slackened/surface/message.rb
Overview
Class Method Summary
collapse
actions, button, context, custom, divider, header, section, text
Class Method Details
.build {|builder| ... } ⇒ Object
23
24
25
|
# File 'lib/slackened/surface/message.rb', line 23
def build
yield builder
end
|
.layout ⇒ Object
52
53
54
|
# File 'lib/slackened/surface/message.rb', line 52
def layout
raise NotImplementedError, 'You must define `self.layout` and build a layout'
end
|
.post(url: Slackened.configuration.webhook_url, **kwargs) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/slackened/surface/message.rb', line 27
def post(url: Slackened.configuration.webhook_url, **kwargs)
layout(**kwargs)
blocks = payload.dup
response = Slackened::HTTP.post(
blocks:,
url:
)
@builder.setup!
Slackened::Response.new(response:, blocks:)
end
|
.post!(url: Slackened.configuration.webhook_url, **kwargs) ⇒ Object
43
44
45
46
47
48
49
50
|
# File 'lib/slackened/surface/message.rb', line 43
def post!(url: Slackened.configuration.webhook_url, **kwargs)
response = post(url:, **kwargs)
raise Slackened::Error, response unless response.ok?
response
end
|