class Line::Bot::MessageBuilder::Template::Buttons

Attributes

actions[RW]
default_action[RW]
image_aspect_ratio[RW]
image_background_color[RW]
image_size[RW]
text[RW]
thumbnail_image_url[RW]
title[RW]

Public Class Methods

new(thumbnail_image_url: nil, image_aspect_ratio: nil, image_size: nil, image_background_color: nil, title: nil, text: nil, default_action: nil, actions: []) { |self| ... } click to toggle source
Calls superclass method Line::Bot::MessageBuilder::Base::new
# File lib/line/bot/message_builder/templates/buttons.rb, line 9
def initialize(thumbnail_image_url: nil, image_aspect_ratio: nil,
              image_size: nil, image_background_color: nil, title: nil,
              text: nil, default_action: nil, actions: [])
  super 'buttons' do
    @thumbnail_image_url = thumbnail_image_url
    @image_aspect_ratio = image_aspect_ratio
    @image_size = image_size
    @image_background_color = image_background_color
    @title = title
    @text = text
    @default_action = default_action
    @actions = actions
    yield self if block_given?
  end
end
required() click to toggle source
# File lib/line/bot/message_builder/templates/buttons.rb, line 25
def self.required
  {
    'type' => String,
    'text' => String,
    'actions' => Array
  }
end

Public Instance Methods

to_h() click to toggle source
Calls superclass method Line::Bot::MessageBuilder::Base#to_h
# File lib/line/bot/message_builder/templates/buttons.rb, line 33
def to_h
  result = super
  result['actions'] = result['actions'].map { |action| action.to_h }
  result
end