module Line::Message::Builder
The Builder module provides a Domain Specific Language (DSL) for constructing and validating LINE messages. It offers a structured and intuitive way to define various message types, such as text, flex messages, and quick replies, ensuring they adhere to the LINE Messaging API specifications.
This module simplifies the process of creating complex message structures by providing a set of builder classes and helper methods.
Constants
- VERSION
Public Instance Methods
Source
# File lib/line/message/builder.rb, line 57 def with(context = nil, mode: :api, &) Container.new(context: context, mode: mode, &) end
Entry point for building a message container. This method initializes a new message Container and evaluates the provided block within the context of that container.
- context
-
An optional context object that can be made available within the builder block. This can be useful for accessing helper methods or data within the block.
- mode
-
The mode to use for building messages. Can be either
:api(default) for direct LINE Messaging API format or:sdkv2for LINE Bot SDK v2 compatible format.
Example
message = Line::Message::Builder.with do text "Hello, world!" end