Class: SimpleWx::Messages::TextMessage

Inherits:
SimpleWx::Message show all
Defined in:
lib/simple_wx/messages/text_message.rb

Instance Attribute Summary

Attributes inherited from SimpleWx::Message

#json, #openid, #xml

Attributes inherited from Base

#error, #raise_flag

Instance Method Summary collapse

Methods inherited from Base

method_missing

Constructor Details

#initialize(options) ⇒ TextMessage

Returns a new instance of TextMessage.



4
5
6
7
# File 'lib/simple_wx/messages/text_message.rb', line 4

def initialize options
  super
  @content = options[:content]
end

Instance Method Details

#send_jsonObject



9
10
11
12
13
14
# File 'lib/simple_wx/messages/text_message.rb', line 9

def send_json
  @json[:msgtype] = "text"
  @json[:text] = {content: @content}
  SimpleWx.logger.info("SimpleWxLog:#{self.class.name} -- #{@openid} -- #{json}")
  super
end

#to_xmlObject



16
17
18
19
20
# File 'lib/simple_wx/messages/text_message.rb', line 16

def to_xml
  @xml["MsgType"] = "text"
  @xml["Content"] = @content
  super
end