Sha256: 81ab8c7f9bff9bfcfa45fd57107dfb16c9f412f4083e63893a5b529f3a113bf0

Contents?: true

Size: 448 Bytes

Versions: 4

Compression:

Stored size: 448 Bytes

Contents

module MessengerClient
  class Template
    def initialize(template_items)
      @template_items = template_items
    end

    def type
      raise NotImplementedError
    end

    def to_json
      {
        attachment: {
          type: "template",
          payload: payload
        }
      }
    end

    private

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
messenger_client-0.2.3 lib/messenger_client/template.rb
messenger_client-0.2.2 lib/messenger_client/template.rb
messenger_client-0.2.1 lib/messenger_client/template.rb
messenger_client-0.2.0 lib/messenger_client/template.rb