Class: UI::FBCarousel
- Inherits:
-
BaseUiElement
- Object
- BaseUiElement
- UI::FBCarousel
- Includes:
- Common::HasButtons
- Defined in:
- lib/ui/fb_carousel.rb
Overview
GENERIC TEMPLATE (aka CAROUSEL) ####################### developers.facebook.com/docs/messenger-platform/send-api-reference/generic-template
Instance Method Summary collapse
-
#horizontal_images ⇒ Object
set image aspect ratio to ‘square’.
-
#initialize(elements) ⇒ FBCarousel
constructor
A new instance of FBCarousel.
-
#square_images ⇒ Object
set image aspect ratio to ‘square’.
Methods inherited from BaseUiElement
Constructor Details
#initialize(elements) ⇒ FBCarousel
Returns a new instance of FBCarousel.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ui/fb_carousel.rb', line 8 def initialize(elements) @template = { recipient: { id: nil }, message: { attachment: { type: 'template', payload: { template_type: 'generic', image_aspect_ratio: 'horizontal', elements: parse_elements(elements) } } } } end |
Instance Method Details
#horizontal_images ⇒ Object
set image aspect ratio to ‘square’
31 32 33 34 35 |
# File 'lib/ui/fb_carousel.rb', line 31 def horizontal_images hrz = 'horizontal' @template[:message][:attachment][:payload][:image_aspect_ratio] = hrz self end |
#square_images ⇒ Object
set image aspect ratio to ‘square’
25 26 27 28 |
# File 'lib/ui/fb_carousel.rb', line 25 def square_images @template[:message][:attachment][:payload][:image_aspect_ratio] = 'square' self end |