Sha256: 3b78edf9180688770768349c0d9dbebb57752786c68ad541e2bc1d1b548665bf

Contents?: true

Size: 404 Bytes

Versions: 6

Compression:

Stored size: 404 Bytes

Contents

module MessengerClient
  class Menu
    def initialize(buttons)
      @text    = text
      @buttons = parse_buttons(buttons)
    end

    def to_json
      {
        setting_type:    "call_to_actions",
        thread_state:    "existing_thread",
        call_to_actions: parse_buttons(@buttons)
      }
    end

    private

    def parse_buttons(buttons)
      buttons.map(&:to_json)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
messenger_client-0.2.3 lib/messenger_client/menu.rb
messenger_client-0.2.2 lib/messenger_client/menu.rb
messenger_client-0.2.1 lib/messenger_client/menu.rb
messenger_client-0.2.0 lib/messenger_client/menu.rb
messenger_client-0.1.9 lib/messenger_client/menu.rb
messenger_client-0.1.8 lib/messenger_client/menu.rb