Class: Wechat::ShakeAround::Group
- Inherits:
-
Object
- Object
- Wechat::ShakeAround::Group
- Extended by:
- Common
- Defined in:
- lib/wechat/shake_around/group.rb
Constant Summary
Constants included from Common
Class Method Summary collapse
- .create(access_token, name) ⇒ Object
- .destroy(access_token, group_id) ⇒ Object
- .index(access_token, offset = 0, limit = 1000) ⇒ Object
- .load(access_token, group_id, offset = 0, limit = 1000) ⇒ Object
- .update(access_token, group_id, name) ⇒ Object
Methods included from Common
normalize_date, normalize_device_id, normalize_page_ids
Class Method Details
.create(access_token, name) ⇒ Object
新增分组mp.weixin.qq.com/wiki/10/9f6b498b6aa0eb5ef6b9ab5a70cc8fba.html#.E6.96.B0.E5.A2.9E.E5.88.86.E7.BB.84
Return hash format if success: {
data:
{
group_id: <GROUP_ID>,
group_name: <GROUP_NAME>
},
errcode: 0,
errmsg: "success."
}
name: 分组名称,不超过100汉字或200个英文字母
131 132 133 134 |
# File 'lib/wechat/shake_around/group.rb', line 131 def self.create(access_token, name) = ::JSONClient.new.post "https://api.weixin.qq.com/shakearound/device/group/add?access_token=#{access_token}", { group_name: name } .body end |
.destroy(access_token, group_id) ⇒ Object
删除分组mp.weixin.qq.com/wiki/10/9f6b498b6aa0eb5ef6b9ab5a70cc8fba.html#.E5.88.A0.E9.99.A4.E5.88.86.E7.BB.84
Return hash format if success:
data: {,
errcode: 0,
errmsg: "success."
}
group_id: 分组唯一标识,全局唯一
90 91 92 93 |
# File 'lib/wechat/shake_around/group.rb', line 90 def self.destroy(access_token, group_id) = ::JSONClient.new.post "https://api.weixin.qq.com/shakearound/device/group/delete?access_token=#{access_token}", { group_id: group_id.to_i } .body end |
.index(access_token, offset = 0, limit = 1000) ⇒ Object
Return hash format if success: {
data:
{
groups:
[
{
group_id: <GROUP_ID>,
group_name: <GROUP_NAME>
},
...
],
total_count: <TOTAL_COUNT> //
}
offset: 分组列表的起始索引值limit: 待查询的分组数量,不能超过1000个
30 31 32 33 34 35 36 37 |
# File 'lib/wechat/shake_around/group.rb', line 30 def self.index(access_token, offset = 0, limit = 1000) = ::JSONClient.new.post "https://api.weixin.qq.com/shakearound/device/group/getlist?access_token=#{access_token}", { begin: offset.to_i, count: limit.to_i } .body end |
.load(access_token, group_id, offset = 0, limit = 1000) ⇒ Object
Return hash format if success: {
data:
{
group_id: <GROUP_ID>,
group_name: <GROUP_NAME>,
total_count: <TOTAL_COUNT>, //
}
group_id: 分组唯一标识,全局唯一offset: 分组里设备的起始索引值limit: 待查询的分组里设备的数量,不能超过1000个
69 70 71 72 73 74 75 76 77 |
# File 'lib/wechat/shake_around/group.rb', line 69 def self.load(access_token, group_id, offset = 0, limit = 1000) = ::JSONClient.new.post "https://api.weixin.qq.com/shakearound/device/group/getdetail?access_token=#{access_token}", { group_id: group_id.to_i, begin: offset.to_i, count: limit.to_i } .body end |
.update(access_token, group_id, name) ⇒ Object
Return hash format if success:
data: {,
errcode: 0,
errmsg: "success."
}
group_id: 分组唯一标识,全局唯一name: 分组名称,不超过100汉字或200个英文字母
107 108 109 110 111 112 113 114 |
# File 'lib/wechat/shake_around/group.rb', line 107 def self.update(access_token, group_id, name) = ::JSONClient.new.post "https://api.weixin.qq.com/shakearound/device/group/update?access_token=#{access_token}", { group_id: group_id.to_i, group_name: name } .body end |