Class: Slack::BlockKit::Block::ImageBlock

Inherits:
Slack::BlockKit::Block show all
Defined in:
lib/slack/block_kit/block/image_block.rb

Instance Attribute Summary collapse

Attributes inherited from Slack::BlockKit::Block

#block_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Slack::BlockKit::Block

[], #type, #valid?

Instance Attribute Details

#alt_textObject

Returns the value of attribute alt_text.



8
9
10
# File 'lib/slack/block_kit/block/image_block.rb', line 8

def alt_text
  @alt_text
end

#image_urlObject

Returns the value of attribute image_url.



8
9
10
# File 'lib/slack/block_kit/block/image_block.rb', line 8

def image_url
  @image_url
end

#titleObject

Returns the value of attribute title.



8
9
10
# File 'lib/slack/block_kit/block/image_block.rb', line 8

def title
  @title
end

Class Method Details

.populate(hash, object) ⇒ Object



10
11
12
13
14
# File 'lib/slack/block_kit/block/image_block.rb', line 10

def self.populate(hash, object)
  object.image_url = hash.fetch(:image_url)
  object.alt_text = hash.fetch(:alt_text)
  object.title = hash[:title] if hash.key?(:title)
end

Instance Method Details

#to_hObject



34
35
36
37
38
39
40
# File 'lib/slack/block_kit/block/image_block.rb', line 34

def to_h
  super.merge(
    image_url: image_url,
    alt_text: alt_text,
    title: title&.to_h
  ).compact
end