Class: Messenger::Elements::Bubble

Inherits:
Components::Element show all
Defined in:
lib/messenger/components/elements/bubble.rb

Instance Method Summary collapse

Methods inherited from Components::Element

#build

Constructor Details

#initialize(title:, subtitle: nil, item_url: nil, image_url: nil, buttons: nil) ⇒ Bubble

Returns a new instance of Bubble.



6
7
8
9
10
11
12
# File 'lib/messenger/components/elements/bubble.rb', line 6

def initialize(title:, subtitle: nil, item_url: nil, image_url: nil, buttons: nil)
  @title = title
  @subtitle = subtitle
  @image_url = image_url
  @item_url = item_url
  @buttons = build_buttons(buttons)
end

Instance Method Details

#build_buttons(buttons) ⇒ Object



14
15
16
# File 'lib/messenger/components/elements/bubble.rb', line 14

def build_buttons(buttons)
  buttons.map { |button| button.build } if buttons.present?
end