EasyWeixin
A Simple gem for weixin
Installation
gem install easy_weixin
Usage
check_valid
check
easy_weixin = EasyWeixin::Auth.new(@token, @timestamp, @nonce, @signature, @echostr)
easy_weixin.check_valid # => @echostr or false
analysis xml
msg = EasyWeixin::Message.factory(xml)
reply
- ReplyText
msg = EasyWeixin::Message.factory(xml)
EasyWeixin.text_msg(msg.ToUserName, msg.FromUserName, 'i am a text reply')
- ReplyNews
msg = EasyWeixin::Message.factory(xml)
if msg.Content == 'Hello2BizUser'
item1 = EasyWeixin::Item.new
item1.Title = 'title1'
item1.Description = 'blah'
item2 = EasyWeixin::Item.new
item2.Title = 'title2'
item2.Description = 'blah blah'
Articles = [item1, item2]
ArticleCount = Articles.size
end
EasyWeixin.news_msg(msg.ToUserName, msg.FromUserName, Articles, ArticleCount)
Contributing
- Fork it ( http://github.com/
/easy_weixin/fork ) - Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request