README

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

  1. Fork it ( http://github.com//easy_weixin/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request