Module: WxExt::Api::User::Group
Overview
User group api of weixin.
Instance Method Summary collapse
-
#create_group(access_token, group_name) ⇒ Hash
Create user group via post.
-
#groups(access_token) ⇒ Hash
Get all groups via get.
-
#mv_user_group(access_token, openid, to_groupid) ⇒ Hash
Move user group via post.
-
#update_group_name(access_token, id, name) ⇒ Hash
Update user group name via post.
-
#user_of_group(access_token, openid) ⇒ Hash
Get user of group via post.
Instance Method Details
#create_group(access_token, group_name) ⇒ Hash
Create user group via post.
23 24 25 26 27 |
# File 'lib/wx_ext/api/user/group.rb', line 23 def create_group(access_token, group_name) url = 'https://api.weixin.qq.com/cgi-bin/groups/create'\ "?access_token=#{access_token}" Helper.http_post(url, { group: { name: group_name } }.to_json) end |
#groups(access_token) ⇒ Hash
Get all groups via get.
33 34 35 36 37 |
# File 'lib/wx_ext/api/user/group.rb', line 33 def groups(access_token) url = 'https://api.weixin.qq.com/cgi-bin/groups/get'\ "?access_token=#{access_token}" Helper.http_get(url, { accept: :json }.to_json) end |
#mv_user_group(access_token, openid, to_groupid) ⇒ Hash
Move user group via post.
68 69 70 71 72 |
# File 'lib/wx_ext/api/user/group.rb', line 68 def mv_user_group(access_token, openid, to_groupid) url = 'https://api.weixin.qq.com/cgi-bin/groups/members/update'\ "?access_token=#{access_token}" Helper.http_post(url, { openid: openid, to_groupid: to_groupid }.to_json) end |
#update_group_name(access_token, id, name) ⇒ Hash
Update user group name via post.
56 57 58 59 60 |
# File 'lib/wx_ext/api/user/group.rb', line 56 def update_group_name(access_token, id, name) url = 'https://api.weixin.qq.com/cgi-bin/groups/update'\ "?access_token=#{access_token}" Helper.http_post(url, { group: { id: id, name: name } }.to_json) end |
#user_of_group(access_token, openid) ⇒ Hash
Get user of group via post.
44 45 46 47 48 |
# File 'lib/wx_ext/api/user/group.rb', line 44 def user_of_group(access_token, openid) url = 'https://api.weixin.qq.com/cgi-bin/groups/getid'\ "?access_token=#{access_token}" Helper.http_post(url, { openid: openid }.to_json) end |