module WeixinAuthorize::Api::User
Public Instance Methods
followers(next_openid="")
click to toggle source
获取关注者列表 api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN&next_openid=NEXT_OPENID
# File lib/weixin_authorize/api/user.rb, line 38 def followers(next_openid="") followers_url = "#{user_base_url}/get" http_get(followers_url, {next_openid: next_openid}) end
update_remark(openid, remark)
click to toggle source
设置备注名 http请求方式: POST(请使用https协议) api.weixin.qq.com/cgi-bin/user/info/updateremark?access_token=ACCESS_TOKEN POST数据格式:JSON POST数据例子: {
"openid":"oDF3iY9ffA-hqb2vVvbr7qxf6A0Q", "remark":"pangzi"
}
# File lib/weixin_authorize/api/user.rb, line 52 def update_remark(openid, remark) update_url = "/user/info/updateremark" post_body = { openid: openid, remark: remark } http_post(update_url, post_body) end
user(openid, lang="zh_CN")
click to toggle source
获取用户基本信息 api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN lang: zh_CN, zh_TW, en
# File lib/weixin_authorize/api/user.rb, line 9 def user(openid, lang="zh_CN") user_info_url = "#{user_base_url}/info" http_get(user_info_url, {openid: openid, lang: lang}) end
users(user_list)
click to toggle source
批量获取用户基本信息 api.weixin.qq.com/cgi-bin/user/info/batchget?access_token=ACCESS_TOKEN POST数据格式:JSON POST数据例子: {
"user_list": [ { "openid": "otvxTs4dckWG7imySrJd6jSi0CWE", "lang": "zh-CN" }, { "openid": "otvxTs_JZ6SEiP0imdhpi50fuSZg", "lang": "zh-CN" } ]
}
# File lib/weixin_authorize/api/user.rb, line 30 def users(user_list) user_info_batchget_url = "#{user_base_url}/info/batchget" post_body = user_list http_post(user_info_batchget_url, post_body) end
Private Instance Methods
user_base_url()
click to toggle source
# File lib/weixin_authorize/api/user.rb, line 63 def user_base_url "/user" end