class Line::Message::Builder::Flex::Bubble
Represents a โbubbleโ container in a LINE Flex Message. A bubble is a self-contained unit of content, structured into optional sections: header, hero (an image or box), body, and footer. Bubbles are the fundamental building blocks for single Flex Messages or for each item in a Carousel container.
Example: Creating a simple bubble with a body
Line::Message::Builder.with do flex alt_text: "Simple Bubble" do bubble do body do text "Hello, this is a bubble!" end end end end
See also:
Public Class Methods
Source
# File lib/line/message/builder/flex/bubble.rb, line 78 def initialize(context: nil, **options, &) @header = nil @hero = nil @body = nil @footer = nil super # Calls Base#initialize, sets options, and evals block end
Initializes a new Flex Message Bubble container. The provided block is instance-evalโd, allowing DSL methods for defining sections (e.g., header, body) to be called.
- context
-
An optional context for the builder.
- option
-
A hash of options to set instance variables (e.g.,
:size,:styles). - block
-
A block to define the sections of this bubble.
Line::Message::Builder::Base::new
Public Instance Methods
Source
# File lib/line/message/builder/flex/bubble.rb, line 128 def body(**options, &) @body = Box.new(**options, context: context, &) end
Source
# File lib/line/message/builder/flex/bubble.rb, line 93 def header(**options, &) @header = Box.new(**options, context: context, &) end
Source
# File lib/line/message/builder/flex/bubble.rb, line 104 def hero(**options, &) @hero = Box.new(**options, context: context, &) end
Source
# File lib/line/message/builder/flex/bubble.rb, line 117 def hero_image(url, **options, &) @hero = Image.new(url, **options, context: context, &) end
Defines the hero section of the bubble using an Image component. This is a convenience method for common cases where the hero is a single image.