Sha256: 959a0db7acdb464c5b00db9364b1eae6a768e088817cf90aea7291a9ecd908c4
Contents?: true
Size: 734 Bytes
Versions: 1
Compression:
Stored size: 734 Bytes
Contents
module MessengerClient class ListTemplate < Template TEMPLATE_STYLES = %w(LARGE COMPACT) def initialize(template_items, buttons = [], style = "LARGE") @template_items = template_items @buttons = buttons @style = style.upcase end def type "list" end def payload data = { template_type: type, elements: @template_items.map(&:to_json), } raise ArgumentError, "#{@style} is not a valid template style. Your choices are #{TEMPLATE_STYLES.join(', ')}" unless TEMPLATE_STYLES.include?(@style) data.merge!(top_element_style: @style) data.merge!(buttons: @buttons.map(&:to_json)) if @buttons.any? data end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
messenger_client-0.2.2 | lib/messenger_client/list_template.rb |