Sha256: f30dbb341bf13155d6b587dfbcdfe5d2e8f9439423b1376757da3ead906e2af7

Contents?: true

Size: 835 Bytes

Versions: 3

Compression:

Stored size: 835 Bytes

Contents

module DingBot
  module Message

    # markdown类型
    # {
    #     "msgtype": "markdown",
    #     "markdown": {
    #         "title":"杭州天气",
    #         "text": "#### 杭州天气\n" +
    #             "> 9度,西北风1级,空气良89,相对温度73%\n\n" +
    #             "> ![screenshot](http://image.jpg)\n"  +
    #             "> ###### 10点20分发布 [天气](http://www.thinkpage.cn/) \n"
    #     }
    # }
    class Markdown < Base
      attr_accessor :title, :text

      def initialize(title='', text='')
        @title = title
        @text = text
      end

      def msg_type
        TYPE::MARKDOWN
      end

      def body_params
        super.merge(
            markdown: {
                text: @text,
                title: @title,
            }
        )
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dingbot-0.2.2 lib/dingbot/message/markdown.rb
dingbot-0.2.1 lib/dingbot/message/markdown.rb
dingbot-0.2.0 lib/dingbot/message/markdown.rb