class QqHulian::User
To change this template use File | Settings | File Templates.
Public Instance Methods
get_user_info()
click to toggle source
获取登录用户在QQ空间的信息,包括昵称、头像、性别及黄钻信息(包括黄钻等级、是否年费黄钻等) 参数: 上传获取 access_token = params oauth_consumer_key = params openid = params format = params
# File lib/qq_hulian/user.rb, line 14 def get_user_info method = "get_user_info" begin access_token = params[:access_token].to_s oauth_consumer_key = params[:oauth_consumer_key].to_s openid = params[:openid].to_s format = params[:format].to_s rescue => err raise error_msg(method,err.to_s) end begin url = "https://graph.qq.com/user/get_user_info" params = {} params.merge!(access_token:access_token) params.merge!(oauth_consumer_key:oauth_consumer_key) params.merge!(openid:openid) params.merge!(format:format) msg = https_get(url,params) user_msg = JSON.parse(msg) rescue => err if @_retry then retry else raise error_msg(method,err.to_s) end end end
Private Instance Methods
error_msg(method,msg)
click to toggle source
# File lib/qq_hulian/user.rb, line 51 def error_msg(method,msg) "Error in Model:QQHULIAN Class:User Mehtod:#{method} Msg:#{msg} " end