Sha256: f88a5ad2d0934c263637e1dfc6a92e9aff2cbf279297a27580fb0b814cbb990f

Contents?: true

Size: 429 Bytes

Versions: 1

Compression:

Stored size: 429 Bytes

Contents

module MessengerClient
  class ListTemplate < Template
    def initialize(template_items, buttons = [])
      @template_items = template_items
      @buttons = buttons
    end

    def type
      "list"
    end

    def payload
      data = {
        template_type: type,
        elements: @template_items.map(&:to_json),
      }

      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.0 lib/messenger_client/list_template.rb