Commit 85a2b359 by lanrion

添加设置用户备注名API

parent d3e28ff1
......@@ -18,6 +18,24 @@ module WeixinAuthorize
http_get(followers_url, {next_openid: next_openid})
end
# 设置备注名
# http请求方式: POST(请使用https协议)
# https://api.weixin.qq.com/cgi-bin/user/info/updateremark?access_token=ACCESS_TOKEN
# POST数据格式:JSON
# POST数据例子:
# {
# "openid":"oDF3iY9ffA-hqb2vVvbr7qxf6A0Q",
# "remark":"pangzi"
# }
def update_remark(openid, remark)
update_url = "/user/info/updateremark"
payload = {
openid: openid,
remark: remark
}
http_post(update_url, payload)
end
private
def user_base_url
......
......@@ -20,4 +20,9 @@ describe WeixinAuthorize::Api::User do
expect(followers.code).to eq(WeixinAuthorize::OK_CODE)
expect(followers.result.keys).to eq(["total", "count", "data", "next_openid"])
end
it "can update user remark" do
user_info = $client.update_remark(ENV["OPENID"], "dylan")
expect(user_info.code).to eq(WeixinAuthorize::OK_CODE)
end
end
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