Class: Slack::Surfaces::Home

Inherits:
Object
  • Object
show all
Defined in:
lib/slack/surfaces/home.rb

Overview

The Home tab is a persistent, yet dynamic interface for apps that lives within the App Home.

api.slack.com/surfaces#tabs api.slack.com/reference/surfaces/views

Constant Summary collapse

TYPE =
'home'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(blocks: nil, private_metadata: nil, callback_id: nil, external_id: nil) ⇒ Home

Returns a new instance of Home.



13
14
15
16
17
18
19
20
# File 'lib/slack/surfaces/home.rb', line 13

def initialize(blocks: nil,
               private_metadata: nil, callback_id: nil, external_id: nil)
  @blocks = blocks || Slack::BlockKit::Blocks.new

  @private_metadata = 
  @callback_id = callback_id
  @external_id = external_id
end

Instance Attribute Details

#blocksObject (readonly)

Returns the value of attribute blocks.



22
23
24
# File 'lib/slack/surfaces/home.rb', line 22

def blocks
  @blocks
end

Instance Method Details

#as_jsonObject



24
25
26
27
28
29
30
31
32
# File 'lib/slack/surfaces/home.rb', line 24

def as_json(*)
  {
    type: TYPE,
    blocks: @blocks.as_json,
    private_metadata: @private_metadata,
    callback_id: @callback_id,
    external_id: @external_id
  }.compact
end