Sha256: 01e57187d15a560c7aa6f2c90b832579d19924c6ff3fd141a1ad4d045ba4d9ad

Contents?: true

Size: 656 Bytes

Versions: 1

Compression:

Stored size: 656 Bytes

Contents

module Line
  module Bot
    module MessageBuilder
      class Message::Template < Message
        attr_accessor :alt_text, :template

        def initialize(alt_text: nil, template: nil)
          super 'template' do
            @alt_text = alt_text
            @template = template
            yield self if block_given?
          end
        end

        def self.required
          {
            'type' => String,
            'alt_text' => String,
            'template' => Template
          }
        end

        def to_h
          result = super
          result['template'] = template.to_h
          result
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
line-bot-message-builder-0.1.2 lib/line/bot/message_builder/messages/template.rb