Class: DingBot::Message::Markdown

Inherits:
Base
  • Object
show all
Defined in:
lib/dingbot/message/markdown.rb

Overview

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"
}

}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#to_json

Constructor Details

#initialize(title = '', text = '') ⇒ Markdown

Returns a new instance of Markdown.



18
19
20
21
# File 'lib/dingbot/message/markdown.rb', line 18

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

Instance Attribute Details

#textObject

Returns the value of attribute text.



16
17
18
# File 'lib/dingbot/message/markdown.rb', line 16

def text
  @text
end

#titleObject

Returns the value of attribute title.



16
17
18
# File 'lib/dingbot/message/markdown.rb', line 16

def title
  @title
end

Instance Method Details

#body_paramsObject



27
28
29
30
31
32
33
34
# File 'lib/dingbot/message/markdown.rb', line 27

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

#msg_typeObject



23
24
25
# File 'lib/dingbot/message/markdown.rb', line 23

def msg_type
  TYPE::MARKDOWN
end