Commit 3a2813ae by lanrion

updated README.md

parent 547343f2
# WeixinAuthorize # WeixinAuthorize
1, 获取access_token: https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET ## Installation
2, 上传多媒体文件 Add this line to your application's Gemfile:
http请求方式: POST/FORM gem 'weixin_authorize'
http://file.api.weixin.qq.com/cgi-bin/media/upload?access_token=ACCESS_TOKEN&type=TYPE
调用示例(使用curl命令,用FORM表单方式上传一个多媒体文件):
curl -F media=@test.jpg "http://file.api.weixin.qq.com/cgi-bin/media/upload?access_token=ACCESS_TOKEN&type=TYPE"
3, 发送客服消息 And then execute:
http请求方式: POST $ bundle
https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN
4, 获取用户基本信息 Or install it yourself as:
http请求方式: GET $ gem install weixin_authorize
https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN
5, 获取关注者列表 ## Usage
http请求方式: GET(请使用https协议) ### Init a `client`
https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN&next_openid=NEXT_OPENID
```ruby
## Installation $client ||= WeixinAuthorize.configure do |config|
config.app_id = ENV["APPID"]
config.app_secret = ENV["APPSECRET"]
config.expired_at = Time.now.to_i
end
Add this line to your application's Gemfile: # Or
gem 'weixin_authorize' $client ||= WeixinAuthorize::Client.new(ENV["APPID"], ENV["APPSECRET"])
And then execute: ```
$ bundle ### 获取用户管理信息
Or install it yourself as: * [获取用户基本信息](http://mp.weixin.qq.com/wiki/index.php?title=获取用户基本信息)
$ gem install weixin_authorize `user_info = $client.user(ENV["OPENID"])`
## Usage * [获取关注者列表](http://mp.weixin.qq.com/wiki/index.php?title=获取关注者列表)
`followers = $client.followers`
### 分组管理
* [分组管理接口](http://mp.weixin.qq.com/wiki/index.php?title=分组管理接口)
* 创建分组
`group = $client.create_group("test")`
* 查询所有分组
`groups = $client.groups`
* 查询用户所在分组
`group = $client.get_group_for(ENV["OPENID"])`
* 修改分组名
`group = $client.update_group_name(ENV["OPENID"], "new_group_name")`
* 移动用户分组
`group = $client.update_group_for_openid(ENV["OPENID"], "to_groupid")`
### 自定义菜单
* [自定义菜单创建接口](http://mp.weixin.qq.com/wiki/index.php?title=自定义菜单创建接口)
`response = $client.create_menu(menu)`
* [自定义菜单查询接口](http://mp.weixin.qq.com/wiki/index.php?title=自定义菜单查询接口)
`response = $client.menu`
* [自定义菜单删除接口](http://mp.weixin.qq.com/wiki/index.php?title=自定义菜单删除接口)
`response = $client.delete_menu`
### [发送客服信息](http://mp.weixin.qq.com/wiki/index.php?title=发送客服信息)
* 发送文本信息
`send_text_custom(to_user, content)`
* 发送图片信息
`sent_image_custom(to_user, media_id)`
* 发送语音消息
`sent_voice_custom(to_user, media_id)`
* 发送视频消息
`sent_video_custom(to_user, media_id, options)`
* 发送音乐消息
`sent_music_custom(to_user, media_id, musicurl, hqmusicurl, options)`
* 发送图文消息
`send_news_custom(to_user, *articles)`
## Contributing ## Contributing
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment