Skip to content
lanrion edited this page Aug 14, 2015 · 2 revisions

说明

因为作者沙盒测试号权限问题,大部分高级API并未能完全实现,如果你需要,可以调用如下方法处理:

# 暴露出:http_get,http_post两个方法,方便第三方开发者扩展未开发的微信API。
def http_get(url, url_params={}, endpoint="plain")
  url_params = url_params.merge(access_token_param)
  WeixinAuthorize.http_get_without_token(url, url_params, endpoint)
end

def http_post(url, post_body={}, url_params={}, endpoint="plain")
  url_params = access_token_param.merge(url_params)
  WeixinAuthorize.http_post_without_token(url, post_body, url_params, endpoint)
end

调用

 $client.http_post(api_url, post_body, url_params, endpoint)
 $client.http_get(api_url, url_params, endpoint)

为了适应微信不规范的api命名情况,在这里 endpoint 参数的作用请直接传递 WeixinAuthorize::CUSTOM_ENDPOINT, 会直接使用你的url作为请求url。

示例:https://github.com/lanrion/weixin_authorize/blob/master/lib/weixin_authorize/api/custom.rb 查看 get_custom_msg_record 方法的实现,api命名不规范,所以这里直接使用url作为请求的API。 如果有任何反馈,请直接提issue.

Clone this wiki locally