Class: FlowChat::Whatsapp::Renderer
- Inherits:
-
Object
- Object
- FlowChat::Whatsapp::Renderer
- Includes:
- Renderers::MarkdownSupport
- Defined in:
- lib/flow_chat/whatsapp/renderer.rb
Constant Summary collapse
- BUTTON_TITLE_LENGTH =
WhatsApp button and list row title limits. The choice mapper reads these too, to alias the truncated title it knows this renderer will display for a given choice count.
20- LIST_ROW_TITLE_LENGTH =
24- MAX_CAPTION_LENGTH =
Meta: "Media asset caption text. Maximum 1024 characters." Documented for image, video, and document messages. Audio and sticker messages' own schemas list only id/link (audio also has voice) - no caption field at all - so they can never carry the numbered body this way, however short it is.
1024- CAPTIONABLE_MEDIA_TYPES =
[:image, :video, :document].freeze
Instance Attribute Summary collapse
-
#choices ⇒ Object
readonly
Returns the value of attribute choices.
-
#media ⇒ Object
readonly
Returns the value of attribute media.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(message, choices: nil, media: nil) ⇒ Renderer
constructor
A new instance of Renderer.
- #render ⇒ Object
Methods included from Renderers::MarkdownSupport
included, #sanitize_html, #to_html, #to_plain_text
Constructor Details
#initialize(message, choices: nil, media: nil) ⇒ Renderer
Returns a new instance of Renderer.
24 25 26 27 28 |
# File 'lib/flow_chat/whatsapp/renderer.rb', line 24 def initialize(, choices: nil, media: nil) @message = @choices = choices @media = media end |
Instance Attribute Details
#choices ⇒ Object (readonly)
Returns the value of attribute choices.
22 23 24 |
# File 'lib/flow_chat/whatsapp/renderer.rb', line 22 def choices @choices end |
#media ⇒ Object (readonly)
Returns the value of attribute media.
22 23 24 |
# File 'lib/flow_chat/whatsapp/renderer.rb', line 22 def media @media end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
22 23 24 |
# File 'lib/flow_chat/whatsapp/renderer.rb', line 22 def @message end |
Instance Method Details
#render ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/flow_chat/whatsapp/renderer.rb', line 30 def render if media && choices elsif media elsif choices else end end |