Class: DingBot::Message::Text

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

Overview

text类型{

"msgtype": "text",
"text": {
    "content": "我就是我, 是不一样的烟火"
},
"at": {
    "atMobiles": [
        "156xxxx8827",
        "189xxxx8325"
    ],
    "isAtAll": false
}

}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#to_json

Constructor Details

#initialize(content = '', at_mobiles = [], is_at_all = false) ⇒ Text

Returns a new instance of Text.



21
22
23
24
25
# File 'lib/dingbot/message/text.rb', line 21

def initialize(content='', at_mobiles=[], is_at_all=false)
  @content = content
  @at_mobiles = at_mobiles
  @is_at_all = is_at_all
end

Instance Attribute Details

#at_mobilesObject

Returns the value of attribute at_mobiles.



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

def at_mobiles
  @at_mobiles
end

#contentObject

Returns the value of attribute content.



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

def content
  @content
end

#is_at_allObject

Returns the value of attribute is_at_all.



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

def is_at_all
  @is_at_all
end

Instance Method Details

#body_paramsObject



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/dingbot/message/text.rb', line 31

def body_params
  super.merge({
                  text: {
                      "content": @content
                  },
                  at: {
                      atMobiles: @at_mobiles,
                      isAtAll: @is_at_all
                  }
              })
end

#msg_typeObject



27
28
29
# File 'lib/dingbot/message/text.rb', line 27

def msg_type
  TYPE::TEXT
end