module EasyWeixin::Response

Constants

ArticleCount
Articles
Content
FromUserName
ToUserName

Public Instance Methods

analysis_xml(request_xml) click to toggle source
# File lib/easy_weixin/response.rb, line 26
def analysis_xml(request_xml)
  hash = MultiXml.parse(request_xml)['xml']
  source = OpenStruct.new(hash)
end
news_msg(from, to, articles, articleCount=1) click to toggle source
# File lib/easy_weixin/response.rb, line 14
def news_msg(from, to, articles, articleCount=1)
  msg = NewsReplyMessage.new
  msg.ToUserName   = to
  msg.FromUserName = from
  unless articles.is_a?(Array)
    articles = [articles]
  end
  msg.Articles = articles
  msg.ArticleCount = articleCount
  msg.to_xml
end
text_msg(from, to, content) click to toggle source

创建文本信息

# File lib/easy_weixin/response.rb, line 6
def text_msg(from, to, content)
  msg = TextReplyMessage.new
  msg.ToUserName   = to
  msg.FromUserName = from
  msg.Content = content
  msg.to_xml
end